lib/rails/generators/app_base.rb in railties-5.0.0.beta2 vs lib/rails/generators/app_base.rb in railties-5.0.0.beta3
- old
+ new
@@ -61,10 +61,13 @@
desc: 'Skip Sprockets files'
class_option :skip_spring, type: :boolean, default: false,
desc: "Don't install Spring application preloader"
+ class_option :skip_listen, type: :boolean, default: false,
+ desc: "Don't generate configuration that depends on the listen gem"
+
class_option :skip_javascript, type: :boolean, aliases: '-J', default: false,
desc: 'Skip JavaScript files'
class_option :skip_turbolinks, type: :boolean, default: false,
desc: 'Skip turbolinks gem'
@@ -306,29 +309,24 @@
comment = 'Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder'
GemfileEntry.new 'jbuilder', '~> 2.0', comment, {}, options[:api]
end
def coffee_gemfile_entry
- comment = 'Use CoffeeScript for .coffee assets and views'
- if options.dev? || options.edge?
- GemfileEntry.github 'coffee-rails', 'rails/coffee-rails', nil, comment
- else
- GemfileEntry.version 'coffee-rails', '~> 4.1.0', comment
- end
+ GemfileEntry.version 'coffee-rails', '~> 4.1.0', 'Use CoffeeScript for .coffee assets and views'
end
def javascript_gemfile_entry
- if options[:skip_javascript]
+ if options[:skip_javascript] || options[:skip_sprockets]
[]
else
gems = [coffee_gemfile_entry, javascript_runtime_gemfile_entry]
gems << GemfileEntry.version("#{options[:javascript]}-rails", nil,
"Use #{options[:javascript]} as the JavaScript library")
unless options[:skip_turbolinks]
- gems << GemfileEntry.version("turbolinks", nil,
- "Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks")
+ gems << GemfileEntry.version("turbolinks", "~> 5.x",
+ "Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks")
end
gems
end
end
@@ -350,13 +348,13 @@
GemfileEntry.new('psych', '~> 2.0', comment, platforms: :rbx)
end
def cable_gemfile_entry
return [] if options[:skip_action_cable]
- comment = 'Action Cable dependencies for the Redis adapter'
+ comment = 'Use Redis adapter to run Action Cable in production'
gems = []
- gems << GemfileEntry.new("redis", '~> 3.0', comment)
+ gems << GemfileEntry.new("redis", '~> 3.0', comment, {}, true)
gems
end
def bundle_command(command)
say_status :run, "bundle #{command}"
@@ -386,9 +384,17 @@
!(options[:skip_gemfile] || options[:skip_bundle] || options[:pretend])
end
def spring_install?
!options[:skip_spring] && !options.dev? && Process.respond_to?(:fork) && !RUBY_PLATFORM.include?("cygwin")
+ end
+
+ def depend_on_listen?
+ !options[:skip_listen] && os_supports_listen_out_of_the_box?
+ end
+
+ def os_supports_listen_out_of_the_box?
+ RbConfig::CONFIG['host_os'] =~ /darwin|linux/
end
def run_bundle
bundle_command('install') if bundle_install?
end