Skip to content

Commit

Permalink
Merge pull request #5 from deepu105/xetys-uaa-server
Browse files Browse the repository at this point in the history
uaa server improvements
  • Loading branch information
xetys committed Apr 14, 2016
2 parents eda2675 + 0da4cd6 commit a885ffb
Show file tree
Hide file tree
Showing 83 changed files with 1,502 additions and 206 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
generators/**/templates
generators/**/lib
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
- docker
language: node_js
node_js:
- "4.4.2"
- "4.4.3"
jdk:
- oraclejdk8
env:
Expand Down
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ chances of your issue being dealt with quickly:
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
causing the problem (line of code or commit)

Click [here][1] to open a bug issue with a pre-filled template.
Click [here](https://github.com/jhipster/generator-jhipster/issues/new) to open a bug issue with a pre-filled template. For feature requests and quiries you can use [this template][feature-template].

Issues opened without any of these info will be **closed** without any explanation.

Expand Down Expand Up @@ -200,9 +200,12 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
* All features or bug fixes **must be tested** by one or more tests.
* All files must follow the [.editorconfig file](http://editorconfig.org/) located at the root of the JHipster generator project. Please note that generated projects use the same .editorconfig file, so that both the generator and the generated projects share the same configuration.
* Java files **must be** formatted using [Intellij IDEA's code style](http://confluence.jetbrains.com/display/IntelliJIDEA/Code+Style+and+Formatting). Please note that JHipster commiters have a free Intellij IDEA Ultimate Edition for developing the project.
* JavaScript files **must follow** [Google's JavaScript Style Guide](https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml).
* Generators JavaScript files **must follow** the eslint configuration defined at the project root, which is based on [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript).
* Web apps JavaScript files **must follow** [Google's JavaScript Style Guide](https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml).
* AngularJS files **must follow** [John Papa's Angular 1 style guide] (https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md).

Please ensure to run `npm run lint` and `npm test` on the project root before submitting a pull request.

## <a name="templates"></a> Template Guidelines

The template engine used by yeoman is [EJS](http://ejs.co/), its syntax is fairly simple.
Expand All @@ -218,7 +221,7 @@ Sub templates can be unit tested.

## <a name="commit"></a> Git Commit Guidelines

We have rules over how our git commit messages must be formatted.
We have rules over how our git commit messages must be formatted. Please ensure to [squash](https://help.github.com/articles/about-git-rebase/#commands-available-while-rebasing) unnecessary commits so that your commit history is clean.

### <a name="commit-message-format"></a> Commit Message Format
Each commit message consists of a **header**, a **body** and a **footer**.
Expand Down Expand Up @@ -265,4 +268,4 @@ see http://spring.io/blog/2014/09/26/spring-boot-1-1-7-released
Fix #1234
```
[1]:https://github.com/jhipster/generator-jhipster/issues/new?body=*%20**Overview%20of%20the%20issue**%0A%0A%3C!--%20if%20an%20error%20is%20being%20thrown%20a%20stack%20trace%20helps%20--%3E%0A%0A*%20**Motivation%20for%20or%20Use%20Case**%20%0A%0A%3C!--%20explain%20why%20this%20is%20a%20bug%20for%20you%20--%3E%0A%0A*%20**JHipster%20Version(s)**%20%0A%0A%3C!--%20is%20it%20a%20regression%3F%20--%3E%0A%0A*%20**JHipster%20configuration%2C%20a%20%60.yo-rc.json%60%20file%20generated%20in%20the%20root%20folder**%20%0A%0A%3C!--%20this%20will%20help%20us%20to%20replicate%20the%20scenario%2C%20you%20can%20remove%20the%20rememberMe%20key.%20--%3E%0A%0A*%20**Entity%20configuration(s)%20%60entityName.json%60%20files%20generated%20in%20the%20%60.jhipster%60%20directory**%20%0A%0A%3C!--%20-%20if%20the%20error%20is%20during%20an%20entity%20creation%20or%20associated%20with%20a%20specific%20entity%20--%3E%0A%0A*%20**Browsers%20and%20Operating%20System**%20%0A%0A%3C!--%20is%20this%20a%20problem%20with%20all%20browsers%20or%20only%20IE8%3F%20--%3E%0A%0A*%20**Reproduce%20the%20error**%20%0A%0A%3C!--%20an%20unambiguous%20set%20of%20steps%20to%20reproduce%20the%20error.%20If%20you%20have%20a%20JavaScript%20error%2C%20maybe%20you%20can%20provide%20a%20live%20example%20with%0A%20%20%5BJSFiddle%5D(http%3A%2F%2Fjsfiddle.net%2F)%3F%20--%3E%0A%0A*%20**Related%20issues**%20%0A%0A%3C!--%20has%20a%20similar%20issue%20been%20reported%20before%3F%20--%3E%0A%0A*%20**Suggest%20a%20Fix**%20%0A%0A%3C!--%20if%20you%20can%27t%20fix%20the%20bug%20yourself%2C%20perhaps%20you%20can%20point%20to%20what%20might%20be%0A%20%20causing%20the%20problem%20(line%20of%20code%20or%20commit)%20--%3E
[feature-template]: https://github.com/jhipster/generator-jhipster/issues/new?body=*%20**Overview%20of%20the%20request**%0A%0A%3C!--%20what%20is%20the%20query%20or%20request%20--%3E%0A%0A*%20**Motivation%20for%20or%20Use%20Case**%20%0A%0A%3C!--%20explain%20why%20this%20is%20a%20required%20for%20you%20--%3E%0A%0A%0A*%20**Browsers%20and%20Operating%20System**%20%0A%0A%3C!--%20is%20this%20a%20problem%20with%20all%20browsers%20or%20only%20IE8%3F%20--%3E%0A%0A%0A*%20**Related%20issues**%20%0A%0A%3C!--%20has%20a%20similar%20issue%20been%20reported%20before%3F%20--%3E%0A%0A*%20**Suggest%20a%20Fix**%20%0A%0A%3C!--%20if%20you%20can%27t%20fix%20this%20yourself%2C%20perhaps%20you%20can%20point%20to%20what%20might%20be%0A%20%20causing%20the%20problem%20(line%20of%20code%20or%20commit)%20--%3E
14 changes: 7 additions & 7 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,13 @@ module.exports = JhipsterGenerator.extend({
value: 'microservice',
name: 'Microservice application'
},
{
value: 'uaa',
name: 'Microservice UAA service'
},
{
value: 'gateway',
name: 'Microservice gateway'
},
{
value: 'uaa',
name: 'Microservice UAA service'
}
],
default: 'monolith'
Expand Down Expand Up @@ -259,11 +259,11 @@ module.exports = JhipsterGenerator.extend({
this.generatorType = 'server';
this.skipUserManagement = configOptions.skipUserManagement = true;
}
if (this.applicationType == 'uaa') {
if (this.applicationType === 'uaa') {
this.skipClient = true;
this.generatorType = 'server';
this.skipUserManagement = configOptions.skipUserManagement = false;
//this.authenticationType = configOptions.authenticationType = 'uaa';
this.authenticationType = configOptions.authenticationType = 'uaa';
}
if (this.skipClient) {
// defaults to use when skipping client
Expand Down Expand Up @@ -360,7 +360,7 @@ module.exports = JhipsterGenerator.extend({

insight: function () {
var insight = this.insight();
insight.track('generator', 'app');
insight.trackWithEvent('generator', 'app');
insight.track('app/applicationType', this.applicationType);
insight.track('app/testFrameworks', this.testFrameworks);
},
Expand Down
7 changes: 5 additions & 2 deletions generators/aws/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ util.inherits(AwsGenerator, scriptBase);

module.exports = AwsGenerator.extend({
initializing: {
initAws: function () {
this.awsFactory = new AwsFactory(this);
},
getGlobalConfig: function () {
this.existingProject = false;
this.baseName = this.config.get('baseName');
Expand Down Expand Up @@ -145,11 +148,11 @@ module.exports = AwsGenerator.extend({
configuring: {
insight: function () {
var insight = this.insight();
insight.track('generator', 'aws');
insight.trackWithEvent('generator', 'aws');
},
createAwsFactory: function () {
var cb = this.async();
this.awsFactory = new AwsFactory({region: this.awsRegion});
this.awsFactory.init({region: this.awsRegion});
cb();
},
saveConfig: function () {
Expand Down
41 changes: 23 additions & 18 deletions generators/aws/lib/aws.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
'use strict';
var S3 = require('./s3.js'),
Rds = require('./rds.js'),
chalk = require('chalk'),
Eb = require('./eb.js');

try {
var Aws = require('aws-sdk');
} catch (e) {
console.log(
'You don\'t have the AWS SDK installed. Please install it in the JHipster generator directory.\n\n' +
'WINDOWS\n' +
'cd %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules\\generator-jhipster\n' +
'npm install aws-sdk progress node-uuid\n\n' +
'LINUX / MAC\n' +
'cd /usr/local/lib/node_modules/generator-jhipster\n' +
'npm install aws-sdk progress node-uuid'
);
process.exit(e.code);
}
var Aws, generator;

var AwsFactory = module.exports = function AwsFactory(options) {
var AwsFactory = module.exports = function AwsFactory(generatorRef) {
try {
Aws = require('aws-sdk');
generator = generatorRef;
} catch (e) {
generator.env.error(chalk.red(
'You don\'t have the AWS SDK installed. Please install it in the JHipster generator directory.\n\n') +
chalk.yellow('WINDOWS\n') +
chalk.green('cd %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules\\generator-jhipster\n' +
'npm install aws-sdk progress node-uuid\n\n') +
chalk.yellow('LINUX / MAC\n') +
chalk.green('cd /usr/local/lib/node_modules/generator-jhipster\n' +
'npm install aws-sdk progress node-uuid')
);
}
};

AwsFactory.prototype.init = function initAws(options) {
Aws.config.region = options.region;
};

AwsFactory.prototype.getS3 = function getS3() {
return new S3(Aws);
return new S3(Aws, generator);
};

AwsFactory.prototype.getRds = function getRds() {
return new Rds(Aws);
return new Rds(Aws, generator);
};

AwsFactory.prototype.getEb = function getEb() {
return new Eb(Aws);
return new Eb(Aws, generator);
};
52 changes: 27 additions & 25 deletions generators/aws/lib/eb.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
'use strict';

var chalk = require('chalk');

var aws;
try {
var uuid = require('node-uuid');
} catch (e) {
console.log(
'You don\'t have the AWS SDK installed. Please install it in the JHipster generator directory.\n\n' +
'WINDOWS\n' +
'cd %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules\\generator-jhipster\n' +
'npm install aws-sdk progress node-uuid\n\n' +
'LINUX / MAC\n' +
'cd /usr/local/lib/node_modules/generator-jhipster\n' +
'npm install aws-sdk progress node-uuid'
);
process.exit(e.code);
}
var uuid;


var Eb = module.exports = function Eb(Aws) {
var Eb = module.exports = function Eb(Aws, generator) {
aws = Aws;
try {
uuid = require('node-uuid');
} catch (e) {
generator.env.error(chalk.red(
'You don\'t have the AWS SDK installed. Please install it in the JHipster generator directory.\n\n') +
chalk.yellow('WINDOWS\n') +
chalk.green('cd %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules\\generator-jhipster\n' +
'npm install aws-sdk progress node-uuid\n\n') +
chalk.yellow('LINUX / MAC\n') +
chalk.green('cd /usr/local/lib/node_modules/generator-jhipster\n' +
'npm install aws-sdk progress node-uuid')
);
}
};

Eb.prototype.createApplication = function createApplication(params, callback) {
Expand Down Expand Up @@ -80,7 +82,7 @@ Eb.prototype.createApplication = function createApplication(params, callback) {
});
};

var createApplicationVersion = function createApplicationVersion(params, callback) {
function createApplicationVersion(params, callback) {
var applicationName = params.applicationName,
versionLabel = params.versionLabel,
bucketName = params.bucketName,
Expand All @@ -105,9 +107,9 @@ var createApplicationVersion = function createApplicationVersion(params, callbac
callback(null, {message: 'Application version ' + applicationName + ' created successful'});
}
});
};
}

var checkEnvironment = function checkEnvironment(params, callback) {
function checkEnvironment(params, callback) {
var applicationName = params.applicationName,
environmentName = params.environmentName;

Expand All @@ -128,9 +130,9 @@ var checkEnvironment = function checkEnvironment(params, callback) {
}
});

};
}

var createEnvironment = function createEnvironment(params, callback) {
function createEnvironment(params, callback) {
var applicationName = params.applicationName,
environmentName = params.environmentName,
dbUrl = params.dbUrl,
Expand Down Expand Up @@ -193,9 +195,9 @@ var createEnvironment = function createEnvironment(params, callback) {
else callback(null, {message: 'Environment ' + environmentName + ' created successful'});
});
});
};
}

var getLatestSolutionStackName = function (callback) {
function getLatestSolutionStackName(callback) {
var elasticbeanstalk = new aws.ElasticBeanstalk();

elasticbeanstalk.listAvailableSolutionStacks(function (err, data) {
Expand All @@ -211,9 +213,9 @@ var getLatestSolutionStackName = function (callback) {
function filterCriteria(element) {
return element.indexOf('Tomcat 8') > -1;
}
};
}

var updateEnvironment = function updateEnvironment(params, callback) {
function updateEnvironment(params, callback) {
var environmentName = params.environmentName,
instanceType = params.instanceType,
versionLabel = params.versionLabel;
Expand All @@ -239,4 +241,4 @@ var updateEnvironment = function updateEnvironment(params, callback) {
callback(null, {message: 'Environment ' + environmentName + ' updated successful'});
}
});
};
}
12 changes: 6 additions & 6 deletions generators/aws/lib/rds.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Rds.prototype.createDatabaseUrl = function createDatabaseUrl(params, callback) {
});
};

var createRdsSecurityGroup = function createRdsSecurityGroup(params, callback) {
function createRdsSecurityGroup(params, callback) {
var ec2 = new aws.EC2();

var securityGroupParams = {
Expand All @@ -81,9 +81,9 @@ var createRdsSecurityGroup = function createRdsSecurityGroup(params, callback) {
callback(null, {rdsSecurityGroupId: data.GroupId});
}
});
};
}

var authorizeSecurityGroupIngress = function authorizeSecurityGroupIngress(params, callback) {
function authorizeSecurityGroupIngress(params, callback) {
var ec2 = new aws.EC2();

var securityGroupParams = {
Expand All @@ -101,9 +101,9 @@ var authorizeSecurityGroupIngress = function authorizeSecurityGroupIngress(param
callback(null, {message: 'Create security group successful'});
}
});
};
}

var createDbInstance = function createDbInstance(params, callback) {
function createDbInstance(params, callback) {
var rds = new aws.RDS();

var dbInstanceParams = {
Expand All @@ -128,4 +128,4 @@ var createDbInstance = function createDbInstance(params, callback) {
callback(null, {message: 'Database created successful'});
}
});
};
}
Loading

0 comments on commit a885ffb

Please sign in to comment.