diff options
Diffstat (limited to 'railties/lib/rails/generators/rails')
23 files changed, 65 insertions, 65 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 67e7c4d54f..18637451ac 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -96,7 +96,7 @@ module Rails end def public_directory - directory "public", "public", :recursive => false + directory "public", "public", recursive: false if options[:skip_index_html] remove_file "public/index.html" remove_file 'app/assets/images/rails.png' @@ -108,7 +108,7 @@ module Rails directory "script" do |content| "#{shebang}\n" + content end - chmod "script", 0755, :verbose => false + chmod "script", 0755, verbose: false end def test @@ -152,8 +152,8 @@ module Rails add_shared_options_for "application" # Add bin/rails options - class_option :version, :type => :boolean, :aliases => "-v", :group => :rails, - :desc => "Show Rails version number and quit" + class_option :version, type: :boolean, aliases: "-v", group: :rails, + desc: "Show Rails version number and quit" def initialize(*args) raise Error, "Options should be given after the application name. For details run: rails --help" if args[0].blank? 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 fb43c90e21..5f15c973c6 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -7,7 +7,7 @@ require 'rails/all' <%= comment_if :skip_active_record %>require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" -<%= comment_if :skip_sprockets %>require "sprockets/rails/railtie" +<%= comment_if :skip_sprockets %>require "sprockets/railtie" <%= comment_if :skip_test_unit %>require "rails/test_unit/railtie" <% end -%> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml index 07223a71c9..22c9194fad 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml @@ -2,7 +2,9 @@ # # Install the pg driver: # gem install pg -# On Mac OS X with macports: +# On OS X with Homebrew: +# gem install pg -- --with-pg-config=/usr/local/bin/pg_config +# On OS X with MacPorts: # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config # On Windows: # gem install pg diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index 6b5b3a0b1f..bd0a0d44b8 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -32,9 +32,6 @@ <%- end -%> <%- unless options.skip_sprockets? -%> - # Do not compress assets. - config.assets.compress = false - # Debug mode disables concatenation and preprocessing of assets. config.assets.debug = true <%- end -%> diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index d86207ae85..9df53bd6c9 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt @@ -24,7 +24,8 @@ <%- unless options.skip_sprockets? -%> # Compress JavaScripts and CSS. - config.assets.compress = true + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass # Whether to fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false @@ -61,7 +62,7 @@ <%- end -%> # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable threaded mode. @@ -88,5 +89,5 @@ # Default the production mode queue to an synchronous queue. You will probably # want to replace this with an out-of-process queueing solution. - # config.queue = ActiveSupport::SynchronousQueue + # config.queue = ActiveSupport::SynchronousQueue.new end diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt index 202fc98adf..a5ef0cd9cd 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt @@ -34,6 +34,6 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Use the testing queue. - config.queue = ActiveSupport::TestQueue + # Use the synchronous queue to run jobs immediately. + config.queue = ActiveSupport::SynchronousQueue.new end diff --git a/railties/lib/rails/generators/rails/assets/assets_generator.rb b/railties/lib/rails/generators/rails/assets/assets_generator.rb index e4f07bba2e..6f4b86e708 100644 --- a/railties/lib/rails/generators/rails/assets/assets_generator.rb +++ b/railties/lib/rails/generators/rails/assets/assets_generator.rb @@ -1,11 +1,11 @@ module Rails module Generators class AssetsGenerator < NamedBase # :nodoc: - class_option :javascripts, :type => :boolean, :desc => "Generate JavaScripts" - class_option :stylesheets, :type => :boolean, :desc => "Generate Stylesheets" + class_option :javascripts, type: :boolean, desc: "Generate JavaScripts" + class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets" - class_option :javascript_engine, :desc => "Engine for JavaScripts" - class_option :stylesheet_engine, :desc => "Engine for Stylesheets" + class_option :javascript_engine, desc: "Engine for JavaScripts" + class_option :stylesheet_engine, desc: "Engine for Stylesheets" protected diff --git a/railties/lib/rails/generators/rails/controller/controller_generator.rb b/railties/lib/rails/generators/rails/controller/controller_generator.rb index 1482fc28d4..bae54623c6 100644 --- a/railties/lib/rails/generators/rails/controller/controller_generator.rb +++ b/railties/lib/rails/generators/rails/controller/controller_generator.rb @@ -1,8 +1,8 @@ module Rails module Generators class ControllerGenerator < NamedBase # :nodoc: - argument :actions, :type => :array, :default => [], :banner => "action action" - check_class_collision :suffix => "Controller" + argument :actions, type: :array, default: [], banner: "action action" + check_class_collision suffix: "Controller" def create_controller_files template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb") diff --git a/railties/lib/rails/generators/rails/generator/generator_generator.rb b/railties/lib/rails/generators/rails/generator/generator_generator.rb index 8a0fdbf2fb..9a7a516b5b 100644 --- a/railties/lib/rails/generators/rails/generator/generator_generator.rb +++ b/railties/lib/rails/generators/rails/generator/generator_generator.rb @@ -1,10 +1,10 @@ module Rails module Generators class GeneratorGenerator < NamedBase # :nodoc: - check_class_collision :suffix => "Generator" + check_class_collision suffix: "Generator" - class_option :namespace, :type => :boolean, :default => true, - :desc => "Namespace generator under lib/generators/name" + class_option :namespace, type: :boolean, default: true, + desc: "Namespace generator under lib/generators/name" def create_generator_files directory '.', generator_dir diff --git a/railties/lib/rails/generators/rails/helper/helper_generator.rb b/railties/lib/rails/generators/rails/helper/helper_generator.rb index 0975ab3903..5ff38e4111 100644 --- a/railties/lib/rails/generators/rails/helper/helper_generator.rb +++ b/railties/lib/rails/generators/rails/helper/helper_generator.rb @@ -1,7 +1,7 @@ module Rails module Generators - class HelperGenerator < NamedBase # :nodoc: - check_class_collision :suffix => "Helper" + class HelperGenerator < NamedBase # :nodoc: + check_class_collision suffix: "Helper" def create_helper_files template 'helper.rb', File.join('app/helpers', class_path, "#{file_name}_helper.rb") diff --git a/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb b/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb index 9258ae1ee8..70770ddcb8 100644 --- a/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb +++ b/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb @@ -1,7 +1,7 @@ module Rails module Generators class IntegrationTestGenerator < NamedBase # :nodoc: - hook_for :integration_tool, :as => :integration + hook_for :integration_tool, as: :integration end end end diff --git a/railties/lib/rails/generators/rails/migration/migration_generator.rb b/railties/lib/rails/generators/rails/migration/migration_generator.rb index 2e1b6a27d8..965c42db36 100644 --- a/railties/lib/rails/generators/rails/migration/migration_generator.rb +++ b/railties/lib/rails/generators/rails/migration/migration_generator.rb @@ -1,8 +1,8 @@ module Rails module Generators class MigrationGenerator < NamedBase # :nodoc: - argument :attributes, :type => :array, :default => [], :banner => "field[:type][:index] field[:type][:index]" - hook_for :orm, :required => true + argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]" + hook_for :orm, required: true end end end diff --git a/railties/lib/rails/generators/rails/model/model_generator.rb b/railties/lib/rails/generators/rails/model/model_generator.rb index af1617fadf..ea3d69d7c9 100644 --- a/railties/lib/rails/generators/rails/model/model_generator.rb +++ b/railties/lib/rails/generators/rails/model/model_generator.rb @@ -1,8 +1,8 @@ module Rails module Generators class ModelGenerator < NamedBase # :nodoc: - argument :attributes, :type => :array, :default => [], :banner => "field[:type][:index] field[:type][:index]" - hook_for :orm, :required => true + argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]" + hook_for :orm, required: true end end end diff --git a/railties/lib/rails/generators/rails/observer/observer_generator.rb b/railties/lib/rails/generators/rails/observer/observer_generator.rb index a11085eb0f..7a4d701ac6 100644 --- a/railties/lib/rails/generators/rails/observer/observer_generator.rb +++ b/railties/lib/rails/generators/rails/observer/observer_generator.rb @@ -1,7 +1,7 @@ module Rails module Generators class ObserverGenerator < NamedBase # :nodoc: - hook_for :orm, :required => true + hook_for :orm, required: true end end end diff --git a/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb b/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb index 83771c3dd7..56cd562f3d 100644 --- a/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb +++ b/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb @@ -1,7 +1,7 @@ module Rails module Generators class PerformanceTestGenerator < NamedBase # :nodoc: - hook_for :performance_tool, :as => :performance + hook_for :performance_tool, as: :performance end end end diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb index 42e0246f76..4a0bcc35a4 100644 --- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb @@ -68,7 +68,7 @@ module Rails append_file "Rakefile", <<-EOF #{rakefile_test_tasks} -task :default => :test +task default: :test EOF if full? template "test/integration/navigation_test.rb" @@ -89,10 +89,10 @@ task :default => :test end def test_dummy_config - template "rails/boot.rb", "#{dummy_path}/config/boot.rb", :force => true - template "rails/application.rb", "#{dummy_path}/config/application.rb", :force => true + template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true + template "rails/application.rb", "#{dummy_path}/config/application.rb", force: true if mountable? - template "rails/routes.rb", "#{dummy_path}/config/routes.rb", :force => true + template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true end end @@ -135,10 +135,10 @@ task :default => :test def script(force = false) return unless full? - directory "script", :force => force do |content| + directory "script", force: force do |content| "#{shebang}\n" + content end - chmod "script", 0755, :verbose => false + chmod "script", 0755, verbose: false end def gemfile_entry @@ -158,20 +158,20 @@ task :default => :test alias_method :plugin_path, :app_path - class_option :dummy_path, :type => :string, :default => "test/dummy", - :desc => "Create dummy application at given path" + class_option :dummy_path, type: :string, default: "test/dummy", + desc: "Create dummy application at given path" - class_option :full, :type => :boolean, :default => false, - :desc => "Generate a rails engine with bundled Rails application for testing" + class_option :full, type: :boolean, default: false, + desc: "Generate a rails engine with bundled Rails application for testing" - class_option :mountable, :type => :boolean, :default => false, - :desc => "Generate mountable isolated application" + class_option :mountable, type: :boolean, default: false, + desc: "Generate mountable isolated application" - class_option :skip_gemspec, :type => :boolean, :default => false, - :desc => "Skip gemspec file" + class_option :skip_gemspec, type: :boolean, default: false, + desc: "Skip gemspec file" - class_option :skip_gemfile_entry, :type => :boolean, :default => false, - :desc => "If creating plugin in application's directory " + + class_option :skip_gemfile_entry, type: :boolean, default: false, + desc: "If creating plugin in application's directory " + "skip adding entry to Gemfile" def initialize(*args) diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt b/railties/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt index bd983fb90f..1d380420b4 100644 --- a/railties/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt +++ b/railties/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt @@ -2,7 +2,7 @@ <html> <head> <title><%= camelized %></title> - <%%= stylesheet_link_tag "<%= name %>/application", :media => "all" %> + <%%= stylesheet_link_tag "<%= name %>/application", media: "all" %> <%%= javascript_include_tag "<%= name %>/application" %> <%%= csrf_meta_tags %> </head> diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb b/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb index 2f9b7fc962..8a8ba04a70 100644 --- a/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +++ b/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb @@ -7,7 +7,7 @@ require 'rails/all' <%= comment_if :skip_active_record %>require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" -<%= comment_if :skip_sprockets %>require "sprockets/rails/railtie" +<%= comment_if :skip_sprockets %>require "sprockets/railtie" <%= comment_if :skip_test_unit %>require "rails/test_unit/railtie" <% end -%> diff --git a/railties/lib/rails/generators/rails/resource/resource_generator.rb b/railties/lib/rails/generators/rails/resource/resource_generator.rb index d3ba597dbd..8014feb75f 100644 --- a/railties/lib/rails/generators/rails/resource/resource_generator.rb +++ b/railties/lib/rails/generators/rails/resource/resource_generator.rb @@ -7,14 +7,14 @@ module Rails class ResourceGenerator < ModelGenerator # :nodoc: include ResourceHelpers - hook_for :resource_controller, :required => true do |controller| + hook_for :resource_controller, required: true do |controller| invoke controller, [ controller_name, options[:actions] ] end - class_option :actions, :type => :array, :banner => "ACTION ACTION", :default => [], - :desc => "Actions for the resource controller" + class_option :actions, type: :array, banner: "ACTION ACTION", default: [], + desc: "Actions for the resource controller" - hook_for :resource_route, :required => true + hook_for :resource_route, required: true end end end diff --git a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb index c33c99e989..b4f466fbd8 100644 --- a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb @@ -6,10 +6,10 @@ module Rails remove_hook_for :resource_controller remove_class_option :actions - class_option :stylesheets, :type => :boolean, :desc => "Generate Stylesheets" - class_option :stylesheet_engine, :desc => "Engine for Stylesheets" + class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets" + class_option :stylesheet_engine, desc: "Engine for Stylesheets" - hook_for :scaffold_controller, :required => true + hook_for :scaffold_controller, required: true hook_for :assets do |assets| invoke assets, [controller_name] diff --git a/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb b/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb index df069ca937..4f36b612ae 100644 --- a/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +++ b/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb @@ -5,21 +5,21 @@ module Rails class ScaffoldControllerGenerator < NamedBase # :nodoc: include ResourceHelpers - check_class_collision :suffix => "Controller" + check_class_collision suffix: "Controller" - class_option :orm, :banner => "NAME", :type => :string, :required => true, - :desc => "ORM to generate the controller for" + class_option :orm, banner: "NAME", type: :string, required: true, + desc: "ORM to generate the controller for" - argument :attributes, :type => :array, :default => [], :banner => "field:type field:type" + argument :attributes, type: :array, default: [], banner: "field:type field:type" def create_controller_files template "controller.rb", File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb") end - hook_for :template_engine, :test_framework, :as => :scaffold + hook_for :template_engine, :test_framework, as: :scaffold # Invoke the helper using the controller name (pluralized) - hook_for :helper, :as => :scaffold do |invoked| + hook_for :helper, as: :scaffold do |invoked| invoke invoked, [ controller_name ] end end diff --git a/railties/lib/rails/generators/rails/task/task_generator.rb b/railties/lib/rails/generators/rails/task/task_generator.rb index cf3d1182ea..754824ca0c 100644 --- a/railties/lib/rails/generators/rails/task/task_generator.rb +++ b/railties/lib/rails/generators/rails/task/task_generator.rb @@ -1,7 +1,7 @@ module Rails module Generators class TaskGenerator < NamedBase # :nodoc: - argument :actions, :type => :array, :default => [], :banner => "action action" + argument :actions, type: :array, default: [], banner: "action action" def create_task_files template 'task.rb', File.join('lib/tasks', "#{file_name}.rake") diff --git a/railties/lib/rails/generators/rails/task/templates/task.rb b/railties/lib/rails/generators/rails/task/templates/task.rb index b7407bd6dc..1e3ed5f158 100644 --- a/railties/lib/rails/generators/rails/task/templates/task.rb +++ b/railties/lib/rails/generators/rails/task/templates/task.rb @@ -1,7 +1,7 @@ namespace :<%= file_name %> do <% actions.each do |action| -%> desc "TODO" - task :<%= action %> => :environment do + task <%= action %>: :environment do end <% end -%> |