Added review directory settings. Fixed Eclipse settings.

This commit is contained in:
Christian P. MOMON 2018-01-07 16:32:50 +01:00
parent 7c8ccc1052
commit 0475664083
13 changed files with 93 additions and 28 deletions

View File

@ -6,7 +6,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="test">
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="test">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -35,6 +35,10 @@
<classpathentry kind="lib" path="lib/twitter4j-core-4.0.4.jar" sourcepath="lib/twitter4j-core-4.0.4-src.zip"/>
<classpathentry kind="lib" path="lib/twitter4j-media-support-4.0.4.jar" sourcepath="lib/twitter4j-media-support-4.0.4-src.zip"/>
<classpathentry kind="lib" path="lib/twitter4j-stream-4.0.4.jar" sourcepath="lib/twitter4j-stream-4.0.4-src.zip"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.common.project.facet.core.builder"/>
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>

View File

@ -11,13 +11,13 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.wst.common.project.facet.core.builder.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>

View File

@ -1,4 +1,2 @@
eclipse.preferences.version=1
encoding//target/generated-sources/jaxb=UTF8
encoding/<project>=UTF8
encoding/test=UTF8

View File

@ -0,0 +1,5 @@
XDOCLETBUILDERACTIVE=true
XDOCLETHOME=
XDOCLETUSEGLOBAL=true
XDOCLETVERSION=1.2.1
eclipse.preferences.version=1

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false

View File

@ -1,3 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="jdk1.8.0_92"/>
<installed facet="java" version="1.8"/>
</faceted-project>

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
org.testng.eclipse.maven.additionalClasspath=true
org.testng.eclipse.maven.argline=true
org.testng.eclipse.maven.environ=true
org.testng.eclipse.maven.sysproperties=true
userprojectsettings=false

View File

@ -3,28 +3,30 @@
#
# Revue settings.
hebdobot.review.file.suffix=revue.txt
review.directory=reviews
review.file.suffix=revue.txt
# IRC settings.
hebdobot.irc.host=irc.freenode.org
hebdobot.irc.port=6667
hebdobot.irc.name=Hebdobot
hebdobot.irc.channel=#april-test
irc.host=irc.freenode.org
irc.port=6667
irc.name=Hebdobot
irc.channel=#april-test
# Pastebin settings.
#hebdobot.pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Twitter settings.
#hebdobot.twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#hebdobot.twitter.consumerSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#hebdobot.twitter.accessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#hebdobot.twitter.accessTokenSecret=XXXXXXXXXXXXXXXXXXXXXXXXXX
#twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#twitter.consumerSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#twitter.accessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#twitter.accessTokenSecret=XXXXXXXXXXXXXXXXXXXXXXXXXX
# Ident.ca settings.
#hebdobot.identica.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#hebdobot.identica.apiSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#hebdobot.identica.tokenKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#hebdobot.identica.tokenSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#identica.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#identica.apiSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#identica.tokenKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#identica.tokenSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Notifications
#notify.at5.cron=0 55 11 ? * *

View File

@ -157,8 +157,23 @@ public class HebdobotCLI
if (config.isValid())
{
logger.info("Bot configuring…");
File reviewDirectory;
if (config.getReviewDirectory() == null)
{
reviewDirectory = new File(configFile.getParentFile(), "reviews");
}
else if (config.getReviewDirectory().startsWith("/"))
{
reviewDirectory = new File(config.getReviewDirectory());
}
else
{
reviewDirectory = new File(configFile.getParentFile(), config.getReviewDirectory());
}
Hebdobot bot = new Hebdobot(config.getIrcHost(), config.getIrcPort(), config.getIrcName(), config.getIrcChannel(),
configFile.getParentFile(), config.getReviewFileSuffix());
configFile.getParentFile(), reviewDirectory, config.getReviewFileSuffix());
bot.getPastebinSettings().setApiKey(config.getPastebinApiKey());
bot.getIdenticaSettings().setApiKey(config.getIdenticaApiKey());

View File

@ -281,6 +281,21 @@ public class HebdobotConfigFile extends Properties
return result;
}
/**
* Gets the review directory.
*
* @return the review directory
*/
public String getReviewDirectory()
{
String result;
result = getProperty("review.directory");
//
return result;
}
/**
* Gets the review file suffix.
*

View File

@ -64,6 +64,7 @@ public class Hebdobot extends PircBot
private String host;
private int port;
private String channel;
private File reviewDirectory;
private String reviewFileSuffix;
private Review review;
private IdenticaSettings identicaSettings;
@ -89,7 +90,7 @@ public class Hebdobot extends PircBot
* @param reviewFileSuffix
* the review file suffix
*/
public Hebdobot(final String host, final int port, final String name, final String channel, final File homeDirectory,
public Hebdobot(final String host, final int port, final String name, final String channel, final File homeDirectory, final File reviewDirectory,
final String reviewFileSuffix)
{
this.homeDirectory = homeDirectory;
@ -97,6 +98,7 @@ public class Hebdobot extends PircBot
this.port = port;
this.channel = channel;
this.setName(name);
this.reviewDirectory = reviewDirectory;
this.reviewFileSuffix = reviewFileSuffix;
this.review = null;
@ -323,7 +325,12 @@ public class Hebdobot extends PircBot
logger.info("Write review file.");
try
{
File file = new File(this.homeDirectory, date + "_" + this.reviewFileSuffix);
if (!this.reviewDirectory.exists())
{
logger.info("Create review directory: " + this.reviewDirectory.getAbsolutePath());
this.reviewDirectory.mkdirs();
}
File file = new File(this.reviewDirectory, date + "_" + this.reviewFileSuffix);
FileUtils.writeStringToFile(file, textReview, StandardCharsets.UTF_8);
sendMessage("% Compte-rendu de la revue : " + file.getName());
}
@ -339,6 +346,7 @@ public class Hebdobot extends PircBot
String participants = StringUtils.join(this.review.getParticipants(), " ");
sendMessage("% " + participants + ", pensez à noter votre bénévalo : http://www.april.org/my?action=benevalo");
sendMessage("% Fin de la revue hebdomadaire");
sendMessage(this.review.getOwner(), "Revue finie.");
this.review = null;
}
@ -554,6 +562,7 @@ public class Hebdobot extends PircBot
try
{
sendMessage(sender + ", ok bye.");
sendMessage(sender, "ok bye.");
Thread.sleep(1000);
System.exit(0);
}

View File

@ -36,7 +36,7 @@ public class BotMock extends Hebdobot
*/
public BotMock() throws Exception
{
super("myHost", 0, "Hebdobot", "#april-mock", new File("/tmp/"), "revue.txt");
super("myHost", 0, "Hebdobot", "#april-mock", null, new File("/tmp/"), "revue.txt");
}
/* (non-Javadoc)