From 4163ccec2343ee66e2488f067eab2a15260e1219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 22 Apr 2010 12:00:13 +0200 Subject: Clean up the config object in ActionPack. Create config_accessor which just delegates to the config object, reducing the number of deprecations and add specific tests. --- railties/lib/rails/application/configuration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 11bf6a6e72..874b3a78b6 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -128,13 +128,13 @@ module Rails end end - protected - def session_options return @session_options unless @session_store == :cookie_store @session_options.merge(:secret => @secret_token) end + protected + def default_middleware_stack ActionDispatch::MiddlewareStack.new.tap do |middleware| middleware.use('::ActionDispatch::Static', lambda { paths.public.to_a.first }, :if => lambda { serve_static_assets }) -- cgit v1.2.3 From 72a3e4b77b0e6e249a534d41ae48acdedd2098cc Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 24 Apr 2010 14:57:49 -0700 Subject: Rename fieldWithErrors style to field_with_errors. Remove unused alert style. --- .../lib/rails/generators/erb/scaffold/templates/show.html.erb | 2 +- .../lib/rails/generators/rails/stylesheets/templates/scaffold.css | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb index 4dd2e6bf8c..6b3518717a 100644 --- a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb @@ -1,4 +1,4 @@ -

<%%= notice %>

+

<%%= notice %>

<% for attribute in attributes -%>

