railties 3.0.0.beta4 → 3.0.0.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/CHANGELOG +24 -6
  2. data/README.rdoc +25 -0
  3. data/guides/assets/javascripts/code_highlighter.js +0 -0
  4. data/guides/assets/javascripts/guides.js +0 -0
  5. data/guides/assets/stylesheets/print.css +0 -0
  6. data/guides/assets/stylesheets/reset.css +0 -0
  7. data/guides/assets/stylesheets/style.css +0 -0
  8. data/guides/source/3_0_release_notes.textile +5 -3
  9. data/guides/source/action_controller_overview.textile +19 -0
  10. data/guides/source/active_record_basics.textile +27 -21
  11. data/guides/source/active_record_querying.textile +39 -37
  12. data/guides/source/{activerecord_validations_callbacks.textile → active_record_validations_callbacks.textile} +30 -29
  13. data/guides/source/active_support_core_extensions.textile +232 -107
  14. data/guides/source/api_documentation_guidelines.textile +187 -0
  15. data/guides/source/association_basics.textile +45 -1
  16. data/guides/source/configuring.textile +7 -7
  17. data/guides/source/contributing_to_rails.textile +42 -15
  18. data/guides/source/form_helpers.textile +1 -1
  19. data/guides/source/generators.textile +37 -37
  20. data/guides/source/getting_started.textile +11 -11
  21. data/guides/source/i18n.textile +1 -1
  22. data/guides/source/index.html.erb +14 -6
  23. data/guides/source/initialization.textile +130 -124
  24. data/guides/source/layout.html.erb +5 -2
  25. data/guides/source/layouts_and_rendering.textile +2 -2
  26. data/guides/source/migrations.textile +4 -3
  27. data/guides/source/plugins.textile +15 -15
  28. data/guides/source/rails_application_templates.textile +2 -2
  29. data/guides/source/routing.textile +83 -62
  30. data/guides/source/security.textile +2 -2
  31. data/guides/w3c_validator.rb +30 -6
  32. data/lib/rails.rb +3 -3
  33. data/lib/rails/application.rb +43 -19
  34. data/lib/rails/application/bootstrap.rb +2 -0
  35. data/lib/rails/application/configuration.rb +3 -3
  36. data/lib/rails/application/finisher.rb +6 -6
  37. data/lib/rails/cli.rb +1 -19
  38. data/lib/rails/commands.rb +5 -5
  39. data/lib/rails/commands/application.rb +1 -1
  40. data/lib/rails/commands/console.rb +1 -4
  41. data/lib/rails/commands/generate.rb +0 -0
  42. data/lib/rails/commands/plugin.rb +57 -52
  43. data/lib/rails/commands/runner.rb +2 -1
  44. data/lib/rails/commands/server.rb +6 -2
  45. data/lib/rails/configuration.rb +2 -3
  46. data/lib/rails/console/app.rb +0 -2
  47. data/lib/rails/engine.rb +14 -15
  48. data/lib/rails/engine/configuration.rb +5 -5
  49. data/lib/rails/generators.rb +2 -3
  50. data/lib/rails/generators/actions.rb +4 -4
  51. data/lib/rails/generators/base.rb +1 -1
  52. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +1 -6
  53. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +4 -4
  54. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +3 -3
  55. data/lib/rails/generators/erb/scaffold/templates/index.html.erb +7 -7
  56. data/lib/rails/generators/erb/scaffold/templates/new.html.erb +2 -2
  57. data/lib/rails/generators/erb/scaffold/templates/show.html.erb +3 -3
  58. data/lib/rails/generators/generated_attribute.rb +2 -1
  59. data/lib/rails/generators/named_base.rb +24 -0
  60. data/lib/rails/generators/rails/app/app_generator.rb +10 -9
  61. data/lib/rails/generators/rails/app/templates/Gemfile +4 -3
  62. data/lib/rails/generators/rails/app/templates/README +6 -31
  63. data/lib/rails/generators/rails/app/templates/Rakefile +1 -1
  64. data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb +0 -1
  65. data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
  66. data/lib/rails/generators/rails/app/templates/config/application.rb +11 -11
  67. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +36 -24
  68. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +1 -1
  69. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
  70. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +3 -0
  71. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +3 -0
  72. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +3 -0
  73. data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +1 -1
  74. data/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +2 -2
  75. data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +2 -2
  76. data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
  77. data/lib/rails/generators/rails/app/templates/public/index.html +0 -17
  78. data/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js +2027 -900
  79. data/lib/rails/generators/rails/app/templates/public/javascripts/rails.js +114 -57
  80. data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +1 -1
  81. data/lib/rails/generators/rails/model/USAGE +1 -1
  82. data/lib/rails/generators/rails/resource/resource_generator.rb +4 -14
  83. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +0 -2
  84. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +28 -30
  85. data/lib/rails/generators/resource_helpers.rb +1 -1
  86. data/lib/rails/generators/test_case.rb +25 -11
  87. data/lib/rails/generators/test_unit/model/model_generator.rb +1 -1
  88. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +0 -1
  89. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +13 -15
  90. data/lib/rails/info.rb +1 -2
  91. data/lib/rails/info_routes.rb +1 -1
  92. data/lib/rails/initializable.rb +3 -16
  93. data/lib/rails/paths.rb +31 -36
  94. data/lib/rails/plugin.rb +10 -6
  95. data/lib/rails/rack/logger.rb +11 -13
  96. data/lib/rails/railtie.rb +14 -42
  97. data/lib/rails/ruby_version_check.rb +19 -5
  98. data/lib/rails/script_rails_loader.rb +29 -0
  99. data/lib/rails/tasks/annotations.rake +2 -2
  100. data/lib/rails/tasks/documentation.rake +47 -16
  101. data/lib/rails/tasks/framework.rake +9 -9
  102. data/lib/rails/tasks/middleware.rake +1 -1
  103. data/lib/rails/tasks/misc.rake +5 -5
  104. data/lib/rails/tasks/routes.rake +1 -1
  105. data/lib/rails/tasks/tmp.rake +5 -5
  106. data/lib/rails/test_unit/testing.rake +38 -14
  107. data/lib/rails/version.rb +1 -1
  108. metadata +29 -17
  109. data/README +0 -281
  110. data/lib/rails/application/routes_reloader.rb +0 -46
  111. data/lib/rails/log_subscriber.rb +0 -115
  112. data/lib/rails/log_subscriber/test_helper.rb +0 -97
  113. data/lib/rails/webrick_server.rb +0 -156
