Skip to content

Commit 4e0cdfd

Browse files
committed
Merge branch 'master' of github.com:DaftMonk/generator-angular-fullstack
2 parents ac2d33b + 96c38c6 commit 4e0cdfd

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

heroku/index.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ Generator.prototype.askForName = function askForName() {
3434
}.bind(this));
3535
};
3636

37+
Generator.prototype.askForRegion = function askForRegion() {
38+
var done = this.async();
39+
40+
var prompts = [{
41+
type: "list",
42+
name: 'region',
43+
message: 'On which region do you want to deploy ?',
44+
choices: [ "US", "EU"],
45+
default: 0
46+
}];
47+
48+
this.prompt(prompts, function (props) {
49+
this.region = props.region.toLowerCase();
50+
done();
51+
}.bind(this));
52+
};
53+
3754
Generator.prototype.checkInstallation = function checkInstallation() {
3855
if(this.abort) return;
3956
var done = this.async();
@@ -65,9 +82,10 @@ Generator.prototype.gitInit = function gitInit() {
6582
Generator.prototype.herokuCreate = function herokuCreate() {
6683
if(this.abort) return;
6784
var done = this.async();
85+
var regionParams = (this.region !== 'us') ? ' --region ' + this.region : '';
6886

6987
this.log(chalk.bold('Creating heroku app and setting node environment'));
70-
var child = exec('heroku apps:create ' + this.deployedName + ' && heroku config:set NODE_ENV=production', { cwd: 'dist' }, function (err, stdout, stderr) {
88+
var child = exec('heroku apps:create ' + this.deployedName + regionParams + ' && heroku config:set NODE_ENV=production', { cwd: 'dist' }, function (err, stdout, stderr) {
7189
if (err) {
7290
this.abort = true;
7391
this.log.error(err);
@@ -182,4 +200,4 @@ Generator.prototype.gitForcePush = function gitForcePush() {
182200
child.stdout.on('data', function(data) {
183201
this.log(data.toString());
184202
}.bind(this));
185-
};
203+
};

0 commit comments

Comments
 (0)