lib/suspenders/app_builder.rb in welaika-suspenders-2.6.0 vs lib/suspenders/app_builder.rb in welaika-suspenders-2.7.0

- old
+ new

@@ -105,11 +105,11 @@ "config.assets.version = '1.0'", 'config.assets.version = (ENV["ASSETS_VERSION"] || "1.0")' inject_into_file( "config/environments/production.rb", - 'config.static_cache_control = "public, max-age=#{1.year.to_i}"', + ' config.static_cache_control = "public, max-age=#{1.year.to_i}"', after: serve_static_files_line ) end def setup_staging_environment @@ -128,10 +128,14 @@ def setup_secret_token template 'secrets.yml', 'config/secrets.yml', force: true end + def disallow_wrapping_parameters + remove_file "config/initializers/wrap_parameters.rb" + end + def create_partials_directory empty_directory 'app/views/application' end def create_shared_flashes @@ -147,16 +151,10 @@ template 'suspenders_layout.html.slim', 'app/views/layouts/application.html.slim', force: true end - def remove_turbolinks - replace_in_file 'app/assets/javascripts/application.js', - /\/\/= require turbolinks\n/, - '' - end - def use_postgres_config_template template 'postgresql_database.yml.erb', 'config/database.yml', force: true end @@ -226,23 +224,10 @@ def configure_action_mailer_in_specs copy_file 'action_mailer.rb', 'spec/support/action_mailer.rb' end - def configure_time_zone - config = <<-RUBY - config.active_record.default_timezone = :utc - RUBY - - inject_into_class 'config/application.rb', 'Application', config - end - - def configure_time_formats - remove_file "config/locales/en.yml" - template "config_locales_en.yml.erb", "config/locales/en.yml" - end - def configure_rack_timeout copy_file 'rack_timeout.rb', 'config/initializers/rack_timeout.rb' end def configure_slim @@ -252,12 +237,12 @@ def configure_simple_form bundle_command "exec rails generate simple_form:install" end def configure_action_mailer - action_mailer_host "development", "localhost:#{port}" - action_mailer_host "test", "www.example.com" + action_mailer_host "development", %{"localhost:#{port}"} + action_mailer_host "test", %{"www.example.com"} action_mailer_host "staging", %{ENV.fetch("HOST")} action_mailer_host "production", %{ENV.fetch("HOST")} end def configure_available_locales @@ -327,13 +312,17 @@ def init_git run 'git init' end def create_heroku_apps(flags) + rack_env = "RACK_ENV=staging RAILS_ENV=staging" + rails_serve_static_files = "RAILS_SERVE_STATIC_FILES=true" + staging_config = "#{rack_env} #{rails_serve_static_files}" run_heroku "create #{app_name}-production #{flags}", "production" run_heroku "create #{app_name}-staging #{flags}", "staging" - run_heroku "config:add RACK_ENV=staging RAILS_ENV=staging", "staging" + run_heroku "config:add #{staging_config}", "staging" + run_heroku "config:add #{rails_serve_static_files}", "production" end def set_heroku_remotes remotes = <<-SHELL @@ -371,10 +360,11 @@ def provide_deploy_script copy_file "bin_deploy", "bin/deploy" instructions = <<-MARKDOWN + ## Deploying If you have previously run the `./bin/setup` script, you can deploy to staging and production with: @@ -455,13 +445,9 @@ end def run_heroku(command, environment) path_addition = override_path_for_tests run "#{path_addition} heroku #{command} --remote #{environment}" - end - - def factories_spec_rake_task - IO.read find_in_source_paths('factories_spec_rake_task.rb') end def generate_secret SecureRandom.hex(64) end