lib/suspenders/app_builder.rb in welaika-suspenders-2.25.0 vs lib/suspenders/app_builder.rb in welaika-suspenders-2.26.0
- old
+ new
@@ -10,13 +10,13 @@
:create_heroku_pipeline,
:create_production_heroku_app,
:create_staging_heroku_app,
:create_review_apps_setup_script,
:set_heroku_rails_secrets,
+ :set_heroku_backup_schedule,
:set_heroku_remotes,
- :set_heroku_application_host,
- :set_heroku_serve_static_files
+ :set_heroku_application_host
def readme
template 'README.md.erb', 'README.md'
end
@@ -42,11 +42,19 @@
def raise_on_delivery_errors
replace_in_file 'config/environments/development.rb',
'raise_delivery_errors = false', 'raise_delivery_errors = true'
end
- def configure_letter_opener
+ def remove_turbolinks
+ replace_in_file(
+ "app/assets/javascripts/application.js",
+ "//= require turbolinks",
+ ""
+ )
+ end
+
+ def set_test_delivery_method
inject_into_file(
"config/environments/development.rb",
"\n config.action_mailer.delivery_method = :letter_opener",
after: "config.action_mailer.raise_delivery_errors = true",
)
@@ -77,11 +85,11 @@
inject_into_class "config/application.rb", "Application", config
end
def configure_quiet_assets
config = <<-RUBY
- config.quiet_assets = true
+ config.assets.quiet = true
RUBY
inject_into_class "config/application.rb", "Application", config
end
@@ -96,12 +104,13 @@
def configure_generators
config = <<-RUBY
config.generators do |generate|
+ generate.controller_specs false
generate.helper false
- generate.javascript_engine false
+ generate.javascripts false
generate.request_specs false
generate.routing_specs false
generate.stylesheets false
generate.test_framework :rspec
generate.view_specs false
@@ -169,14 +178,17 @@
replace_in_file 'config/initializers/assets.rb',
"config.assets.version = '1.0'",
'config.assets.version = (ENV["ASSETS_VERSION"] || "1.0")'
- configure_environment(
- "production",
- 'config.static_cache_control = "public, max-age=31557600"',
- )
+ config = <<-EOD
+config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=31557600",
+ }
+ EOD
+
+ configure_environment("production", config)
end
def setup_secret_token
template 'secrets.yml', 'config/secrets.yml', force: true
end
@@ -233,14 +245,10 @@
def set_ruby_to_version_being_used
create_file '.ruby-version', "#{Suspenders::RUBY_VERSION}\n"
end
- def create_ruby_gemset_file
- create_file '.ruby-gemset', "#{app_name}\n"
- end
-
def enable_database_cleaner
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
end
def provide_shoulda_matchers_config
@@ -260,10 +268,14 @@
remove_file "spec/spec_helper.rb"
copy_file "rails_helper.rb", "spec/rails_helper.rb"
copy_file "spec_helper.rb", "spec/spec_helper.rb"
end
+ def configure_ci
+ template "circle.yml.erb", "circle.yml"
+ end
+
def configure_i18n_for_test_environment
copy_file "i18n.rb", "spec/support/i18n.rb"
end
def configure_i18n_for_missing_translations
@@ -281,27 +293,21 @@
def configure_capybara_webkit
copy_file "capybara_webkit.rb", "spec/support/capybara_webkit.rb"
end
- def configure_locales
+ def configure_locales_and_time_zone
remove_file "config/locales/en.yml"
template "config_locales_it.yml.erb", "config/locales/it.yml"
- replace_in_file "config/application.rb",
- "# config.i18n.default_locale = :de",
- "config.i18n.default_locale = :it"
-
- replace_in_file "config/application.rb",
- "# config.time_zone = 'Central Time (US & Canada)'",
- "config.time_zone = 'Rome'"
-
- available_locales_config = <<-RUBY
+ config = <<-RUBY
config.i18n.available_locales = [:en, :it]
+ config.i18n.default_locale = :it
+ config.time_zone = 'Rome'
RUBY
- inject_into_class 'config/application.rb', 'Application', available_locales_config
+ inject_into_class 'config/application.rb', 'Application', config
end
def configure_rack_timeout
rack_timeout_config = <<-RUBY
Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
@@ -333,33 +339,33 @@
def generate_rspec
generate 'rspec:install'
end
- def configure_puma
- copy_file "puma.rb", "config/puma.rb"
+ def replace_default_puma_configuration
+ copy_file "puma.rb", "config/puma.rb", force: true
end
def set_up_forego
copy_file "Procfile", "Procfile"
end
def setup_default_directories
[
- 'app/forms',
'app/decorators',
+ 'app/forms',
'app/queries',
'app/services',
'app/views/pages',
- 'spec/controllers',
+ 'spec/decorators',
+ 'spec/fixtures',
'spec/forms',
'spec/helpers',
'spec/lib',
- 'spec/decorators',
'spec/queries',
+ 'spec/requests',
'spec/services',
- 'spec/fixtures',
'spec/support/matchers',
'spec/support/mixins',
'spec/support/shared_examples'
].each do |dir|
empty_directory_with_keep_file dir
@@ -387,35 +393,31 @@
## Deploying
If you have previously run the `./bin/setup` script,
you can deploy to staging and production with:
- $ ./bin/deploy staging
- $ ./bin/deploy production
+ % ./bin/deploy staging
+ % ./bin/deploy production
MARKDOWN
append_file "README.md", instructions
run "chmod a+x bin/deploy"
end
- def create_github_repo(repo_name)
- run "hub create #{repo_name}"
- end
-
- def setup_bundler_audit
- copy_file "bundler_audit.rake", "lib/tasks/bundler_audit.rake"
- end
-
def setup_brakeman
copy_file "brakeman.rake", "lib/tasks/brakeman.rake"
end
def setup_rubocop
copy_file "rubocop.rake", "lib/tasks/rubocop.rake"
copy_file "rubocop.yml", ".rubocop.yml"
end
+ def setup_bundler_audit
+ copy_file "bundler_audit.rake", "lib/tasks/bundler_audit.rake"
+ end
+
def setup_spring
bundle_command "exec spring binstub --all"
end
def create_binstubs
@@ -483,10 +485,10 @@
end
task default: :rubocop
task default: :spec
task default: "brakeman:check"
-task default: "bundler:audit"
+task default: "bundle:audit"
EOS
end
end
private