initialize core

pull/4/head
Zlatin Balevsky 2019-06-04 16:56:58 +01:00
parent f2ea8619bb
commit d5db49fa79
2 changed files with 37 additions and 2 deletions

View File

@ -1,3 +1,7 @@
apply plugin : 'application'
mainClassName = 'com.muwire.cli.Cli'
dependencies {
compile project(":core")
}

View File

@ -1,8 +1,39 @@
package com.muwire.cli
import com.muwire.core.Core
import com.muwire.core.MuWireSettings
class Cli {
public static void main(String[] args) {
println "MuWire command-line interface"
def home = System.getProperty("user.home") + File.separator + ".MuWire"
home = new File(home)
if (!home.exists())
home.mkdirs()
def propsFile = new File(home,"MuWire.properties")
if (!propsFile.exists()) {
println "create props file ${propsFile.getAbsoluteFile()} before launching MuWire"
System.exit(1)
}
def props = new Properties()
props.eachWithIndex { props.load(id) }
props = new MuWireSettings(props)
Core core
try {
core = new Core(props, home, "0.0.7")
} catch (Exception bad) {
bad.printStackTrace(System.out)
println "Failed to initialize core, exiting"
System.exit(1)
}
core.startServices()
// now we begin
println "MuWire is ready"
Thread.sleep(Integer.MAX_VALUE)
}
}