Generating env config
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/index.js b/xos/core/xoslib/ngXosLib/generator-xos/app/index.js
index 15d400b..c5bc4f9 100755
--- a/xos/core/xoslib/ngXosLib/generator-xos/app/index.js
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/index.js
@@ -9,18 +9,54 @@
_fistCharToUpper: function(string){
return string.replace(/^./, string[0].toUpperCase());
},
- prompting: function(){
- var done = this.async();
- this.prompt({
- type : 'input',
- name : 'name',
- message : 'Your project name',
- default : this.config.get('name') // value set in .yo-rc.json
- }, function (answers) {
- // TODO check if this view already exist
- config.name = answers.name;
- done();
- }.bind(this));
+ prompting: {
+ name:function(){
+ var done = this.async();
+ this.prompt({
+ type : 'input',
+ name : 'name',
+ message : 'Your project name',
+ default : this.config.get('name') // value set in .yo-rc.json
+ }, function (answers) {
+ console.log(answers);
+ // TODO check if this view already exist
+ config.name = answers.name;
+ done();
+ }.bind(this));
+ },
+ host:function(){
+ var done = this.async();
+ this.prompt({
+ type : 'input',
+ name : 'host',
+ message : 'Your project remote host (with port)'
+ }, function (answers) {
+ config.host = answers.host;
+ done();
+ }.bind(this));
+ },
+ token:function(){
+ var done = this.async();
+ this.prompt({
+ type : 'input',
+ name : 'token',
+ message : 'Insert your active session token'
+ }, function (answers) {
+ config.token = answers.token;
+ done();
+ }.bind(this));
+ },
+ session:function(){
+ var done = this.async();
+ this.prompt({
+ type : 'input',
+ name : 'session',
+ message : 'Insert your active session id'
+ }, function (answers) {
+ config.session = answers.session;
+ done();
+ }.bind(this));
+ }
},
writing: {
rcFiles: function(){
@@ -34,6 +70,13 @@
{ name: config.name, author: {name:user.git.name()} }
);
},
+ envConfig: function(){
+ this.fs.copyTpl(
+ this.templatePath('env/default.js'),
+ this.destinationPath(`${this.config.get('folder')}/${config.name}/env/default.js`),
+ { host: config.host, token: config.token, session: config.session }
+ );
+ },
bowerJson: function(){
this.fs.copyTpl(
this.templatePath('bower.json'),
diff --git a/xos/core/xoslib/ngXosLib/generator-xos/app/templates/env/default.js b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/env/default.js
new file mode 100644
index 0000000..e098625
--- /dev/null
+++ b/xos/core/xoslib/ngXosLib/generator-xos/app/templates/env/default.js
@@ -0,0 +1,5 @@
+module.exports = {
+ host: '<%= host %>',
+ xoscsrftoken: '<%= token %>',
+ xossessionid: '<%= session %>'
+};
\ No newline at end of file