From 153363a3201144dfaf4a0c2c9241ef940ad60182 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 24 Apr 2014 06:07:45 -0700 Subject: [PATCH] Code cleanup. More gradle integration. Implemented random quote via iheartquotes.com Implemented war game. --- .gitignore | 1 + README.txt | 14 +- build.gradle | 102 +- build.properties | 12 - buildnum.properties | 4 +- licenses/License.txt | 2 +- mobibot.iml | 4 +- mobibot.ipr | 12 +- mobibot.iws | 1010 +++++++++-------- .../erik/mobibot/CurrencyConverter.java | 68 +- .../thauvin/erik/mobibot/DeliciousPoster.java | 20 +- .../thauvin/erik/mobibot/EntryComment.java | 24 +- .../net/thauvin/erik/mobibot/EntryLink.java | 118 +- .../net/thauvin/erik/mobibot/FeedReader.java | 28 +- .../thauvin/erik/mobibot/GoogleSearch.java | 24 +- .../net/thauvin/erik/mobibot/Mobibot.java | 547 +++++---- .../java/net/thauvin/erik/mobibot/Quote.java | 109 ++ .../net/thauvin/erik/mobibot/ReleaseInfo.java | 18 +- .../net/thauvin/erik/mobibot/StockQuote.java | 38 +- .../net/thauvin/erik/mobibot/Twitter.java | 40 +- .../net/thauvin/erik/mobibot/Weather.java | 52 +- website/index.html | 158 ++- website/simple.css | 7 +- 23 files changed, 1408 insertions(+), 1004 deletions(-) delete mode 100644 build.properties create mode 100644 src/main/java/net/thauvin/erik/mobibot/Quote.java diff --git a/.gitignore b/.gitignore index 4f84b93..477820a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ /proguard-project.txt /project.properties /test-output +/weather.log CVS diff --git a/README.txt b/README.txt index dca5b6a..1288bbf 100644 --- a/README.txt +++ b/README.txt @@ -1,6 +1,12 @@ Some very basic instructions: - ./gradlew deploy + { clone with git or download the ZIP} + git clone git://github.com/ethauvin/mobibot.git + + cd mobibot + + { build with gradle } + ./gradlew cd deploy @@ -9,7 +15,9 @@ Some very basic instructions: { help } java -jar mobibot.jar -h - + + { twitter oauth token request } + java -cp mobibot.jar net.thauvin.erik.mobibot.TwitterOAuth + { launch } /usr/bin/nohup java -jar mobibot.jar & - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2c96161..2bb6d78 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,14 @@ apply plugin: 'java' apply plugin: 'idea' -version = '0.5' -ext.packageName = 'net.thauvin.erik.mobibot' -ext.mainClassName = packageName + '.Mobibot' -ext.deployDir = 'deploy' +defaultTasks 'deploy' + +version = '0.6' + +def packageName = 'net.thauvin.erik.mobibot' +def mainClassName = packageName + '.Mobibot' +def deployDir = 'deploy' +def isRelease = 'release' in gradle.startParameter.taskNames repositories { mavenCentral() @@ -40,51 +44,67 @@ dependencies { //compile files('../path/to/example.jar') } -task wrapper(type: Wrapper) { - gradleVersion = gradle.gradleVersion -} - compileJava { - dependsOn wrapper doFirst { - ant.taskdef(name: 'jreleaseinfo', - classname: 'ch.oscg.jreleaseinfo.anttask.JReleaseInfoAntTask', - classpath: 'ant/jreleaseinfo-1.3.0.jar') - ant.jreleaseinfo(targetDir: file('src/main/java'), - className: 'ReleaseInfo', - packageName: packageName, - project: rootProject.name, - version: version, - buildnumfile: file('buildnum.properties')) + if (isRelease) + { + ant.taskdef(name: 'jreleaseinfo', + classname: 'ch.oscg.jreleaseinfo.anttask.JReleaseInfoAntTask', + classpath: 'ant/jreleaseinfo-1.3.0.jar') + ant.jreleaseinfo(targetDir: file('src/main/java'), + className: 'ReleaseInfo', + packageName: packageName, + project: rootProject.name, + version: version, + buildnumfile: file('buildnum.properties')) + + } + } + //options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } jar { - doFirst { - manifest { - attributes("Manifest-Version": "1.0", - "Main-Class": mainClassName, - "Class-Path": '. ./lib/' + configurations.compile.collect { it.getName() }.join(' ./lib/')) - } - } + manifest.attributes( + 'Main-Class': mainClassName, + 'Class-Path': '. ./lib/' + configurations.compile.collect { it.getName() }.join(' ./lib/')) version = null } -task deploy(dependsOn: build) { +clean { + delete deployDir +} + +task wrapper(type: Wrapper) { + gradleVersion = gradle.gradleVersion +} + +task copyToDeploy(type: Copy) { + from('properties') { + include '*.properties' + } + from jar + into deployDir +} + +task copyToDeployLib(type: Copy) { + configurations.runtime + into deployDir + '/lib' +} + +task deploy(dependsOn: ['build', 'copyToDeploy', 'copyToDeployLib']) { description = "Copies all needed files to the ${deployDir} directory." - copy { - into deployDir + '/lib' - from configurations.runtime - } - copy { - from 'properties' - into deployDir - include('*.properties') - } - copy { - from jar - into deployDir - } - file(deployDir + '/logs').mkdirs(); -} \ No newline at end of file + group = "Publishing" + outputs.dir deployDir + inputs.files copyToDeploy + inputs.files copyToDeployLib + mustRunAfter clean + file(deployDir + '/logs').mkdir() +} + +task release(dependsOn: ['deploy', 'wrapper']) { + group = "Publishing" + description = "Releases new version." + isRelease = true +} diff --git a/build.properties b/build.properties deleted file mode 100644 index 023fd99..0000000 --- a/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -# Project -proj.name=mobibot -proj.version=0.5 -proj.package=net.thauvin.erik.mobibot -proj.run=${proj.package}.Mobibot - -# Locations -path.classes=build -path.src=src -path.dist=dist -path.lib=lib -path.ant=ant \ No newline at end of file diff --git a/buildnum.properties b/buildnum.properties index d4904de..a9ea87f 100644 --- a/buildnum.properties +++ b/buildnum.properties @@ -1,3 +1,3 @@ #ANT Task: ch.oscg.jreleaseinfo.BuildNumberHandler -#Sat Apr 19 21:14:33 PDT 2014 -build.num.last=40 +#Sun Apr 20 23:26:28 PDT 2014 +build.num.last=0 diff --git a/licenses/License.txt b/licenses/License.txt index 29ab484..07d745b 100644 --- a/licenses/License.txt +++ b/licenses/License.txt @@ -1,6 +1,6 @@ Mobibot License -Copyright (c) 2004-2010, Erik C. Thauvin (erik@thauvin.net) +Copyright (c) 2004-2014, Erik C. Thauvin (erik@thauvin.net) All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/mobibot.iml b/mobibot.iml index dd01139..66b7d51 100644 --- a/mobibot.iml +++ b/mobibot.iml @@ -1,5 +1,5 @@ - + @@ -24,12 +24,12 @@ - + diff --git a/mobibot.ipr b/mobibot.ipr index 9f63751..11c9875 100644 --- a/mobibot.ipr +++ b/mobibot.ipr @@ -109,10 +109,9 @@ - @@ -641,7 +640,7 @@ - + @@ -775,13 +774,6 @@ - - - - - - - diff --git a/mobibot.iws b/mobibot.iws index a3687b2..b569a16 100644 --- a/mobibot.iws +++ b/mobibot.iws @@ -1,7 +1,6 @@ - @@ -34,56 +33,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + @@ -118,7 +90,6 @@ - + + + + + + + + + + - - - - - - + + + + + + + + + + + + + @@ -203,21 +191,8 @@ - - - - - - - - - - - - - - - + + @@ -261,6 +236,20 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -561,10 +684,10 @@ - @@ -1241,6 +1364,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1281,130 +1528,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1450,17 +1573,17 @@ - + - + - + @@ -1482,12 +1605,14 @@ + + @@ -1541,6 +1666,25 @@ + + + + + + + + + @@ -1808,7 +1952,7 @@ - + + - + - + + @@ -1939,11 +2085,25 @@ + + + + + + + + + + + + + + - @@ -1966,31 +2126,30 @@ - - + + - + - - + - + - - - - + + + + - - + + @@ -2004,10 +2163,11 @@ + - + @@ -2016,7 +2176,7 @@ - + @@ -2104,46 +2264,6 @@