diff --git a/build.gradle b/build.gradle index 4d9d97f..b98a903 100644 --- a/build.gradle +++ b/build.gradle @@ -1,93 +1,24 @@ -import org.apache.tools.ant.filters.ReplaceTokens - -buildscript { - repositories { - maven { url 'https://mvn.jdb-labs.com/repo' } - } - dependencies { - classpath 'com.jdbernard:gradle-exec-util:0.2.0' - } -} - plugins { id 'com.palantir.git-version' version '0.5.2' } -apply plugin: "groovy" -apply plugin: "maven" -apply plugin: "war" +allprojects { + group = "com.jdbernard" -group = "com.jdbernard" + buildscript { + repositories { + mavenLocal() + mavenCentral() + jcenter() + maven { url 'https://mvn.jdb-labs.com/repo' } + } + } -import static com.jdbernard.gradle.ExecUtil.* - -version = gitVersion() - -// webAppDirName = "build/webapp/main" - -repositories { + repositories { mavenLocal() mavenCentral() + jcenter() + maven { url "https://mvn.jdb-labs.com/repo" } + } + + apply plugin: 'com.palantir.git-version' + version = gitVersion() } - -dependencies { - compile 'ch.qos.logback:logback-classic:1.1.8' - compile 'ch.qos.logback:logback-core:1.1.8' - compile 'com.impossibl.pgjdbc-ng:pgjdbc-ng:0.6' - compile 'com.lambdaworks:scrypt:1.4.0' - compile 'com.zaxxer:HikariCP:2.5.1' - compile 'javax:javaee-api:7.0' - compile 'javax.ws.rs:javax.ws.rs-api:2.0.1' - compile 'joda-time:joda-time:2.7' - compile 'org.codehaus.groovy:groovy-all:2.4.7' - compile 'org.slf4j:slf4j-api:1.7.22' - runtime 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.3.2' - runtime 'org.glassfish.jersey.containers:jersey-container-servlet:2.16' - runtime 'org.glassfish.jersey.media:jersey-media-json-jackson:2.16' - providedCompile 'javax.servlet:javax.servlet-api:3.1.0' - - testCompile 'junit:junit:4.12' - testCompile 'com.jdblabs:db-migrate.groovy:0.2.5' - testRuntime 'com.h2database:h2:1.4.186' -} - -war { - from "resources/webapp" - from "build/webapp" - filter(ReplaceTokens, tokens: [version: version]) - rename '(.+)(\\..*(css|js))', '$1-' + version + '$2' - webInf { from 'resources/main/WEB-INF' } - exclude "**/.*.swp", "**/.sass-cache" -} - -test { testLogging { events 'failed' } } - -task testWar(type: War) { - from 'resources/webapp' - filter(ReplaceTokens, tokens: [version: version]) - rename '(.+)(\\..*(css|js))', '$1-' + version + '$2' - webInf { from 'resources/test/WEB-INF' } - classifier 'test' } - -task compileScss( - group: 'build', - description: 'Compile SCSS files into CSS.', - type: Exec -) { - executable "scss" - args "--update", "src/main/webapp/css:build/webapp/css" -} - -war.dependsOn compileScss -testWar.dependsOn compileScss - -task deployProd(dependsOn: ['build']) { doLast { - def warName = "${project.name}-${version}.war" - def artifactName = "ROOT.war" - - copy { - from "build/libs" - into "build" - include warName - rename warName, artifactName } - - exec("eb", "deploy", "-l", "${project.name}-${version}") -} } diff --git a/service/build.gradle b/service/build.gradle new file mode 100644 index 0000000..3fded9b --- /dev/null +++ b/service/build.gradle @@ -0,0 +1,77 @@ +import org.apache.tools.ant.filters.ReplaceTokens + +apply plugin: "groovy" +apply plugin: "maven" +apply plugin: "war" + +// webAppDirName = "build/webapp/main" + +buildscript { + dependencies { + classpath 'com.jdbernard:gradle-exec-util:0.2.0' + } +} + +dependencies { + compile localGroovy() + compile 'ch.qos.logback:logback-classic:1.1.8' + compile 'ch.qos.logback:logback-core:1.1.8' + compile 'org.slf4j:slf4j-api:1.7.22' + compile 'com.impossibl.pgjdbc-ng:pgjdbc-ng:0.6' + compile 'com.lambdaworks:scrypt:1.4.0' + compile 'com.zaxxer:HikariCP:2.5.1' + compile 'javax:javaee-api:7.0' + compile 'javax.ws.rs:javax.ws.rs-api:2.0.1' + compile 'joda-time:joda-time:2.7' + runtime 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.3.2' + runtime 'org.glassfish.jersey.containers:jersey-container-servlet:2.16' + runtime 'org.glassfish.jersey.media:jersey-media-json-jackson:2.16' + providedCompile 'javax.servlet:javax.servlet-api:3.1.0' + + testCompile 'junit:junit:4.12' + testCompile 'com.jdblabs:db-migrate.groovy:0.2.5' + testRuntime 'com.h2database:h2:1.4.186' +} + +war { + from "resources/webapp" + from "build/webapp" + filter(ReplaceTokens, tokens: [version: version]) + rename '(.+)(\\..*(css|js))', '$1-' + version + '$2' + webInf { from 'resources/main/WEB-INF' } + exclude "**/.*.swp", "**/.sass-cache" +} + +test { testLogging { events 'failed' } } + +task testWar(type: War) { + from 'resources/webapp' + filter(ReplaceTokens, tokens: [version: version]) + rename '(.+)(\\..*(css|js))', '$1-' + version + '$2' + webInf { from 'resources/test/WEB-INF' } + classifier 'test' } + +task compileScss( + group: 'build', + description: 'Compile SCSS files into CSS.', + type: Exec +) { + executable "scss" + args "--update", "src/main/webapp/css:build/webapp/css" +} + +war.dependsOn compileScss +testWar.dependsOn compileScss + +task deployProd(dependsOn: ['build']) { doLast { + def warName = "${project.name}-${version}.war" + def artifactName = "ROOT.war" + + copy { + from "build/libs" + into "build" + include warName + rename warName, artifactName } + + exec("eb", "deploy", "-l", "${parent.name}-${project.name}-${version}") +} } diff --git a/resources/main/WEB-INF/classes/context.properties b/service/resources/main/WEB-INF/classes/context.properties similarity index 100% rename from resources/main/WEB-INF/classes/context.properties rename to service/resources/main/WEB-INF/classes/context.properties diff --git a/resources/main/WEB-INF/classes/datasource.properties b/service/resources/main/WEB-INF/classes/datasource.properties similarity index 100% rename from resources/main/WEB-INF/classes/datasource.properties rename to service/resources/main/WEB-INF/classes/datasource.properties diff --git a/resources/main/WEB-INF/classes/logback.groovy b/service/resources/main/WEB-INF/classes/logback.groovy similarity index 100% rename from resources/main/WEB-INF/classes/logback.groovy rename to service/resources/main/WEB-INF/classes/logback.groovy diff --git a/resources/main/WEB-INF/web.xml b/service/resources/main/WEB-INF/web.xml similarity index 100% rename from resources/main/WEB-INF/web.xml rename to service/resources/main/WEB-INF/web.xml diff --git a/resources/migration/old-songs-db.groovy b/service/resources/migration/old-songs-db.groovy similarity index 100% rename from resources/migration/old-songs-db.groovy rename to service/resources/migration/old-songs-db.groovy diff --git a/resources/test/WEB-INF/classes/context.properties b/service/resources/test/WEB-INF/classes/context.properties similarity index 100% rename from resources/test/WEB-INF/classes/context.properties rename to service/resources/test/WEB-INF/classes/context.properties diff --git a/resources/test/WEB-INF/classes/datasource.properties b/service/resources/test/WEB-INF/classes/datasource.properties similarity index 100% rename from resources/test/WEB-INF/classes/datasource.properties rename to service/resources/test/WEB-INF/classes/datasource.properties diff --git a/resources/test/WEB-INF/web.xml b/service/resources/test/WEB-INF/web.xml similarity index 100% rename from resources/test/WEB-INF/web.xml rename to service/resources/test/WEB-INF/web.xml diff --git a/resources/test/testdb.init.sql b/service/resources/test/testdb.init.sql similarity index 100% rename from resources/test/testdb.init.sql rename to service/resources/test/testdb.init.sql diff --git a/resources/webapp/favicon.ico b/service/resources/webapp/favicon.ico similarity index 100% rename from resources/webapp/favicon.ico rename to service/resources/webapp/favicon.ico diff --git a/resources/webapp/favicon.png b/service/resources/webapp/favicon.png similarity index 100% rename from resources/webapp/favicon.png rename to service/resources/webapp/favicon.png diff --git a/resources/webapp/images/favicon.png b/service/resources/webapp/images/favicon.png similarity index 100% rename from resources/webapp/images/favicon.png rename to service/resources/webapp/images/favicon.png diff --git a/resources/webapp/images/favicon.svg b/service/resources/webapp/images/favicon.svg similarity index 100% rename from resources/webapp/images/favicon.svg rename to service/resources/webapp/images/favicon.svg diff --git a/resources/webapp/images/new-life-songs.png b/service/resources/webapp/images/new-life-songs.png similarity index 100% rename from resources/webapp/images/new-life-songs.png rename to service/resources/webapp/images/new-life-songs.png diff --git a/resources/webapp/images/new-life-songs.svg b/service/resources/webapp/images/new-life-songs.svg similarity index 100% rename from resources/webapp/images/new-life-songs.svg rename to service/resources/webapp/images/new-life-songs.svg diff --git a/src/main/groovy/com/jdbernard/nlsongs/db/NLSongsDB.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/db/NLSongsDB.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/db/NLSongsDB.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/db/NLSongsDB.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/model/Performance.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/model/Performance.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/model/Performance.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/model/Performance.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/model/Role.java b/service/src/main/groovy/com/jdbernard/nlsongs/model/Role.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/model/Role.java rename to service/src/main/groovy/com/jdbernard/nlsongs/model/Role.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/model/Service.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/model/Service.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/model/Service.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/model/Service.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/model/ServiceType.java b/service/src/main/groovy/com/jdbernard/nlsongs/model/ServiceType.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/model/ServiceType.java rename to service/src/main/groovy/com/jdbernard/nlsongs/model/ServiceType.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/model/Song.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/model/Song.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/model/Song.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/model/Song.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/model/Token.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/model/Token.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/model/Token.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/model/Token.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/model/User.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/model/User.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/model/User.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/model/User.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/model/UserCredentials.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/model/UserCredentials.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/model/UserCredentials.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/model/UserCredentials.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/AllowCors.java b/service/src/main/groovy/com/jdbernard/nlsongs/rest/AllowCors.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/AllowCors.java rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/AllowCors.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/CorsResponseFilter.java b/service/src/main/groovy/com/jdbernard/nlsongs/rest/CorsResponseFilter.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/CorsResponseFilter.java rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/CorsResponseFilter.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/PingResource.java b/service/src/main/groovy/com/jdbernard/nlsongs/rest/PingResource.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/PingResource.java rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/PingResource.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/ServicesResource.java b/service/src/main/groovy/com/jdbernard/nlsongs/rest/ServicesResource.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/ServicesResource.java rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/ServicesResource.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/SongsResource.java b/service/src/main/groovy/com/jdbernard/nlsongs/rest/SongsResource.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/SongsResource.java rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/SongsResource.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/UsersResource.java b/service/src/main/groovy/com/jdbernard/nlsongs/rest/UsersResource.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/UsersResource.java rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/UsersResource.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/security/NLSongsSecurityContext.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/rest/security/NLSongsSecurityContext.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/security/NLSongsSecurityContext.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/security/NLSongsSecurityContext.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/security/SecurityRequestFilter.java b/service/src/main/groovy/com/jdbernard/nlsongs/rest/security/SecurityRequestFilter.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/security/SecurityRequestFilter.java rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/security/SecurityRequestFilter.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/rest/security/TokenPrincipal.java b/service/src/main/groovy/com/jdbernard/nlsongs/rest/security/TokenPrincipal.java similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/rest/security/TokenPrincipal.java rename to service/src/main/groovy/com/jdbernard/nlsongs/rest/security/TokenPrincipal.java diff --git a/src/main/groovy/com/jdbernard/nlsongs/servlet/NLSongsContext.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/servlet/NLSongsContext.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/servlet/NLSongsContext.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/servlet/NLSongsContext.groovy diff --git a/src/main/groovy/com/jdbernard/nlsongs/servlet/NLSongsContextListener.groovy b/service/src/main/groovy/com/jdbernard/nlsongs/servlet/NLSongsContextListener.groovy similarity index 100% rename from src/main/groovy/com/jdbernard/nlsongs/servlet/NLSongsContextListener.groovy rename to service/src/main/groovy/com/jdbernard/nlsongs/servlet/NLSongsContextListener.groovy diff --git a/src/main/sql/20170209113022-create-schema-down.sql b/service/src/main/sql/20170209113022-create-schema-down.sql similarity index 100% rename from src/main/sql/20170209113022-create-schema-down.sql rename to service/src/main/sql/20170209113022-create-schema-down.sql diff --git a/src/main/sql/20170209113022-create-schema-up.sql b/service/src/main/sql/20170209113022-create-schema-up.sql similarity index 100% rename from src/main/sql/20170209113022-create-schema-up.sql rename to service/src/main/sql/20170209113022-create-schema-up.sql diff --git a/src/main/sql/20170209113258-add-song-sequence-down.sql b/service/src/main/sql/20170209113258-add-song-sequence-down.sql similarity index 100% rename from src/main/sql/20170209113258-add-song-sequence-down.sql rename to service/src/main/sql/20170209113258-add-song-sequence-down.sql diff --git a/src/main/sql/20170209113258-add-song-sequence-up.sql b/service/src/main/sql/20170209113258-add-song-sequence-up.sql similarity index 100% rename from src/main/sql/20170209113258-add-song-sequence-up.sql rename to service/src/main/sql/20170209113258-add-song-sequence-up.sql diff --git a/src/main/webapp/css/forSize.mixin.scss b/service/src/main/webapp/css/forSize.mixin.scss similarity index 100% rename from src/main/webapp/css/forSize.mixin.scss rename to service/src/main/webapp/css/forSize.mixin.scss diff --git a/src/main/webapp/css/new-life-songs.scss b/service/src/main/webapp/css/new-life-songs.scss similarity index 100% rename from src/main/webapp/css/new-life-songs.scss rename to service/src/main/webapp/css/new-life-songs.scss diff --git a/src/main/webapp/css/reset.scss b/service/src/main/webapp/css/reset.scss similarity index 100% rename from src/main/webapp/css/reset.scss rename to service/src/main/webapp/css/reset.scss diff --git a/src/main/webapp/doc/api/v1/index.html b/service/src/main/webapp/doc/api/v1/index.html similarity index 100% rename from src/main/webapp/doc/api/v1/index.html rename to service/src/main/webapp/doc/api/v1/index.html diff --git a/src/main/webapp/index.html b/service/src/main/webapp/index.html similarity index 100% rename from src/main/webapp/index.html rename to service/src/main/webapp/index.html diff --git a/src/main/webapp/js/new-life-songs.js b/service/src/main/webapp/js/new-life-songs.js similarity index 100% rename from src/main/webapp/js/new-life-songs.js rename to service/src/main/webapp/js/new-life-songs.js diff --git a/src/main/webapp/service/index.gsp b/service/src/main/webapp/service/index.gsp similarity index 100% rename from src/main/webapp/service/index.gsp rename to service/src/main/webapp/service/index.gsp diff --git a/src/main/webapp/services/index.gsp b/service/src/main/webapp/services/index.gsp similarity index 100% rename from src/main/webapp/services/index.gsp rename to service/src/main/webapp/services/index.gsp diff --git a/src/main/webapp/song/index.gsp b/service/src/main/webapp/song/index.gsp similarity index 100% rename from src/main/webapp/song/index.gsp rename to service/src/main/webapp/song/index.gsp diff --git a/src/main/webapp/songs/index.gsp b/service/src/main/webapp/songs/index.gsp similarity index 100% rename from src/main/webapp/songs/index.gsp rename to service/src/main/webapp/songs/index.gsp diff --git a/src/migration/migrate.groovy b/service/src/migration/migrate.groovy similarity index 100% rename from src/migration/migrate.groovy rename to service/src/migration/migrate.groovy diff --git a/src/test/groovy/com/jdbernard/nlsongs/rest/SongsResourceTest.groovy b/service/src/test/groovy/com/jdbernard/nlsongs/rest/SongsResourceTest.groovy similarity index 100% rename from src/test/groovy/com/jdbernard/nlsongs/rest/SongsResourceTest.groovy rename to service/src/test/groovy/com/jdbernard/nlsongs/rest/SongsResourceTest.groovy diff --git a/src/test/groovy/com/jdbernard/nlsongs/service/NLSongsDBTest.groovy b/service/src/test/groovy/com/jdbernard/nlsongs/service/NLSongsDBTest.groovy similarity index 100% rename from src/test/groovy/com/jdbernard/nlsongs/service/NLSongsDBTest.groovy rename to service/src/test/groovy/com/jdbernard/nlsongs/service/NLSongsDBTest.groovy diff --git a/version.properties b/service/version.properties similarity index 100% rename from version.properties rename to service/version.properties diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..73ca814 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include 'service', 'uploader' diff --git a/uploader/build.gradle b/uploader/build.gradle new file mode 100644 index 0000000..2eecd7f --- /dev/null +++ b/uploader/build.gradle @@ -0,0 +1,24 @@ +apply plugin: 'groovy' +apply plugin: 'application' + +mainClassName = 'com.jdbernard.nlsongs.NLSongsUploader' + +dependencies { + compile localGroovy() + compile 'ch.qos.logback:logback-classic:1.1.8' + compile 'ch.qos.logback:logback-core:1.1.8' + compile 'org.slf4j:slf4j-api:1.7.22' + compile 'com.impossibl.pgjdbc-ng:pgjdbc-ng:0.6' + compile 'com.zaxxer:HikariCP:2.5.1' + compile 'com.miglayout:miglayout-swing:5.0' + compile project(':service') +} + +task writeVersionFile( + group: 'build', + description: 'Write the version to VERSION.txt') { doLast { + + (new File('build/classes/main/VERSION.txt')).text = version +} } + +build.dependsOn writeVersionFile diff --git a/uploader/src/main/groovy/com/jdbernard/nlsongs/NLSongsUploader.groovy b/uploader/src/main/groovy/com/jdbernard/nlsongs/NLSongsUploader.groovy new file mode 100644 index 0000000..4d78332 --- /dev/null +++ b/uploader/src/main/groovy/com/jdbernard/nlsongs/NLSongsUploader.groovy @@ -0,0 +1,37 @@ +package com.jdbernard.nlsongs + +import groovy.beans.Bindable +import groovy.swing.SwingBuilder +import javax.swing.JFrame +import net.miginfocom.swing.MigLayout + +public class NLSongsUploader { + + public static final String VERSION = + NLSongsUploader.getResourceAsStream('/VERSION.txt').text + + // GUI Elements (View) + SwingBuilder swing = new SwingBuilder() + JFrame rootFrame + + public static void main(String[] args) { def inst = new NLSongsUploader() } + + public NLSongsUploader() { + + initGui() + rootFrame.show() + } + + private void initGui() { + + swing.edtBuilder { + this.rootFrame = frame(title: "New Life Songs Uploader ${VERSION}", + iconImages: [imageIcon('/icon.png').image], + preferredSize: [1024, 768], pack: true, + layout: new MigLayout("ins 0, fill"), + defaultCloseOperation: JFrame.EXIT_ON_CLOSE) { + + } + } + } +} diff --git a/uploader/src/main/resources/icon.png b/uploader/src/main/resources/icon.png new file mode 100644 index 0000000..27e921f Binary files /dev/null and b/uploader/src/main/resources/icon.png differ