diff --git a/lib/cybele/app_builder.rb b/lib/cybele/app_builder.rb index 2a50d13..f87fa2d 100644 --- a/lib/cybele/app_builder.rb +++ b/lib/cybele/app_builder.rb @@ -51,6 +51,49 @@ def setup_staging_environment run 'cp config/environments/production.rb config/environments/staging.rb' end + def generate_config + generate 'config:install' + run 'cp config/settings/development.yml config/settings/staging.yml' + end + + def fill_settings_yml + config = <<-YML +email: + sandbox: sandbox@#{app_name}.com + noreply: no-reply@#{app_name}.com + admin: admin@#{app_name}.com + +basic_auth: + username: #{app_name} + password: #{app_name} + +sidekiq: + username: #{app_name} + password: #{app_name} + +root_path: <%= ENV['ROOT_PATH'] %> + +smtp: + address: <%= ENV['SMTP_ADDRESS'] %> + port: 587 + enable_starttls_auto: true + user_name: <%= ENV['SMTP_USER_NAME'] %> + password: <%= ENV['SMTP_PASSWORD'] %> + authentication: 'plain' + +AWS: + S3: + bucket: <%= ENV['S3_BUCKET_NAME'] %> + access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %> + secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> + aws_url: http://<%= ENV['AWS_RAW_URL'] %> + aws_raw_url: <%= ENV['AWS_RAW_URL'] %> + # Bucket region should be ireland for this setting + end_point: s3-eu-west-1.amazonaws.com + YML + prepend_file 'config/settings.yml', config + end + private def configure_environment(rails_env, config) diff --git a/lib/cybele/generators/app_generator.rb b/lib/cybele/generators/app_generator.rb index 2f25144..ff806f4 100644 --- a/lib/cybele/generators/app_generator.rb +++ b/lib/cybele/generators/app_generator.rb @@ -101,7 +101,7 @@ def setup_responders end def setup_staging_environment - say 'Setting up the staging environment' + say 'Setting up the staging environment', :green build :setup_staging_environment end @@ -110,6 +110,16 @@ def configure_recipient_interceptor build :configure_recipient_interceptor end + def setup_config + say 'Generate config', :green + build :generate_config + end + + def fill_settings_yml + say 'Fill to settings.yml file', :green + build :fill_settings_yml + end + def goodbye say 'Congratulations! That\'s all...', :green end diff --git a/templates/cybele_Gemfile.erb b/templates/cybele_Gemfile.erb index 4034681..22c542a 100644 --- a/templates/cybele_Gemfile.erb +++ b/templates/cybele_Gemfile.erb @@ -1,3 +1,6 @@ # For never accidentally send emails to real people from staging environment. -gem 'recipient_interceptor', '~> 0.1.2' \ No newline at end of file +gem 'recipient_interceptor', '~> 0.1.2' + +# RailsConfig helps you easily manage environment specific Rails settings in an easy and usable manner +gem 'config', '~> 1.5' \ No newline at end of file