@@ -0,0 +1,29 @@
1
+ require 'pathname'
2
+
3
+ module Rails
4
+ module ScriptRailsLoader
5
+ RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"]
6
+ SCRIPT_RAILS = File.join('script', 'rails')
7
+
8
+ def self.exec_script_rails!
9
+ cwd = Dir.pwd
10
+ return unless in_rails_application? || in_rails_application_subdirectory?
11
+ exec RUBY, SCRIPT_RAILS, *ARGV if in_rails_application?
12
+ Dir.chdir("..") do
13
+ # Recurse in a chdir block: if the search fails we want to be sure
14
+ # the application is generated in the original working directory.
15
+ exec_script_rails! unless cwd == Dir.pwd
16
+ end
17
+ rescue SystemCallError
18
+ # could not chdir, no problem just return
19
+ end
20
+
21
+ def self.in_rails_application?
22
+ File.exists?(SCRIPT_RAILS)
23
+ end
24
+
25
+ def self.in_rails_application_subdirectory?(path = Pathname.new(Dir.pwd))
26
+ File.exists?(File.join(path, SCRIPT_RAILS)) || !path.root? && in_rails_application_subdirectory?(path.parent)
27
+ end
28
+ end
29
+ end
@@ -1,13 +1,13 @@
1
1
  require 'rails/source_annotation_extractor'
