'use strict';
var S3 = require('./s3.js'),
    Rds = require('./rds.js'),
    chalk = require('chalk'),
    Eb = require('./eb.js');

var Aws, generator;

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, generator);
};

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

AwsFactory.prototype.getEb = function getEb() {
    return new Eb(Aws, generator);
};

@@ -214,24 +214,54 @@
 ratorRef) %7B%0A
+    generator = generatorRef;%0A
     try %7B%0A  
@@ -300,55 +300,561 @@
     
-    generator = generatorRef;%0A    %7D catch (e) %7B
+%7D catch (e) %7B%0A        var windowsPath;%0A        var linuxPath;%0A        var applicationType = generator.config.get('applicationType');%0A        if (applicationType === 'monolith' %7C%7C applicationType === 'gateway') %7B%0A            windowsPath = 'cd node_modules%5C%5Cgenerator-jhipster%5Cn';%0A            linuxPath = 'cd node_modules/generator-jhipster%5Cn';%0A        %7D else %7B%0A            windowsPath = 'cd %25USERPROFILE%25%5C%5CAppData%5C%5CRoaming%5C%5Cnpm%5C%5Cnode_modules%5C%5Cgenerator-jhipster%5Cn';%0A            linuxPath = 'cd /usr/local/lib/node_modules/generator-jhipster%5Cn';%0A        %7D
 %0A   
@@ -1072,99 +1072,21 @@
 een(
-'cd %25USERPROFILE%25%5C%5CAppData%5C%5CRoaming%5C%5Cnpm%5C%5Cnode_modules%5C%5Cgenerator-jhipster%5Cn' +%0A           
+windowsPath +
  'np
@@ -1202,75 +1202,19 @@
 een(
-'cd /usr/local/lib/node_modules/generator-jhipster%5Cn' +%0A           
+linuxPath +
  'np

fix aws error message and display generator-jhipster paths depending on project type