Skip to content

Commit

Permalink
Butler 9 merge override variables (#29)
Browse files Browse the repository at this point in the history
* BUTLER-9 #time 2.5h: Merge default settings with an overrides object.

* BUTLER-9 #time 10m: Forgot to uncomment something.
  • Loading branch information
gleroux02 authored and Lauren Byrwa committed Apr 21, 2016
1 parent 178d360 commit 90380af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ var defaults = require('./config/butler.defaults.js');

// Add local config on top; this file should not define an empty defaults var.
try {
var defaults = require('../../conf/butler.defaults.js');
var overrides = require('../../conf/butler.defaults.js');
defaults = extend(defaults, overrides);
}
catch (e) {}

// Helper function to merge to js objects.
function extend(obj, src) {
Object.keys(src).forEach(function(key) { obj[key] = src[key]; });
return obj;
}

// Just run linters
gulp.task('lint', function() {
console.log('Running linters...');
Expand Down
3 changes: 2 additions & 1 deletion config/butler.config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

if [ ! -e ../../conf/butler.defaults.js ]; then
echo "// Project-specific Butler configuration." > ../../conf/butler.defaults.js
echo "var overrides = {};" >> ../../conf/butler.defaults.js
echo "" >> ../../conf/butler.defaults.js

echo "Please provide the repository link for this project. Eg: https://github.com/palantirnet/butler.git"
read project_repo
echo "defaults.repo = \"$project_repo\";" >> ../../conf/butler.defaults.js
echo "overrides.repo = \"$project_repo\";" >> ../../conf/butler.defaults.js
fi;

echo "Thanks for using Butler!"

0 comments on commit 90380af

Please sign in to comment.