Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Butler 9 merge override variables #29

Merged
merged 2 commits into from
Apr 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!"