aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorYoshiyuki Hirano <yhirano@me.com>2017-08-13 10:37:14 +0900
committerYoshiyuki Hirano <yhirano@me.com>2017-08-13 15:19:03 +0900
commit6df78be9bb7035ec73837e9be41781e563da2ab4 (patch)
tree8e8937360f8fe92363084f7945b6dc91d93600fd /railties/lib
parente3962308e7947f3d99c70c192e2d1356d3420e1e (diff)
downloadrails-6df78be9bb7035ec73837e9be41781e563da2ab4.tar.gz
rails-6df78be9bb7035ec73837e9be41781e563da2ab4.tar.bz2
rails-6df78be9bb7035ec73837e9be41781e563da2ab4.zip
Refactor `--api` option of the app generator
It can't use JavaScript in api mode. Action cable should be disabled by default.
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/bin/setup.tt4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/bin/update.tt2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/gitignore4
5 files changed, 7 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt
index 185c0017f1..938eff8ed0 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt
+++ b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt
@@ -1,2 +1,2 @@
-class ApplicationController < ActionController::<%= options[:api] ? "API" : "Base" %>
+class ApplicationController < ActionController::<%= options.api? ? "API" : "Base" %>
end
diff --git a/railties/lib/rails/generators/rails/app/templates/bin/setup.tt b/railties/lib/rails/generators/rails/app/templates/bin/setup.tt
index a53d1fb0a9..233b5a1d95 100644
--- a/railties/lib/rails/generators/rails/app/templates/bin/setup.tt
+++ b/railties/lib/rails/generators/rails/app/templates/bin/setup.tt
@@ -15,12 +15,12 @@ chdir APP_ROOT do
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
-<% unless options[:skip_yarn] -%>
+<% unless options.skip_yarn? -%>
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
<% end -%>
-<% unless options.skip_active_record -%>
+<% unless options.skip_active_record? -%>
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
diff --git a/railties/lib/rails/generators/rails/app/templates/bin/update.tt b/railties/lib/rails/generators/rails/app/templates/bin/update.tt
index 5b6e50883e..d744bec32f 100644
--- a/railties/lib/rails/generators/rails/app/templates/bin/update.tt
+++ b/railties/lib/rails/generators/rails/app/templates/bin/update.tt
@@ -15,7 +15,7 @@ chdir APP_ROOT do
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
-<% unless options.skip_active_record -%>
+<% unless options.skip_active_record? -%>
puts "\n== Updating database =="
system! 'bin/rails db:migrate'
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb
index 9931709d7b..dde09edb94 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -29,7 +29,7 @@ module <%= app_const_base %>
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
-<%- if options[:api] -%>
+<%- if options.api? -%>
# Only loads a smaller set of middleware suitable for API only apps.
# Middleware like session, flash, cookies can be added back manually.
diff --git a/railties/lib/rails/generators/rails/app/templates/gitignore b/railties/lib/rails/generators/rails/app/templates/gitignore
index 64ed09dc4b..d8eeb1772d 100644
--- a/railties/lib/rails/generators/rails/app/templates/gitignore
+++ b/railties/lib/rails/generators/rails/app/templates/gitignore
@@ -24,13 +24,13 @@
# Ignore uploaded files in development
/storage/*
-<% unless options[:skip_yarn] -%>
+<% unless options.skip_yarn? -%>
/node_modules
/yarn-error.log
<% end -%>
-<% unless options[:api] -%>
+<% unless options.api? -%>
/public/assets
<% end -%>
.byebug_history