aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/application/configuration.rb2
-rw-r--r--railties/lib/rails/generators/app_base.rb73
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb32
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb3
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt3
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt4
-rw-r--r--railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb20
-rw-r--r--railties/lib/rails/queueing.rb8
8 files changed, 75 insertions, 70 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index 0202e86f32..7a0bb21043 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -41,7 +41,7 @@ module Rails
@exceptions_app = nil
@autoflush_log = true
@log_formatter = ActiveSupport::Logger::SimpleFormatter.new
- @queue = Rails::Queueing::Queue
+ @queue = Rails::Queueing::SynchronousQueue
@queue_consumer = Rails::Queueing::ThreadedConsumer
@eager_load = nil
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index d69afcd2cb..184c59cb90 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -16,53 +16,56 @@ module Rails
attr_accessor :rails_template
add_shebang_option!
- argument :app_path, :type => :string
+ argument :app_path, type: :string
def self.add_shared_options_for(name)
- class_option :builder, :type => :string, :aliases => "-b",
- :desc => "Path to a #{name} builder (can be a filesystem path or URL)"
+ class_option :builder, type: :string, aliases: '-b',
+ desc: "Path to a #{name} builder (can be a filesystem path or URL)"
- class_option :template, :type => :string, :aliases => "-m",
- :desc => "Path to an #{name} template (can be a filesystem path or URL)"
+ class_option :template, type: :string, aliases: '-m',
+ desc: "Path to an #{name} template (can be a filesystem path or URL)"
- class_option :skip_gemfile, :type => :boolean, :default => false,
- :desc => "Don't create a Gemfile"
+ class_option :skip_gemfile, type: :boolean, default: false,
+ desc: "Don't create a Gemfile"
- class_option :skip_bundle, :type => :boolean, :default => false,
- :desc => "Don't run bundle install"
+ class_option :skip_bundle, type: :boolean, default: false,
+ desc: "Don't run bundle install"
- class_option :skip_git, :type => :boolean, :aliases => "-G", :default => false,
- :desc => "Skip Git ignores and keeps"
+ class_option :skip_git, type: :boolean, aliases: '-G', default: false,
+ desc: 'Skip .gitignore file'
- class_option :skip_active_record, :type => :boolean, :aliases => "-O", :default => false,
- :desc => "Skip Active Record files"
+ class_option :skip_keeps, type: :boolean, default: false,
+ desc: 'Skip source control .keep files'
- class_option :skip_sprockets, :type => :boolean, :aliases => "-S", :default => false,
- :desc => "Skip Sprockets files"
+ class_option :skip_active_record, type: :boolean, aliases: '-O', default: false,
+ desc: 'Skip Active Record files'
- class_option :database, :type => :string, :aliases => "-d", :default => "sqlite3",
- :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
+ class_option :skip_sprockets, type: :boolean, aliases: '-S', default: false,
+ desc: 'Skip Sprockets files'
- class_option :javascript, :type => :string, :aliases => '-j', :default => 'jquery',
- :desc => 'Preconfigure for selected JavaScript library'
+ class_option :database, type: :string, aliases: '-d', default: 'sqlite3',
+ desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
- class_option :skip_javascript, :type => :boolean, :aliases => "-J", :default => false,
- :desc => "Skip JavaScript files"
+ class_option :javascript, type: :string, aliases: '-j', default: 'jquery',
+ desc: 'Preconfigure for selected JavaScript library'
- class_option :skip_index_html, :type => :boolean, :aliases => "-I", :default => false,
- :desc => "Skip public/index.html and app/assets/images/rails.png files"
+ class_option :skip_javascript, type: :boolean, aliases: '-J', default: false,
+ desc: 'Skip JavaScript files'
- class_option :dev, :type => :boolean, :default => false,
- :desc => "Setup the #{name} with Gemfile pointing to your Rails checkout"
+ class_option :skip_index_html, type: :boolean, aliases: '-I', default: false,
+ desc: 'Skip public/index.html and app/assets/images/rails.png files'
- class_option :edge, :type => :boolean, :default => false,
- :desc => "Setup the #{name} with Gemfile pointing to Rails repository"
+ class_option :dev, type: :boolean, default: false,
+ desc: "Setup the #{name} with Gemfile pointing to your Rails checkout"
- class_option :skip_test_unit, :type => :boolean, :aliases => "-T", :default => false,
- :desc => "Skip Test::Unit files"
+ class_option :edge, type: :boolean, default: false,
+ desc: "Setup the #{name} with Gemfile pointing to Rails repository"
- class_option :help, :type => :boolean, :aliases => "-h", :group => :rails,
- :desc => "Show this help message and quit"
+ class_option :skip_test_unit, type: :boolean, aliases: '-T', default: false,
+ desc: 'Skip Test::Unit files'
+
+ class_option :help, type: :boolean, aliases: '-h', group: :rails,
+ desc: 'Show this help message and quit'
end
def initialize(*args)
@@ -261,13 +264,13 @@ module Rails
bundle_command('install') unless options[:skip_gemfile] || options[:skip_bundle] || options[:pretend]
end
- def empty_directory_with_gitkeep(destination, config = {})
+ def empty_directory_with_keep_file(destination, config = {})
empty_directory(destination, config)
- git_keep(destination)
+ keep_file(destination)
end
- def git_keep(destination)
- create_file("#{destination}/.gitkeep") unless options[:skip_git]
+ def keep_file(destination)
+ create_file("#{destination}/.keep") unless options[:skip_keeps]
end
end
end
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index c06b0f8994..b71b16b043 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -11,7 +11,7 @@ module Rails
private
%w(template copy_file directory empty_directory inside
- empty_directory_with_gitkeep create_file chmod shebang).each do |method|
+ empty_directory_with_keep_file create_file chmod shebang).each do |method|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{method}(*args, &block)
@generator.send(:#{method}, *args, &block)
@@ -55,8 +55,8 @@ module Rails
def app
directory 'app'
- git_keep 'app/mailers'
- git_keep 'app/models'
+ keep_file 'app/mailers'
+ keep_file 'app/models'
end
def config
@@ -86,13 +86,13 @@ module Rails
end
def lib
- empty_directory "lib"
- empty_directory_with_gitkeep "lib/tasks"
- empty_directory_with_gitkeep "lib/assets"
+ empty_directory 'lib'
+ empty_directory_with_keep_file 'lib/tasks'
+ empty_directory_with_keep_file 'lib/assets'
end
def log
- empty_directory_with_gitkeep "log"
+ empty_directory_with_keep_file 'log'
end
def public_directory
@@ -100,7 +100,7 @@ module Rails
if options[:skip_index_html]
remove_file "public/index.html"
remove_file 'app/assets/images/rails.png'
- git_keep 'app/assets/images'
+ keep_file 'app/assets/images'
end
end
@@ -112,13 +112,13 @@ module Rails
end
def test
- empty_directory_with_gitkeep "test/fixtures"
- empty_directory_with_gitkeep "test/functional"
- empty_directory_with_gitkeep "test/integration"
- empty_directory_with_gitkeep "test/unit"
+ empty_directory_with_keep_file 'test/fixtures'
+ empty_directory_with_keep_file 'test/functional'
+ empty_directory_with_keep_file 'test/integration'
+ empty_directory_with_keep_file 'test/unit'
- template "test/performance/browsing_test.rb"
- template "test/test_helper.rb"
+ template 'test/performance/browsing_test.rb'
+ template 'test/test_helper.rb'
end
def tmp
@@ -132,11 +132,11 @@ module Rails
end
def vendor_javascripts
- empty_directory_with_gitkeep "vendor/assets/javascripts"
+ empty_directory_with_keep_file 'vendor/assets/javascripts'
end
def vendor_stylesheets
- empty_directory_with_gitkeep "vendor/assets/stylesheets"
+ empty_directory_with_keep_file 'vendor/assets/stylesheets'
end
end
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 1ac0248bcf..09b08d5663 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -59,8 +59,5 @@ module <%= app_const_base %>
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
<% end -%>
-
- # Enable app-wide asynchronous ActionMailer.
- # config.action_mailer.async = true
end
end
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 122e7e2b34..bcd0e7c898 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
@@ -41,7 +41,4 @@
# Debug mode disables concatenation and preprocessing of assets.
config.assets.debug = true
<%- end -%>
-
- # In development, use an in-memory queue for queueing.
- config.queue = Rails::Queueing::Queue
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 a627636089..fdf011a510 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
@@ -80,7 +80,7 @@
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
- # Default the production mode queue to an in-memory queue. You will probably
+ # 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 = Rails::Queueing::Queue
+ # config.queue = Rails::Queueing::SynchronousQueue
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 4f937ad65a..c77b3450a3 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
@@ -10,15 +10,15 @@ module Rails
def app
if mountable?
- directory "app"
- empty_directory_with_gitkeep "app/assets/images/#{name}"
+ directory 'app'
+ empty_directory_with_keep_file "app/assets/images/#{name}"
elsif full?
- empty_directory_with_gitkeep "app/models"
- empty_directory_with_gitkeep "app/controllers"
- empty_directory_with_gitkeep "app/views"
- empty_directory_with_gitkeep "app/helpers"
- empty_directory_with_gitkeep "app/mailers"
- empty_directory_with_gitkeep "app/assets/images/#{name}"
+ empty_directory_with_keep_file 'app/models'
+ empty_directory_with_keep_file 'app/controllers'
+ empty_directory_with_keep_file 'app/views'
+ empty_directory_with_keep_file 'app/helpers'
+ empty_directory_with_keep_file 'app/mailers'
+ empty_directory_with_keep_file "app/assets/images/#{name}"
end
end
@@ -110,7 +110,7 @@ task :default => :test
copy_file "#{app_templates_dir}/app/assets/stylesheets/application.css",
"app/assets/stylesheets/#{name}/application.css"
elsif full?
- empty_directory_with_gitkeep "app/assets/stylesheets/#{name}"
+ empty_directory_with_keep_file "app/assets/stylesheets/#{name}"
end
end
@@ -121,7 +121,7 @@ task :default => :test
template "#{app_templates_dir}/app/assets/javascripts/application.js.tt",
"app/assets/javascripts/#{name}/application.js"
elsif full?
- empty_directory_with_gitkeep "app/assets/javascripts/#{name}"
+ empty_directory_with_keep_file "app/assets/javascripts/#{name}"
end
end
diff --git a/railties/lib/rails/queueing.rb b/railties/lib/rails/queueing.rb
index baf6811d3e..7cd755b0f7 100644
--- a/railties/lib/rails/queueing.rb
+++ b/railties/lib/rails/queueing.rb
@@ -35,6 +35,14 @@ module Rails
class Queue < ::Queue
end
+ class SynchronousQueue < ::Queue
+ def push(job)
+ job.run
+ end
+ alias << push
+ alias enq push
+ end
+
# In test mode, the Rails queue is backed by an Array so that assertions
# can be made about its contents. The test queue provides a +jobs+
# method to make assertions about the queue's contents and a +drain+