lib/natra/generators/app/app_generator.rb in natra-0.0.4 vs lib/natra/generators/app/app_generator.rb in natra-0.0.5

- old
+ new

@@ -12,11 +12,11 @@ class_option :git, type: :boolean, desc: 'Initialize a Git repository' def setup @app_path = name.directory_name @name = name.file_name - options.each {|key, value| instance_variable_set "@#{key}".to_sym, value} + options.each { |key, value| instance_variable_set "@#{key}".to_sym, value } end def self.source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates')) end @@ -71,17 +71,13 @@ def create_readme template('README.md', File.join(@app_path, 'README.md')) end def create_db_config - template('config/db.yml', File.join(@app_path, 'config/db.yml')) + template('config/database.yml', File.join(@app_path, 'config/database.yml')) end - def create_database_initializer - template('config/initializers/database.rb', File.join(@app_path, 'config/initializers/database.rb')) - end - def create_redis_config copy_file('config/redis.yml', File.join(@app_path, 'config/redis.yml')) if @redis end def create_redis_initializer @@ -119,11 +115,11 @@ def create_secrets template('secrets.env', File.join(@app_path, 'secrets.env')) end def create_capistrano_config - inside(@app_path) {run('cap install')} if @capistrano + inside(@app_path) { run('cap install') } if @capistrano end def create_rvm_gemset if @rvm create_file(File.join(@app_path, '.ruby-version'), 'ruby-2.1.0') @@ -133,14 +129,26 @@ puts "You need to run 'bundle install' manually." end end def initialize_git_repo - inside(@app_path) {run('git init .') if @git} + inside(@app_path) { run('git init .') if @git } end def install_dependencies - inside(@app_path) {run('bundle') if @bundle} + inside(@app_path) { run('bundle') if @bundle } + end + + def initialize_app + system <<~SCRIPT + cd #{@app_path} + #{'chmod +x bin/setup'} + git init + git add . + docker-compose build --pull + docker-compose run --rm web bundle + #{'nib setup web'} + SCRIPT end end end end