diff --git a/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css b/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css index 9f2056a702..1ae7000299 100644 --- a/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css +++ b/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css @@ -20,15 +20,11 @@ div.field, div.actions { margin-bottom: 10px; } -.notice { +#notice { color: green; } -.alert { - color: red; -} - -.fieldWithErrors { +.field_with_errors { padding: 2px; background-color: red; display: table; -- cgit v1.2.3 From 5c9d23f870bc59a42a2c5994f4e6b11d3e4e5bdc Mon Sep 17 00:00:00 2001 From: Matthew Rudy Jacobs Date: Sat, 24 Apr 2010 19:15:14 -0300 Subject: Make assert_recognizes work in IntegrationTest [#4390 state:committed] Signed-off-by: Santiago Pastorino Signed-off-by: Jeremy Kemper --- railties/lib/rails/test_help.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 3ce4e2c780..ec5e4a357c 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -35,7 +35,9 @@ class ActionController::TestCase end class ActionDispatch::IntegrationTest - include Rails.application.routes.url_helpers + setup do + @routes = Rails.application.routes + end end begin -- cgit v1.2.3 From e461e1bc0ec0a5c365840031309b83143e12955a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 26 Apr 2010 09:36:13 +0200 Subject: Ensure application rake tasks and generators are loaded after the ones specified in railties/engines/rails. [#4471 state:resolved] --- railties/lib/rails/application.rb | 4 ++-- railties/lib/rails/tasks/documentation.rake | 2 ++ railties/lib/rails/test_unit/testing.rake | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 38a5aa8ca3..7cec14c738 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -112,15 +112,15 @@ module Rails def load_tasks initialize_tasks - super railties.all { |r| r.load_tasks } + super self end def load_generators initialize_generators - super railties.all { |r| r.load_generators } + super self end diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index 957c375f6a..19d1fd2354 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -1,3 +1,5 @@ +require 'rake/rdoctask' + namespace :doc do def gem_path(gem_name) path = $LOAD_PATH.grep(/#{gem_name}[\w.-]*\/lib$/).first diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index 83f25506cb..f69a1169d9 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -1,3 +1,5 @@ +require 'rake/testtask' + TEST_CHANGES_SINCE = Time.now - 600 # Look up tests for recently modified sources. -- cgit v1.2.3 From 9b5a1f7ac19cdb7e4b661dd1603ceeede0d75d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 26 Apr 2010 09:37:15 +0200 Subject: No need to require test and rdoc tasks. --- railties/lib/rails/generators/rails/app/templates/Rakefile | 3 --- 1 file changed, 3 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/generators/rails/app/templates/Rakefile b/railties/lib/rails/generators/rails/app/templates/Rakefile index 9cb2046439..13f1f9fa41 100755 --- a/railties/lib/rails/generators/rails/app/templates/Rakefile +++ b/railties/lib/rails/generators/rails/app/templates/Rakefile @@ -2,9 +2,6 @@ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) - require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' Rails::Application.load_tasks -- cgit v1.2.3 From e813ad2a42549e308a69fd9473f1b9ed531a0d7e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 25 Apr 2010 17:26:36 +1000 Subject: Make db console work for all versions of ruby on Windows. [#3999 state:committed] Signed-off-by: Jeremy Kemper --- railties/lib/rails/commands/dbconsole.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb index 68982b9f52..8957f11724 100644 --- a/railties/lib/rails/commands/dbconsole.rb +++ b/railties/lib/rails/commands/dbconsole.rb @@ -1,6 +1,7 @@ require 'erb' require 'yaml' require 'optparse' +require 'rbconfig' module Rails class DBConsole @@ -41,7 +42,7 @@ module Rails def find_cmd(*commands) dirs_on_path = ENV['PATH'].to_s.split(File::PATH_SEPARATOR) - commands += commands.map{|cmd| "#{cmd}.exe"} if RUBY_PLATFORM =~ /win32/ + commands += commands.map{|cmd| "#{cmd}.exe"} if Config::CONFIG['host_os'] =~ /mswin|mingw/ full_path_command = nil found = commands.detect do |cmd| -- cgit v1.2.3 From 53c13f1acaa2eb05e7f418b53f6156a4f5a773e0 Mon Sep 17 00:00:00 2001 From: Anil Wadghule Date: Mon, 26 Apr 2010 20:55:07 +0530 Subject: Use Config::CONFIG['host_os'] instead of RUBY_PLATFORM [#4477 state:resolved] Signed-off-by: Jeremy Kemper --- railties/lib/rails/commands/runner.rb | 3 ++- railties/lib/rails/engine.rb | 3 ++- railties/lib/rails/generators/actions.rb | 5 +++-- railties/lib/rails/generators/rails/app/app_generator.rb | 3 ++- railties/lib/rails/test_unit/testing.rake | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb index 5634ee0f69..1dd11e1241 100644 --- a/railties/lib/rails/commands/runner.rb +++ b/railties/lib/rails/commands/runner.rb @@ -1,4 +1,5 @@ require 'optparse' +require 'rbconfig' options = { :environment => (ENV['RAILS_ENV'] || "development").dup } code_or_file = nil @@ -18,7 +19,7 @@ ARGV.clone.options do |opts| opts.on("-h", "--help", "Show this help message.") { $stderr.puts opts; exit } - if RUBY_PLATFORM !~ /mswin|mingw/ + if Config::CONFIG['host_os'] !~ /mswin|mingw/ opts.separator "" opts.separator "You can also use runner as a shebang line for your scripts like this:" opts.separator "-------------------------------------------------------------" diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 98da7e2b4a..36fcc896ae 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -1,6 +1,7 @@ require 'rails/railtie' require 'active_support/core_ext/module/delegation' require 'pathname' +require 'rbconfig' module Rails # Rails::Engine allows you to wrap a specific Rails application and share it accross @@ -119,7 +120,7 @@ module Rails root = File.exist?("#{root_path}/#{flag}") ? root_path : default raise "Could not find root path for #{self}" unless root - RUBY_PLATFORM =~ /mswin|mingw/ ? + Config::CONFIG['host_os'] =~ /mswin|mingw/ ? Pathname.new(root).expand_path : Pathname.new(root).realpath end end diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index 7dec4d446a..a31932906d 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -1,5 +1,6 @@ require 'open-uri' require 'active_support/deprecation' +require 'rbconfig' module Rails module Generators @@ -240,7 +241,7 @@ module Rails def rake(command, options={}) log :rake, command env = options[:env] || 'development' - sudo = options[:sudo] && RUBY_PLATFORM !~ /mswin|mingw/ ? 'sudo ' : '' + sudo = options[:sudo] && Config::CONFIG['host_os'] !~ /mswin|mingw/ ? 'sudo ' : '' in_root { run("#{sudo}#{extify(:rake)} #{command} RAILS_ENV=#{env}", :verbose => false) } end @@ -307,7 +308,7 @@ module Rails # Add an extension to the given name based on the platform. # def extify(name) - if RUBY_PLATFORM =~ /mswin|mingw/ + if Config::CONFIG['host_os'] =~ /mswin|mingw/ "#{name}.bat" else name diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 6818fafbe9..aa066fe3c4 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -1,6 +1,7 @@ require 'digest/md5' require 'active_support/secure_random' require 'rails/version' unless defined?(Rails::VERSION) +require 'rbconfig' module Rails::Generators # We need to store the RAILS_DEV_PATH in a constant, otherwise the path @@ -265,7 +266,7 @@ module Rails::Generators "/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4 "/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5 "/opt/lampp/var/mysql/mysql.sock" # xampp for linux - ].find { |f| File.exist?(f) } unless RUBY_PLATFORM =~ /mswin|mingw/ + ].find { |f| File.exist?(f) } unless Config::CONFIG['host_os'] =~ /mswin|mingw/ end def empty_directory_with_gitkeep(destination, config = {}) diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index f69a1169d9..79fa667ed1 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -32,7 +32,7 @@ end module Kernel def silence_stderr old_stderr = STDERR.dup - STDERR.reopen(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null') + STDERR.reopen(Config::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null') STDERR.sync = true yield ensure -- cgit v1.2.3