Skip to content

Commit

Permalink
Merge pull request #36 from pstephens/bugfix/wrong-sitemap-domain
Browse files Browse the repository at this point in the history
#35 - Added config profiles and documentation to reduce deployment errors
  • Loading branch information
pstephens authored Aug 12, 2016
2 parents ceb90bf + c024565 commit b375716
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 13 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).


## 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```.
7 changes: 7 additions & 0 deletions configs/beta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"profile": "default",
"region": "us-east-1",
"bucket": "kingjames-beta",
"canonical": "https://kingjames.bible",
"baseurl": "https://beta.kingjames.bible"
}
7 changes: 7 additions & 0 deletions configs/prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"profile": "default",
"region": "us-east-1",
"bucket": "kingjames-prod",
"canonical": "https://kingjames.bible",
"baseurl": "https://kingjames.bible"
}
36 changes: 24 additions & 12 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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'))
Expand All @@ -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',
Expand Down

0 comments on commit b375716

Please sign in to comment.