2
2
 
3
- desc "Enumerate all annotations"
3
+ desc "Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)"
4
4
  task :notes do
5
5
  SourceAnnotationExtractor.enumerate "OPTIMIZE|FIXME|TODO", :tag => true
6
6
  end
7
7
 
8
8
  namespace :notes do
9
9
  ["OPTIMIZE", "FIXME", "TODO"].each do |annotation|
10
- desc "Enumerate all #{annotation} annotations"
10
+ # desc "Enumerate all #{annotation} annotations"
11
11
  task annotation.downcase.intern do
12
12
  SourceAnnotationExtractor.enumerate annotation
13
13
  end
@@ -1,13 +1,43 @@
1
1
  require 'rake/rdoctask'
2
2
 
3
+ # Monkey-patch to remove redoc'ing and clobber descriptions to cut down on rake -T noise
4
+ class RDocTaskWithoutDescriptions < Rake::RDocTask
5
+ def define
6
+ task rdoc_task_name
7
+
8
+ task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
9
+
10
+ task clobber_task_name do
11
+ rm_r rdoc_dir rescue nil
12
+ end
13
+
14
+ task :clobber => [clobber_task_name]
15
+
16
+ directory @rdoc_dir
17
+ task rdoc_task_name => [rdoc_target]
18
+ file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
19
+ rm_r @rdoc_dir rescue nil
20
+ @before_running_rdoc.call if @before_running_rdoc
21
+ args = option_list + @rdoc_files
22
+ if @external
23
+ argstring = args.join(' ')
24
+ sh %{ruby -Ivendor vendor/rd #{argstring}}
25
+ else
26
+ require 'rdoc/rdoc'
27
+ RDoc::RDoc.new.document(args)
28
+ end
29
+ end
30
+ self
31
+ end
32
+ end
33
+
3
34
  namespace :doc do
4
35
  def gem_path(gem_name)
5
36
  path = $LOAD_PATH.grep(/#{gem_name}[\w.-]*\/lib$/).first
6
37
  yield File.dirname(path) if path
7
38
  end
8
39
 
9
- desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\""
10
- Rake::RDocTask.new("app") { |rdoc|
40
+ RDocTaskWithoutDescriptions.new("app") { |rdoc|
11
41
  rdoc.rdoc_dir = 'doc/app'
12
42
  rdoc.template = ENV['template'] if ENV['template']
13
43
  rdoc.title = ENV['title'] || "Rails Application Documentation"
@@ -17,53 +47,54 @@ namespace :doc do
17
47
  rdoc.rdoc_files.include('app/**/*.rb')
18
48
  rdoc.rdoc_files.include('lib/**/*.rb')
19
49
  }
50
+ Rake::Task['doc:app'].comment = "Generate docs for the app -- also availble doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE=\"Custom Title\")"
20
51
 
21
- desc 'Generate documentation for the Rails framework.'
22
- Rake::RDocTask.new("rails") { |rdoc|
52
+ # desc 'Generate documentation for the Rails framework.'
53
+ RDocTaskWithoutDescriptions.new("rails") { |rdoc|
23
54
  rdoc.rdoc_dir = 'doc/api'
24
55
  rdoc.template = "#{ENV['template']}.rb" if ENV['template']
25
56
  rdoc.title = "Rails Framework Documentation"
26
57
  rdoc.options << '--line-numbers' << '--inline-source'
27
- rdoc.rdoc_files.include('README')
58
+ rdoc.rdoc_files.include('README.rdoc')
28
59
 
29
60
  gem_path('actionmailer') do |actionmailer|
30
- %w(README CHANGELOG MIT-LICENSE lib/action_mailer/base.rb).each do |file|
61
+ %w(README.rdoc CHANGELOG MIT-LICENSE lib/action_mailer/base.rb).each do |file|
31
62
  rdoc.rdoc_files.include("#{actionmailer}/#{file}")
32
63
  end
33
64
  end
34
65
 
35
66
  gem_path('actionpack') do |actionpack|
36
- %w(README CHANGELOG MIT-LICENSE lib/action_controller/**/*.rb lib/action_view/**/*.rb).each do |file|
67
+ %w(README.rdoc CHANGELOG MIT-LICENSE lib/action_controller/**/*.rb lib/action_view/**/*.rb).each do |file|
37
68
  rdoc.rdoc_files.include("#{actionpack}/#{file}")
38
69
  end
39
70
  end
40
71
 
41
72
  gem_path('activemodel') do |activemodel|
42
- %w(README CHANGELOG MIT-LICENSE lib/active_model/**/*.rb).each do |file|
73
+ %w(README.rdoc CHANGELOG MIT-LICENSE lib/active_model/**/*.rb).each do |file|
43
74
  rdoc.rdoc_files.include("#{activemodel}/#{file}")
44
75
  end
45
76
  end
46
77
 
47
78
  gem_path('activerecord') do |activerecord|
48
- %w(README CHANGELOG lib/active_record/**/*.rb).each do |file|
79
+ %w(README.rdoc CHANGELOG lib/active_record/**/*.rb).each do |file|
49
80
  rdoc.rdoc_files.include("#{activerecord}/#{file}")
50
81
  end
51
82
  end
52
83
 
53
84
  gem_path('activeresource') do |activeresource|
54
- %w(README CHANGELOG lib/active_resource.rb lib/active_resource/*).each do |file|
85
+ %w(README.rdoc CHANGELOG lib/active_resource.rb lib/active_resource/*).each do |file|
55
86
  rdoc.rdoc_files.include("#{activeresource}/#{file}")
56
87
  end
57
88
  end
58
89
 
59
90
  gem_path('activesupport') do |activesupport|
60
- %w(README CHANGELOG lib/active_support/**/*.rb).each do |file|
91
+ %w(README.rdoc CHANGELOG lib/active_support/**/*.rb).each do |file|
61
92
  rdoc.rdoc_files.include("#{activesupport}/#{file}")
62
93
  end
63
94
  end
64
95
 
65
96
  gem_path('railties') do |railties|
66
- %w(README CHANGELOG lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file|
97
+ %w(README.rdoc CHANGELOG lib/{*.rb,commands/*.rb,generators/*.rb}).each do |file|
67
98
  rdoc.rdoc_files.include("#{railties}/#{file}")
68
99
  end
69
100
  end
@@ -71,15 +102,15 @@ namespace :doc do
71
102
 
72
103
  plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) }
73
104
 
74
- desc "Generate documentation for all installed plugins"
105
+ # desc "Generate documentation for all installed plugins"
75
106
  task :plugins => plugins.collect { |plugin| "doc:plugins:#{plugin}" }
76
107
 
77
- desc "Remove plugin documentation"
108
+ # desc "Remove plugin documentation"
78
109
  task :clobber_plugins do
79
110
  rm_rf 'doc/plugins' rescue nil
80
111
  end
81
112
 
82
- desc "Generate Rails guides"
113
+ # desc "Generate Rails Guides"
83
114
  task :guides do
84
115
  # FIXME: Reaching outside lib directory is a bad idea
85
116
  require File.expand_path('../../../../guides/rails_guides', __FILE__)
@@ -89,7 +120,7 @@ namespace :doc do
89
120
  namespace :plugins do
90
121
  # Define doc tasks for each plugin
91
122
  plugins.each do |plugin|
92
- desc "Generate documentation for the #{plugin} plugin"
123
+ # desc "Generate documentation for the #{plugin} plugin"
93
124
  task(plugin => :environment) do
94
125
  plugin_base = "vendor/plugins/#{plugin}"
95
126
  options = []
@@ -1,22 +1,22 @@
1
1
  namespace :rails do
2
2
  namespace :freeze do
3
- desc "The rails:freeze:gems is deprecated, please use bundle install instead"
3
+ # desc "The rails:freeze:gems is deprecated, please use bundle install instead"
4
4
  task :gems do
5
5
  abort "The rails:freeze:gems is deprecated, please use bundle install instead"
6
6
  end
7
7
 
8
- desc 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install'
8
+ # desc 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install'
9
9
  task :edge do
10
10
  abort 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install'
11
11
  end
12
12
  end
13
13
 
14
- desc 'The unfreeze command has been deprecated, please use bundler commands instead'
14
+ # desc 'The unfreeze command has been deprecated, please use bundler commands instead'
15
15
  task :unfreeze do
16
16
  abort 'The unfreeze command has been deprecated, please use bundler commands instead'
17
17
  end
18
18
 
19
- desc "Update both configs, scripts and public/javascripts from Rails"
19
+ desc "Update both configs and public/javascripts from Rails (or use just update:javascripts or update:configs)"
20
20
  task :update => [ "update:configs", "update:javascripts", "update:scripts", "update:application_controller" ]
21
21
 
22
22
  desc "Applies the template supplied by LOCATION=/path/to/template"
@@ -31,7 +31,7 @@ namespace :rails do
31
31
  end
32
32
 
33
33
  namespace :templates do
34
- desc "Copy all the templates from rails to the application directory for customization. Already existing local copies will be overwritten"
34
+ # desc "Copy all the templates from rails to the application directory for customization. Already existing local copies will be overwritten"
35
35
  task :copy do
36
36
  generators_lib = File.expand_path("../../generators", __FILE__)
37
37
  project_templates = "#{Rails.root}/lib/templates"
@@ -69,23 +69,23 @@ namespace :rails do
69
69
  end
70
70
  end
71
71
 
72
- desc "Update config/boot.rb from your current rails install"
72
+ # desc "Update config/boot.rb from your current rails install"
73
73
  task :configs do
74
74
  invoke_from_app_generator :create_boot_file
75
75
  invoke_from_app_generator :create_config_files
76
76
  end
77
77
 
78
- desc "Update Prototype javascripts from your current rails install"
78
+ # desc "Update Prototype javascripts from your current rails install"
79
79
  task :javascripts do
80
80
  invoke_from_app_generator :create_prototype_files
81
81
  end
82
82
 
83
- desc "Adds new scripts to the application script/ directory"
83
+ # desc "Adds new scripts to the application script/ directory"
84
84
  task :scripts do
85
85
  invoke_from_app_generator :create_script_files
86
86
  end
87
87
 
88
- desc "Rename application.rb to application_controller.rb"
88
+ # desc "Rename application.rb to application_controller.rb"
89
89
  task :application_controller do
90
90
  old_style = Rails.root + '/app/controllers/application.rb'
91
91
  new_style = Rails.root + '/app/controllers/application_controller.rb'
@@ -3,5 +3,5 @@ task :middleware => :environment do
3
3
  Rails.configuration.middleware.each do |middleware|
4
4
  puts "use #{middleware.inspect}"
5
5
  end
6
- puts "run #{Rails::Application.instance.class.name}.routes"
6
+ puts "run #{Rails.application.class.name}.routes"
7
7
  end
@@ -7,30 +7,30 @@ task :rails_env do
7
7
  end
8
8
  end
9
9
 
10
- desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions.'
10
+ desc 'Generate a crytographically secure secret key (this is typically used to generate a secret for cookie sessions).'
11
11
  task :secret do
12
12
  require 'active_support/secure_random'
13
13
  puts ActiveSupport::SecureRandom.hex(64)
14
14
  end
15
15
 
16
- desc 'Explain the current environment'
16
+ desc 'List versions of all Rails frameworks and the environment'
17
17
  task :about do
18
18
  puts Rails::Info
19
19
  end
20
20
 
21
21
  namespace :time do
22
22
  namespace :zones do
23
- desc 'Displays names of all time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6'
23
+ desc 'Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6'
24
24
  task :all do
25
25
  build_time_zone_list(:all)
26
26
  end
27
27
 
28
- desc 'Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6'
28
+ # desc 'Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6'
29
29
  task :us do
30
30
  build_time_zone_list(:us_zones)
31
31
  end
32
32
 
33
- desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time'
33
+ # desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time'
34
34
  task :local do
35
35
  require 'active_support'
36
36
  require 'active_support/time'
@@ -1,6 +1,6 @@
1
1
  desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
2
2
  task :routes => :environment do
3
- Rails::Application.reload_routes!
3
+ Rails.application.reload_routes!
4
4
  all_routes = ENV['CONTROLLER'] ? Rails.application.routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : Rails.application.routes.routes
5
5
  routes = all_routes.collect do |route|
6
6
  # TODO: The :index method is deprecated in 1.9 in favor of :key
@@ -1,5 +1,5 @@
1
1
  namespace :tmp do
2
- desc "Clear session, cache, and socket files from tmp/"
2
+ desc "Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)"
3
3
  task :clear => [ "tmp:sessions:clear", "tmp:cache:clear", "tmp:sockets:clear"]
4
4
 
5
5
  desc "Creates tmp directories for sessions, cache, sockets, and pids"
@@ -8,28 +8,28 @@ namespace :tmp do
8
8
  end
9
9
 
10
10
  namespace :sessions do
11
- desc "Clears all files in tmp/sessions"
11
+ # desc "Clears all files in tmp/sessions"
12
12
  task :clear do
13
13
  FileUtils.rm(Dir['tmp/sessions/[^.]*'])
14
14
  end
15
15
  end
16
16
 
17
17
  namespace :cache do
18
- desc "Clears all files and directories in tmp/cache"
18
+ # desc "Clears all files and directories in tmp/cache"
19
19
  task :clear do
20
20
  FileUtils.rm_rf(Dir['tmp/cache/[^.]*'])
21
21
  end
22
22
  end
23
23
 
24
24
  namespace :sockets do
25
- desc "Clears all files in tmp/sockets"
25
+ # desc "Clears all files in tmp/sockets"
26
26
  task :clear do
27
27
  FileUtils.rm(Dir['tmp/sockets/[^.]*'])
28
28
  end
29
29
  end
30
30
 
31
31
  namespace :pids do
32
- desc "Clears all files in tmp/pids"
32
+ # desc "Clears all files in tmp/pids"
33
33
  task :clear do
34
34
  FileUtils.rm(Dir['tmp/pids/[^.]*'])
35
35
  end
@@ -1,5 +1,35 @@
1
1
  require 'rake/testtask'
2
2
 
3
+ # Monkey-patch to silence the description from Rake::TestTask to cut down on rake -T noise
4
+ class TestTaskWithoutDescription < Rake::TestTask
5
+ # Create the tasks defined by this task lib.
6
+ def define
7
+ lib_path = @libs.join(File::PATH_SEPARATOR)
8
+ task @name do
9
+ run_code = ''
10
+ RakeFileUtils.verbose(@verbose) do
11
+ run_code =
12
+ case @loader
13
+ when :direct
14
+ "-e 'ARGV.each{|f| load f}'"
15
+ when :testrb
16
+ "-S testrb #{fix}"
17
+ when :rake
18
+ rake_loader
19
+ end
20
+ @ruby_opts.unshift( "-I\"#{lib_path}\"" )
21
+ @ruby_opts.unshift( "-w" ) if @warning
22
+ ruby @ruby_opts.join(" ") +
23
+ " \"#{run_code}\" " +
24
+ file_list.collect { |fn| "\"#{fn}\"" }.join(' ') +
25
+ " #{option_list}"
26
+ end
27
+ end
28
+ self
29
+ end
30
+ end
31
+
32
+
3
33
  TEST_CHANGES_SINCE = Time.now - 600
4
34
 
5
35
  # Look up tests for recently modified sources.
@@ -28,7 +58,7 @@ def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
28
58
  end
29
59
 
30
60
 
31
- # Recreated here from ActiveSupport because :uncommitted needs it before Rails is available
61
+ # Recreated here from Active Support because :uncommitted needs it before Rails is available
32
62
  module Kernel
33
63
  def silence_stderr
34
64
  old_stderr = STDERR.dup
@@ -40,7 +70,7 @@ module Kernel
40
70
  end
41
71
  end
42
72
 
43
- desc 'Run all unit, functional and integration tests'
73
+ desc 'Runs test:unit, test:functional, test:integration together (also available: test:benchmark, test:profile, test:plugins)'
44
74
  task :test do
45
75
  errors = %w(test:units test:functionals test:integration).collect do |task|
46
76
  begin
@@ -92,38 +122,33 @@ namespace :test do
92
122
  end
93
123
  Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion and Git)"
94
124
 
95
- Rake::TestTask.new(:units => "test:prepare") do |t|
125
+ TestTaskWithoutDescription.new(:units => "test:prepare") do |t|
96
126
  t.libs << "test"
97
127
  t.pattern = 'test/unit/**/*_test.rb'
98
128
  end
99
- Rake::Task['test:units'].comment = "Run the unit tests in test/unit"
100
129
 
101
- Rake::TestTask.new(:functionals => "test:prepare") do |t|
130
+ TestTaskWithoutDescription.new(:functionals => "test:prepare") do |t|
102
131
  t.libs << "test"
103
132
  t.pattern = 'test/functional/**/*_test.rb'
104
133
  end
105
- Rake::Task['test:functionals'].comment = "Run the functional tests in test/functional"
106
134
 
107
- Rake::TestTask.new(:integration => "test:prepare") do |t|
135
+ TestTaskWithoutDescription.new(:integration => "test:prepare") do |t|
108
136
  t.libs << "test"
109
137
  t.pattern = 'test/integration/**/*_test.rb'
110
138
  end
111
- Rake::Task['test:integration'].comment = "Run the integration tests in test/integration"
112
139
 
113
- Rake::TestTask.new(:benchmark => 'test:prepare') do |t|
140
+ TestTaskWithoutDescription.new(:benchmark => 'test:prepare') do |t|
114
141
  t.libs << 'test'
115
142
  t.pattern = 'test/performance/**/*_test.rb'
116
143
  t.options = '-- --benchmark'
117
144
  end
118
- Rake::Task['test:benchmark'].comment = 'Benchmark the performance tests'
119
145
 
120
- Rake::TestTask.new(:profile => 'test:prepare') do |t|
146
+ TestTaskWithoutDescription.new(:profile => 'test:prepare') do |t|
121
147
  t.libs << 'test'
122
148
  t.pattern = 'test/performance/**/*_test.rb'
123
149
  end
124
- Rake::Task['test:profile'].comment = 'Profile the performance tests'
125
150
 
126
- Rake::TestTask.new(:plugins => :environment) do |t|
151
+ TestTaskWithoutDescription.new(:plugins => :environment) do |t|
127
152
  t.libs << "test"
128
153
 
129
154
  if ENV['PLUGIN']
@@ -132,5 +157,4 @@ namespace :test do
132
157
  t.pattern = 'vendor/plugins/*/**/test/**/*_test.rb'
133
158
  end
134
159
  end
135
- Rake::Task['test:plugins'].comment = "Run the plugin tests in vendor/plugins/*/**/test (or specify with PLUGIN=name)"
136
160
  end
@@ -3,7 +3,7 @@ module Rails
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
5
  TINY = 0
6
- BUILD = "beta4"
6
+ BUILD = "rc"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
9
9
  end