{"version":3,"sources":["jsdelivr-header.js","/npm/generator-react-on-rails@0.0.5/app/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAEA,IAAI,OAAU,QAAQ,oBAClB,MAAU,QAAQ,SAClB,MAAU,QAAQ,SAClB,MAAU,QAAQ,WAClB,MAAU,QAAQ,eAClB,GAAU,QAAQ,MAClB,KAAU,QAAQ,QAGtB,OAAO,QAAU,OAAO,WAAW,KAAK,OAAO,CAE7C,aAAc,WAEZ,KAAK,IAAM,QAAQ,mBAEnB,KAAK,gBAAkB,CACrB,QACA,cACA,SACA,gBACA,cACA,UACA,OACA,SACA,YACA,OACA,QACA,eACA,cAGF,KAAK,mBAAqB,CACxB,sBACA,aACA,eACA,6BACA,aACA,MACA,8BACA,OACA,cACA,eACA,YACA,gBACA,eACA,eACA,gBACA,WAGF,KAAK,IAAM,CACT,IAAK,YACL,IAAK,SACL,QAAS,SAAS,GAChB,QAAQ,IAAI,SAAW,MAAM,QAAQ,KAAK,IAAM,GAClD,EACA,KAAM,SAAS,GACb,QAAQ,IAAI,OAAS,MAAM,OAAO,KAAK,IAAM,GAC/C,EACA,IAAK,SAAS,GACZ,QAAQ,IAAI,KAAO,MAAM,MAAM,KAAO,GACxC,EACA,OAAQ,SAAS,EAAM,GACrB,QAAQ,IAAI,KAAK,IAAM,MAAM,MAAM,EAAS,KAAO,EACrD,EACA,MAAO,SAAS,GACd,QAAQ,IAAI,KAAK,IAAM,EACzB,GAGF,KAAK,UAAY,SAAS,GACxB,KAAK,IAAI,IAAI,GACb,MAAM,KAAK,GACX,QAAQ,IAAI,aACd,EAEA,KAAK,QAAU,SAAS,GACtB,KAAK,UAAU,KAAK,UAAY,EAClC,EAEA,KAAK,OAAS,SAAS,EAAK,EAAM,GAChC,IAAI,EAAU,GAAU,CAAC,EACrB,EAAU,KAAK,OAAO,KAAK,KAAK,KAAK,aAAa,IAAO,GAC7D,GAAG,cAAc,KAAK,gBAAgB,GAAO,GAC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AAK,UACnC,KAAK,IAAI,eACT,KAAK,OAAO,iBACZ,KAAK,OAAO,kBACZ,KAAK,IAAI,cACT,KAAK,IAAI,aACT,KAAK,OAAO,UACZ,KAAK,IAAI,YAEX,EAEA,YAAa,WAEN,KAAK,aAEV,KAAK,IAAI,QAAQ,4BAEjB,MAAM,GAAG,KAAK,MACd,KAAK,IAAI,aACT,KAAK,IAAI,YAET,MAAM,GAAG,KAAK,KAAK,KAAK,KAAM,KAAK,UACnC,KAAK,OAAO,iBACZ,KAAK,OAAO,kBACZ,KAAK,IAAI,cACT,KAAK,IAAI,cACT,KAAK,IAAI,eACT,KAAK,IAAI,WACT,KAAK,IAAI,WACT,KAAK,IAAI,cACT,KAAK,IAAI,aACT,KAAK,IAAI,YACT,KAAK,OAAO,UACZ,KAAK,IAAI,YAEX,EAEA,QAAS,WAEP,QAAQ,IAAI,QAEZ,KAAK,IAAI,OAAO,aAAc,aAE1B,KAAK,aACP,KAAK,IAAI,QAAQ,YACjB,KAAK,IAAI,MAAM,8BACf,KAAK,IAAI,MAAM,0EAGb,KAAK,aACP,KAAK,IAAI,QAAQ,aACjB,KAAK,IAAI,MAAM,iBACf,KAAK,IAAI,MAAM,kDACf,KAAK,IAAI,MAAM,oFACf,KAAK,IAAI,MAAM,kDACf,KAAK,IAAI,MAAM,IACf,KAAK,IAAI,MAAM,8BACf,KAAK,IAAI,MAAM,uEAGjB,KAAK,IAAI,QAAQ,UACjB,KAAK,IAAI,MAAM,oDAEf,QAAQ,IAAI,OAEd","file":"/npm/generator-react-on-rails@0.0.5/app/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/generator-react-on-rails@0.0.5/app/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nvar yeoman  = require('yeoman-generator'),\n    chalk   = require('chalk'),\n    yosay   = require('yosay'),\n    shell   = require('shelljs'),\n    shift   = require('change-case'),\n    fs      = require('fs'),\n    path    = require('path');\n\n\nmodule.exports = yeoman.generators.Base.extend({\n\n  initializing: function() {\n\n    this.pkg = require('../package.json');\n\n    this.npmDependencies = [\n      'babel',\n      'body-parser',\n      'cookie',\n      'cookie-parser',\n      'compression',\n      'express',\n      'jade',\n      'morgan',\n      'nprogress',\n      'path',\n      'react',\n      'react-router',\n      'superagent'\n    ];\n\n    this.npmDevDependencies = [\n      'autoprefixer-loader',\n      'babel-core',\n      'babel-loader',\n      'compression-webpack-plugin',\n      'css-loader',\n      'del',\n      'extract-text-webpack-plugin',\n      'gulp',\n      'gulp-eslint',\n      'gulp-express',\n      'gulp-util',\n      'node-notifier',\n      'run-sequence',\n      'style-loader',\n      'stylus-loader',\n      'webpack'\n    ];\n\n    this.say = {\n      arr: '----> ',\n      tab: '      ',\n      section: function(msg) {\n        console.log('\\n\\n\\n' + chalk.bgGreen(this.arr + msg));\n      },\n      info: function(msg) {\n        console.log('\\n\\n' + chalk.yellow(this.arr + msg));\n      },\n      cmd: function(cmd) {\n        console.log('\\n' + chalk.green('$ ' + cmd));\n      },\n      status: function(item, status) {\n        console.log(this.tab + chalk.green(status + ' ') + item);\n      },\n      plain: function(msg) {\n        console.log(this.tab + msg);\n      }\n    };\n\n    this.shellExec = function(cmd) {\n      this.say.cmd(cmd);\n      shell.exec(cmd);\n      console.log('Completed.');\n    };\n\n    this.rvmExec = function(cmd) {\n      this.shellExec(this.rvmString + cmd);\n    };\n\n    this.render = function(src, dest, params) {\n      var _params = params || {},\n          output  = this.engine(this.read(this.templatePath(src)), _params);\n      fs.writeFileSync(this.destinationPath(dest), output);\n      this.say.status(dest, 'done ');\n    };\n\n    this.copy = function(src, dest, show) {\n      var el = show || dest;\n      shell.cp('-Rf', this.templatePath(src), this.destinationPath(dest));\n      this.say.status(el, 'done ');\n    };\n\n    this.injectInto = function(file, baseString, addString, readFromFile) {\n      var _content  = this.readFileAsString(file),\n          injectant = readFromFile ? fs.readFileSync(this.templatePath(addString)) : addString;\n      _content = _content.replace(\n          baseString + '\\n',\n          baseString + '\\n\\n' + injectant + '\\n\\n'\n      );\n      fs.writeFileSync(this.destinationPath(file), _content);\n      this.say.status(file, 'done ');\n    };\n\n  },\n\n\n  appPrompts: function() {\n\n    var done = this.async();\n\n    this.log(yosay(\n      'Welcome to the marvelous ' + chalk.red('React-on-Rails') + ' generator!'\n    ));\n\n    var prompts = [\n      {\n        type   : 'input',\n        name   : 'name',\n        message: 'Enter app name:',\n        default: shift.param(this.options.argv.original[0]) || null\n      },\n      {\n        type   : 'checkbox',\n        name   : 'parts',\n        message: 'Choose parts to install:',\n        choices: [\n          {\n            name   : 'Node App',\n            value  : 'app',\n            checked: true\n          },\n          {\n            name   : 'Rails API',\n            value  : 'api',\n            checked: true\n          }\n        ]\n      },\n      {\n        type   : 'confirm',\n        name   : 'configRepo',\n        message: 'Configure remote repo on Github / Bitbucket?',\n        default: true\n      }\n\n    ];\n\n    this.prompt(prompts, function (props) {\n\n      function installPart(part) {\n        return props.parts.indexOf(part) !== -1;\n      }\n\n      this.name        = shift.param(props.name);\n      this.appName     = this.name + '-app';\n      this.apiName     = this.name + '-api';\n      this.installApp  = installPart('app');\n      this.installApi  = installPart('api');\n\n      this.root        = path.join(shell.pwd(), this.name);\n      this.rubyVersion = shell.env['RUBY_VERSION'];\n      this.rvmString   = 'rvm ' + this.rubyVersion + '@' + this.name + ' do ';\n\n      this.configRepo  = props.configRepo;\n\n      done();\n\n    }.bind(this));\n\n  },\n\n  repoPrompts: function() {\n\n    var done = this.async();\n\n    if (this.configRepo) {\n\n      var prompts = [\n        {\n          type   : 'list',\n          name   : 'repo',\n          message: 'Github or Bitbucket?',\n          default: 0,\n          choices: [\n            {\n              name : 'Github',\n              value: 'github'\n            },\n            {\n              name : 'Bitbucket',\n              value: 'bitbucket'\n            }\n          ]\n        },\n        {\n          type   : 'input',\n          name   : 'repoUser',\n          message: 'Your username:'\n        }\n      ];\n\n      this.prompt(prompts, function (props) {\n\n        this.repo = props.repo;\n\n        if (this.repo === 'github') {\n          this.repoUser   = props.repoUser || 'alexfedoseev';\n          this.repoAppUrl = 'https://github.com/' + this.repoUser + '/' + this.appName;\n          this.repoApiUrl = 'https://github.com/' + this.repoUser + '/' + this.apiName;\n          this.repoAppSsh = 'git@github.com:' + this.repoUser + '/' + this.appName + '.git';\n          this.repoApiSsh = 'git@github.com:' + this.repoUser + '/' + this.apiName + '.git';\n        } else {\n          this.repoUser   = props.repoUser || 'alex_fedoseev';\n          this.repoAppUrl = 'https://bitbucket.org/' + this.repoUser + '/' + this.appName;\n          this.repoApiUrl = 'https://bitbucket.org/' + this.repoUser + '/' + this.apiName;\n          this.repoAppSsh = 'git@bitbucket.org:' + this.repoUser + '/' + this.appName + '.git';\n          this.repoApiSsh = 'git@bitbucket.org:' + this.repoUser + '/' + this.apiName + '.git';\n        }\n\n        done();\n\n      }.bind(this));\n\n    } else {\n\n      done();\n\n    }\n\n  },\n\n\n  pushPrompt: function() {\n\n    var done = this.async();\n\n    if (this.configRepo && this.repo) {\n\n      var notice, newLine = '\\n    ';\n\n      notice  = newLine + 'Check that you have created:';\n      if (this.installApp) notice += newLine + 'Node app repo:  ' + this.repoAppSsh;\n      if (this.installApi) notice += newLine + 'Rails app repo: ' + this.repoApiSsh;\n\n      var prompt = [\n        {\n          type   : 'confirm',\n          name   : 'pushToRemote',\n          message: 'Push first commit to remote?' + newLine + notice + newLine + newLine + 'Push now?',\n          default: false\n        }\n      ];\n\n      this.prompt(prompt, function (props) {\n\n        this.pushToRemote = props.pushToRemote;\n        done();\n\n      }.bind(this));\n\n    } else {\n\n      done();\n\n    }\n\n  },\n\n\n  methods: function() {\n\n    this.app = {\n\n      setupProject: function() {\n        this.say.info('Setting up project...');\n        this.render('app/_package.json', 'package.json', { appName: this.appName, repoUrl: this.repoAppUrl });\n        this.copy('app/server.js', '.', 'server.js');\n        shell.mkdir('config/');\n        this.render('app/config/_server.js', 'config/server.js', { name: this.name });\n        this.copy('app/gulpfile.js', '.', 'gulpfile.js');\n        this.copy('app/.eslintrc', '.', '.eslintrc');\n        this.copy('app/app/', 'app/');\n        this.copy('app/build/', 'build/');\n        this.copy('app/server/', 'server/');\n        this.copy('app/public/', 'public/');\n        shell.exec('touch public/.keeper');\n        this.copy('app/log/', 'log/');\n        shell.exec('touch log/.keeper');\n      }.bind(this),\n\n      setupDeploy: function() {\n        this.say.info('Setting up deploy...');\n        this.copy('app/config/mina/', 'config/mina/');\n        this.render('docs/app.rb', 'config/mina/docs/deploy.rb');\n        this.render('app/config/_deploy_defaults.rb', 'config/mina/defaults.rb', { repo: this.repoAppSsh });\n        this.render('app/config/_deploy.rb', 'config/deploy.rb', { name: this.name });\n      }.bind(this),\n\n      npmInstall: function() {\n        var _deps    = this.npmDependencies.join(' '),\n            _devDeps = this.npmDevDependencies.join(' ');\n        this.say.info('Installing dependencies...');\n        this.shellExec('npm install ' + _deps + ' --save --loglevel error');\n        this.shellExec('npm install ' + _devDeps + ' --save-dev --loglevel error');\n        this.shellExec('npm shrinkwrap --loglevel error');\n      }.bind(this),\n\n      gitRemote: function() {\n        if (this.repoAppSsh) {\n          this.say.info('Configuring remote...');\n          this.shellExec('git remote add origin ' + this.repoAppSsh);\n          if (this.pushToRemote) {\n            this.say.info('Pushing to remote...');\n            this.shellExec('git push -u origin master');\n          }\n        }\n      }.bind(this)\n\n    };\n\n    this.api = {\n\n      prepareEnv: function() {\n        this.say.info('Creating gemset...');\n        this.shellExec('rvm gemset create ' + this.name);\n\n        this.say.info('Installing `rails-api` gem...');\n        this.rvmExec('gem install rails-api --quiet');\n      }.bind(this),\n\n      createApp: function() {\n        this.say.info('Creating Rails app...');\n        this.rvmExec('rails-api new ' + this.apiName + ' --skip-sprockets --skip-bundle --quiet --database=postgresql');\n      }.bind(this),\n\n      editGemfile: function() {\n        this.say.info('Modifying Gemfile...');\n        this.render('api/_Gemfile', 'Gemfile', { version: this.readFileAsString('Gemfile').match(/gem 'rails', (.*)/i)[1] });\n      }.bind(this),\n\n      installGems: function() {\n        this.say.info('Installing gems...');\n        this.say.plain('This WILL take a while.');\n        this.rvmExec('bundle install --without production --quiet');\n      }.bind(this),\n\n      editDBConfig: function() {\n        this.say.info('Modifying database config...');\n        this.render('api/config/_database.yml', 'config/database.yml', { app: shift.snake(this.apiName) });\n      }.bind(this),\n\n      createDB: function() {\n        this.say.info('Creating databases...');\n        this.rvmExec('bundle exec rake db:create:all');\n      }.bind(this),\n\n      editCore: function() {\n        this.say.info('Modifying core...');\n        this.injectInto('config/application.rb', 'class Application < Rails::Application', '    config.middleware.use Rack::Deflater');\n        this.render('api/lib/_api_constraints.rb', 'lib/api_constraints.rb', { name: this.name });\n        this.render('api/app/controllers/_application_controller.rb', 'app/controllers/application_controller.rb');\n        this.copy('api/app/controllers/api/', 'app/controllers/api/');\n      }.bind(this),\n\n      setupDeploy: function() {\n        this.say.info('Setting up deploy...');\n        this.copy('api/lib/mina/', 'lib/mina/');\n        this.render('docs/api.rb', 'lib/mina/docs/deploy.rb');\n        this.render('api/lib/_deploy_defaults.rb', 'lib/mina/defaults.rb', { repo: this.repoApiSsh });\n        this.render('api/config/_deploy.rb', 'config/deploy.rb', { name: this.name });\n        this.render('api/config/_environment_variables.yml', 'config/environment_variables.yml');\n        this.copy('api/config/initializers/!environment_variables.rb', 'config/initializers/');\n      }.bind(this),\n\n      setupTests: function() {\n        this.say.info('Setting up tests...');\n        this.rvmExec('rails g rspec:install');\n        shell.mkdir('-p', 'spec/routing');\n        shell.mkdir('-p', 'spec/support');\n        this.render('api/spec/routing/_api_constraints_spec.rb', 'spec/routing/api_constraints_spec.rb', { name: this.name });\n        this.render('api/spec/support/_request_helpers.rb', 'spec/support/request_helpers.rb', { name: this.name });\n        this.copy('api/spec/support/unauthorized_shared_examples.rb', 'spec/support/');\n        this.injectInto('spec/spec_helper.rb', 'RSpec.configure do |config|', 'api/spec/__spec_helper.rb', true);\n      }.bind(this),\n\n      setupAuth: function() {\n        this.say.info('Setting up authentication...');\n        this.rvmExec('rails generate devise:install');\n        this.rvmExec('rails generate devise User');\n        this.injectInto('app/models/user.rb', ':recoverable, :rememberable, :trackable, :validatable', '  acts_as_token_authenticatable');\n        var migration = fs.readdirSync(this.destinationPath('db/migrate'))[0];\n        this.injectInto('db/migrate/' + migration, 't.string :encrypted_password, null: false, default: \"\"', '      t.string :authentication_token, null: false, default: \"\"');\n        this.injectInto('db/migrate/' + migration, 'add_index :users, :reset_password_token, unique: true', '    add_index :users, :authentication_token, unique: true');\n        this.rvmExec('rails generate serializer User');\n        this.copy('api/app/serializers/user_serializer.rb', 'app/serializers/');\n        this.injectInto('config/initializers/devise.rb', 'Devise.setup do |config|', \"  config.secret_key = ENV['DEVISE_SECRET_KEY'] if Rails.env.production?\");\n        this.render('api/config/_routes.rb', 'config/routes.rb');\n\n      }.bind(this),\n\n      gitRemote: function() {\n        if (this.repoApiSsh) {\n          this.say.info('Configuring remote...');\n          this.shellExec('git remote add origin ' + this.repoApiSsh);\n          if (this.pushToRemote) {\n            this.say.info('Pushing to remote...');\n            this.shellExec('git push -u origin master');\n          }\n        }\n      }.bind(this)\n\n    };\n\n    this.shared = {\n\n      createRvmFiles: function() {\n        this.say.info('Creating rvm files...');\n        this.render('ruby-version', '.ruby-version', { version: this.rubyVersion });\n        this.render('ruby-gemset', '.ruby-gemset', { gemset: this.name });\n      }.bind(this),\n\n      createGitignore: function() {\n        this.say.info('Creating `.gitignore` file...');\n        this.render('gitignore', '.gitignore');\n      }.bind(this),\n\n      gitInit: function() {\n        this.say.info('Initializing git repo...');\n        this.shellExec('git init');\n        this.shellExec('git add .');\n        this.shellExec('git commit --quiet -m \"Initial commit\"');\n      }.bind(this)\n\n    };\n\n  },\n\n\n  writing: {\n\n    scaffoldRoots: function() {\n      this.mkdir(this.name);\n      if (this.installApp) this.mkdir(path.join(this.name, this.appName));\n      if (this.installApi) this.mkdir(path.join(this.name, this.apiName));\n    },\n\n    scaffoldApp: function() {\n\n      if (!this.installApp) return;\n\n      this.say.section('Scaffolding Node App...');\n\n      shell.cd(path.join(this.root, this.appName));\n      this.app.setupProject();\n      this.shared.createRvmFiles();\n      this.shared.createGitignore();\n      this.app.setupDeploy();\n      this.app.npmInstall();\n      this.shared.gitInit();\n      this.app.gitRemote();\n\n    },\n\n    scaffoldApi: function() {\n\n      if (!this.installApi) return;\n\n      this.say.section('Scaffolding Rails API...');\n\n      shell.cd(this.root);\n      this.api.prepareEnv();\n      this.api.createApp();\n\n      shell.cd(path.join(this.root, this.apiName));\n      this.shared.createRvmFiles();\n      this.shared.createGitignore();\n      this.api.editGemfile();\n      this.api.installGems();\n      this.api.editDBConfig();\n      this.api.createDB();\n      this.api.editCore();\n      this.api.setupDeploy();\n      this.api.setupTests();\n      this.api.setupAuth();\n      this.shared.gitInit();\n      this.api.gitRemote();\n\n    },\n\n    allDone: function() {\n\n      console.log('\\n\\n');\n\n      this.say.status('What else:', 'All done!');\n\n      if (this.installApp) {\n        this.say.section('Node App');\n        this.say.plain('- Check app configuration.');\n        this.say.plain('- Check deploy settings in `config/deploy.rb` & `config/mina` folder.');\n      }\n\n      if (this.installApi) {\n        this.say.section('Rails Api');\n        this.say.plain('- Setup User:');\n        this.say.plain('---> Check User model: `app/models/user.rb`');\n        this.say.plain('---> Check User migration: `db/migrate/XXXXXXXXXXXXXX_devise_create_users.rb`');\n        this.say.plain('---> Migrate: `bundle exec rake db:migrate`');\n        this.say.plain('');\n        this.say.plain('- Check app configuration.');\n        this.say.plain('- Check deploy settings in `config/deploy.rb` & `lib/mina` folder.');\n      }\n\n      this.say.section('And...');\n      this.say.plain('Spin it up > Check logs > Fix errors > Have fun!');\n\n      console.log('\\n\\n');\n\n    }\n\n  }\n\n});\n"]}