Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Fabfile: GitHub and BitBucket support.
Browse files Browse the repository at this point in the history
  • Loading branch information
sapegin committed Dec 12, 2012
1 parent 0ed89c9 commit d95abeb
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions grunt/tasks/init/fabfile.js
Expand Up @@ -5,35 +5,50 @@
*/

exports.description = 'Create a Fabfile.';
exports.warnOn = 'fabfile.py';

exports.template = function(grunt, init, done) {

var utils = require('./_src/utils')(grunt);

grunt.helper('prompt', {}, [
{
name: 'name',
message: 'Project name',
'default': utils.projectName()
},
{
name: 'server',
message: 'Server (~/.ssh/config alias)',
default: 'locum'
'default': 'locum'
},
{
name: 'grunt',
message: 'Grunt?',
default: 'Y/n'
message: 'Run Grunt via SSH?',
'default': 'Y/n'
},
{
name: 'bare',
message: 'Use bare git repo?',
default: 'Y/n'
},
name: 'kind',
message: 'Repo type (bb|gh|bare)?',
'default': 'bb'
}
], function(err, props) {
grunt.utils._.defaults(props, init.defaults);

props.name = utils.projectName();
props.grunt = /y/i.test(props.grunt);
props.bare = /y/i.test(props.bare);
props.upgrade = props.grunt;

switch (props.kind) {
case 'bb':
props.repo = 'git@bitbucket.org:sapegin/' + props.name + '.git';
break;
case 'gh':
props.repo = 'git@github.com:sapegin/' + props.name + '.git';
break;
default: // bare
props.repo = '~/git/' + props.name + '.git';
}

// Files to copy (and process).
var files = init.filesToCopy(props);

Expand Down

0 comments on commit d95abeb

Please sign in to comment.