diff --git a/.gitignore b/.gitignore index 5c7cef8..43ba965 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /conf.xml /target /bin/ +/dist/ +/build/ diff --git a/CHANGES b/CHANGES index c8282bd..edd5568 100644 --- a/CHANGES +++ b/CHANGES @@ -7,7 +7,7 @@ * Place internal classes in their own file. * Renamed package from fr.imirhil.april to org.april * Splitted launcher and CLI. - +* change Java version to 1.8 * anonymized Twitter API key * eplaced Maven with Ant diff --git a/build-appjar.xml b/build-appjar.xml new file mode 100644 index 0000000..f72b13f --- /dev/null +++ b/build-appjar.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Done. + + + + + Type ant -p + + + + + + + + + + + + + + + + + classpath=${toString:project.libs} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.num b/build.num new file mode 100644 index 0000000..a99ac7f --- /dev/null +++ b/build.num @@ -0,0 +1,3 @@ +#Build Number for ANT. Do not edit! +#Sat Jan 06 02:22:43 CET 2018 +build.number=0 diff --git a/build.properties b/build.properties new file mode 100644 index 0000000..946202c --- /dev/null +++ b/build.properties @@ -0,0 +1,3 @@ +product.name=hebdobot +product.revision.major=2 +product.revision.minor=0 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..116375e --- /dev/null +++ b/build.sh @@ -0,0 +1,40 @@ +#/bin/bash + +echo "Hebdobot build" + +okCount=0 + +# Ant check. +antCheck=`which ant` +if [[ "$antCheck" =~ ^/.* ]]; then + echo "Ant requirement................ OK" + let "okCount+=1" +else + echo "Ant requirement................ MISSING" +fi + +# Javac check. +javacCheck=`which javac` +if [[ "$javacCheck" =~ ^/.* ]]; then + echo "Javac requirement.............. OK" + let "okCount+=1" +else + echo "Javac requirement.............. MISSING" +fi + +# Java version check. +javaVersionCheck=`javac -version 2>&1` +if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then + echo "Java 8 version requirement..... OK" + let "okCount+=1" +else + echo "Java 8 version requirement..... MISSING" +fi + +if [ "$okCount" == 3 ]; then + echo "Requirement OK" + ant -f build.xml +else + echo "Requirement MISSING, build abort" +fi + diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..39c1ec8 --- /dev/null +++ b/build.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildandgit.xml b/buildandgit.xml new file mode 100644 index 0000000..d7f899b --- /dev/null +++ b/buildandgit.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/scripts/hebdobot.cron b/resources/conf/hebdobot.cron similarity index 100% rename from resources/scripts/hebdobot.cron rename to resources/conf/hebdobot.cron diff --git a/resources/scripts/hebdobot.initd b/resources/conf/hebdobot.initd similarity index 92% rename from resources/scripts/hebdobot.initd rename to resources/conf/hebdobot.initd index 72ef3a0..512ee7d 100755 --- a/resources/scripts/hebdobot.initd +++ b/resources/conf/hebdobot.initd @@ -15,7 +15,7 @@ NAME=hebdobot BASE_DIR=/srv/$NAME PID_FILE=$BASE_DIR/$NAME.pid DAEMON=$(which java) -DAEMON_ARGS="-cp *:lib/* fr.imirhil.april.hebdobot.Application" +DAEMON_ARGS="" CMD="/sbin/start-stop-daemon --chdir $BASE_DIR --quiet --make-pidfile --pidfile $PID_FILE --exec $DAEMON" case "$1" in diff --git a/resources/conf/log4j-default.properties b/resources/conf/log4j-default.properties index c330438..338bd1e 100644 --- a/resources/conf/log4j-default.properties +++ b/resources/conf/log4j-default.properties @@ -7,3 +7,33 @@ log4j.appender.stdout.layout = org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern = %d %-5p %c - %m%n #log4j.appender.CONSOLE.layout.ConversionPattern = %d{ISO8601} - Hebdobot [%-5p] %34.34c.%25M - %m%n + + +# Log information (priority setting : DEBUG < INFO < WARN < ERROR) +# ################ +log4j.rootLogger = INFO, RSLisi-Writer, CONSOLE + +log4j.logger.fr.devinsy.hico = DEBUG +log4j.logger.fr.devinsy.kiss4web = DEBUG +log4j.logger.fr.devinsy.xidyn = INFO +log4j.logger.fr.devinsy.xidyn.Presenter = INFO +log4j.logger.fr.devinsy.xidyn.FilePresenter = DEBUG +log4j.logger.eu.republiquesociale = DEBUG + + + +#-- +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern = %d{ISO8601} - RSLisi [%-5p] %34.34c.%25M - %m%n + + +#-- +log4j.appender.RSLisi-Writer = org.apache.log4j.RollingFileAppender +log4j.appender.RSLisi-Writer.File = /services/RSLisi/rslisi.log +log4j.appender.RSLisi-Writer.MaxFileSize = 100000KB +log4j.appender.RSLisi-Writer.MaxBackupIndex = 100 +log4j.appender.RSLisi-Writer.layout = org.apache.log4j.PatternLayout +log4j.appender.RSLisi-Writer.layout.ConversionPattern = %d{ISO8601} - RSLisi [%-5p] %-50c.%30M - %m%n + + diff --git a/resources/launch4j.xml b/resources/launch4j.xml deleted file mode 100644 index 12a921c..0000000 --- a/resources/launch4j.xml +++ /dev/null @@ -1,20 +0,0 @@ - - true - console - hebdobot.jar - target/hebdobot/hebdobot.exe - . - normal - http://java.com/download - false - false - hebdobot.ico - - org.april.hebdobot.Bot - lib/* - - - 1.7.0 - preferJre - - \ No newline at end of file diff --git a/resources/scripts/build.sh b/resources/scripts/build.sh deleted file mode 100755 index eca4afe..0000000 --- a/resources/scripts/build.sh +++ /dev/null @@ -1,9 +0,0 @@ -#/bin/sh -mvn clean install -mkdir target/hebdobot -cp target/hebdobot-*.jar target/hebdobot/hebdobot.jar -cp exe/* target/hebdobot -cp LICENSE target/hebdobot -mvn dependency:copy-dependencies -DoutputDirectory=target/hebdobot/lib -launch4j launch4j.xml -(cd target; zip -r9 hebdobot.zip hebdobot) diff --git a/resources/scripts/hebdobot.sh b/resources/scripts/hebdobot.sh index 810e734..4937d8d 100755 --- a/resources/scripts/hebdobot.sh +++ b/resources/scripts/hebdobot.sh @@ -1,2 +1,28 @@ -#!/bin/sh -java -cp '*:lib/*' org.april.hebdobot +#!/bin/bash + +okCount=0 + +# Java check. +javaCheck=`which java` +if [[ "$javaCheck" =~ ^/.* ]]; then + echo "Java requirement............... OK" + let "okCount+=1" +else + echo "Java requirement............... MISSING" +fi + + +# Java version check. +javaVersionCheck=`java -version 2>&1` +if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then + echo "Java 8 version requirement..... OK" + let "okCount+=1" +else + echo "Java 8 version requirement..... MISSING" +fi + +if [ "$okCount" == 2 ]; then + java -jar hebdobot.jar $@ +else + echo "Sorry, Hebdobot launch requires Java 8, abort." +fi diff --git a/src/org/april/hebdobot/util/HebdobotUtils.java b/src/org/april/hebdobot/util/HebdobotUtils.java index cbdc369..2f87ec1 100644 --- a/src/org/april/hebdobot/util/HebdobotUtils.java +++ b/src/org/april/hebdobot/util/HebdobotUtils.java @@ -25,7 +25,6 @@ import java.util.Properties; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.math.NumberUtils; -import org.april.hebdobot.HebdobotException; /** * The Class Launcher. @@ -45,9 +44,8 @@ public class HebdobotUtils * @param source * the source * @return the properties - * @throws HebdobotException - * the hebdobot exception * @throws IOException + * Signals that an I/O exception has occurred. */ public static Properties loadProperties(final File source) throws IOException {