diff --git a/README.md b/README.md index f1ead44..b65da03 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,16 @@ Please add feature suggestions to the issue tracker and I'll see what I can do. ## Tools ### ![BrowserStack](doc/browserstacklogo.png) Cross browser testing is provided by [BrowserStack](https://www.browserstack.com/). - \ No newline at end of file + +## Building and Deploying +To build this software you will need several tools pre-installed: +* Leiningen - Tested with 2.6.1 +* Node.js - 6.3.1 +* NPM - 3.10.3 +* gulp-cli - 0.4.0 - install with ```npm install gulp-cli -g``` + +The build steps are: +1. Resolve all Clojure, ClojureScript, and Node.js dependencies with ```lein deps```. +2. Compile the ClojureScript code with ```lein cljsbuild once```. +3. Build the static web page resources with ```gulp build --config prod```. This will place the resulting files in ```./out/prod```. +4. Publish the static web page resources to an S3 bucket with ```gulp bucketsync --config prod```. \ No newline at end of file diff --git a/configs/beta.json b/configs/beta.json new file mode 100644 index 0000000..ca3ecf1 --- /dev/null +++ b/configs/beta.json @@ -0,0 +1,7 @@ +{ + "profile": "default", + "region": "us-east-1", + "bucket": "kingjames-beta", + "canonical": "https://kingjames.bible", + "baseurl": "https://beta.kingjames.bible" +} \ No newline at end of file diff --git a/configs/prod.json b/configs/prod.json new file mode 100644 index 0000000..8aca87e --- /dev/null +++ b/configs/prod.json @@ -0,0 +1,7 @@ +{ + "profile": "default", + "region": "us-east-1", + "bucket": "kingjames-prod", + "canonical": "https://kingjames.bible", + "baseurl": "https://kingjames.bible" +} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 818888b..86c2d2d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,28 +13,31 @@ var q = require('q'); var config = (function parse_commandline() { var argv_opts = { - boolean: ['prod'], - alias: {prod: 'p'} + string: ['config'], + alias: {config: 'c'} }; var argv = require("minimist")(process.argv.slice(2), argv_opts); var default_config = { - profile: "default", - region: "us-east-1", - bucket: "kingjames-beta", bible_src: 'kjv-src/www.staggs.pair.com-kjbp/kjv.txt', bible_parser: 'staggs', + name: argv.config }; - if(!argv.bucket && argv.prod) { - argv.bucket = "kingjames-prod"; + + var config; + if(argv.config) { + config = JSON.parse(fs.readFileSync(path.join("configs", argv.config + ".json"))); + } + else { + config = {}; } - return _.merge(default_config, argv); + + return _.merge(default_config, config, argv); })(); -var build_config = config.prod ? "prod" : "beta"; var root_dir = __dirname var node_exec_path = process.execPath; var out_bible_dir = path.join(root_dir, 'out/bible'); -var build_dir = path.join(root_dir, 'out/' + build_config); +var build_dir = path.join(root_dir, 'out/' + config.name); var temp_dir = path.join(root_dir, 'out/temp'); var votd_dir = path.join(build_dir, 'votd'); var votd_jasmine_dir = path.join(votd_dir, 'jasmine'); @@ -169,7 +172,11 @@ gulp.task('copy_votd_tests', function copy_votd_tests() { gulp.task('build_votd_js', gulp.series( 'make_temp_votd_dir', - biblecli_task('verseoftheday', 'src/votd/verse-list.md', temp_votd_dir), + biblecli_task('verseoftheday', + '--parser', config.bible_parser, + '--input', config.bible_src, + 'src/votd/verse-list.md', + temp_votd_dir), gulp.parallel( function copy_client_html() { return gulp.src(path.join(temp_votd_dir, 'client.html')) @@ -192,7 +199,12 @@ gulp.task('build', 'clean', 'make_build_dir', gulp.parallel( - biblecli_task('static', build_dir), + biblecli_task('static', + '--parser', config.bible_parser, + '--input', config.bible_src, + '--canonical', config.canonical, + '--baseurl', config.baseurl, + build_dir), 'build_votd'))); gulp.task('bucketsync',