railties 3.0.0.rc → 3.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/CHANGELOG +80 -75
  2. data/README.rdoc +1 -1
  3. data/guides/assets/stylesheets/main.css +14 -14
  4. data/guides/rails_guides.rb +20 -1
  5. data/guides/rails_guides/generator.rb +7 -7
  6. data/guides/source/2_3_release_notes.textile +5 -5
  7. data/guides/source/3_0_release_notes.textile +4 -3
  8. data/guides/source/action_controller_overview.textile +32 -17
  9. data/guides/source/action_view_overview.textile +44 -44
  10. data/guides/source/active_record_basics.textile +2 -2
  11. data/guides/source/active_record_querying.textile +7 -7
  12. data/guides/source/active_record_validations_callbacks.textile +20 -20
  13. data/guides/source/active_support_core_extensions.textile +370 -198
  14. data/guides/source/ajax_on_rails.textile +17 -17
  15. data/guides/source/api_documentation_guidelines.textile +3 -3
  16. data/guides/source/association_basics.textile +2 -2
  17. data/guides/source/caching_with_rails.textile +5 -5
  18. data/guides/source/command_line.textile +8 -8
  19. data/guides/source/configuring.textile +6 -6
  20. data/guides/source/contributing_to_rails.textile +14 -11
  21. data/guides/source/debugging_rails_applications.textile +8 -6
  22. data/guides/source/form_helpers.textile +1 -1
  23. data/guides/source/generators.textile +34 -30
  24. data/guides/source/getting_started.textile +13 -13
  25. data/guides/source/i18n.textile +12 -1
  26. data/guides/source/index.html.erb +4 -0
  27. data/guides/source/initialization.textile +67 -72
  28. data/guides/source/layout.html.erb +1 -0
  29. data/guides/source/layouts_and_rendering.textile +9 -9
  30. data/guides/source/nested_model_forms.textile +7 -7
  31. data/guides/source/plugins.textile +1 -1
  32. data/guides/source/rails_application_templates.textile +2 -2
  33. data/guides/source/routing.textile +27 -5
  34. data/guides/source/security.textile +6 -6
  35. data/guides/w3c_validator.rb +9 -9
  36. data/lib/rails/application.rb +1 -0
  37. data/lib/rails/application/configuration.rb +1 -1
  38. data/lib/rails/code_statistics.rb +4 -4
  39. data/lib/rails/commands.rb +1 -1
  40. data/lib/rails/commands/dbconsole.rb +1 -1
  41. data/lib/rails/commands/plugin.rb +1 -1
  42. data/lib/rails/commands/runner.rb +1 -1
  43. data/lib/rails/deprecation.rb +31 -52
  44. data/lib/rails/engine.rb +1 -1
  45. data/lib/rails/engine/configuration.rb +28 -1
  46. data/lib/rails/generators.rb +2 -2
  47. data/lib/rails/generators/actions.rb +3 -3
  48. data/lib/rails/generators/active_model.rb +3 -3
  49. data/lib/rails/generators/base.rb +1 -1
  50. data/lib/rails/generators/rails/app/app_generator.rb +9 -3
  51. data/lib/rails/generators/rails/app/templates/Gemfile +2 -2
  52. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +4 -13
  53. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
  54. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +4 -0
  55. data/lib/rails/generators/rails/app/templates/config/routes.rb +4 -4
  56. data/lib/rails/generators/rails/app/templates/public/index.html +0 -23
  57. data/lib/rails/generators/rails/app/templates/public/javascripts/effects.js +1 -1
  58. data/lib/rails/generators/rails/generator/USAGE +3 -2
  59. data/lib/rails/generators/rails/migration/USAGE +4 -4
  60. data/lib/rails/generators/rails/plugin/USAGE +1 -1
  61. data/lib/rails/generators/rails/resource/resource_generator.rb +2 -2
  62. data/lib/rails/generators/test_case.rb +1 -1
  63. data/lib/rails/info_controller.rb +1 -1
  64. data/lib/rails/plugin.rb +1 -1
  65. data/lib/rails/rack/log_tailer.rb +2 -5
  66. data/lib/rails/railtie.rb +22 -22
  67. data/lib/rails/script_rails_loader.rb +2 -2
  68. data/lib/rails/tasks/documentation.rake +5 -5
  69. data/lib/rails/tasks/framework.rake +1 -1
  70. data/lib/rails/tasks/routes.rake +23 -9
  71. data/lib/rails/test_unit/testing.rake +3 -2
  72. data/lib/rails/version.rb +1 -1
  73. metadata +10 -10
@@ -16,9 +16,9 @@ module Rails
16
16
 
17
17
  def add_resource_route
18
18
  return if options[:actions].present?
19
- route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
19
+ route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
20
20
  route_config << "resources :#{file_name.pluralize}"
21
- route_config << " end" * class_path.size
21
+ route_config << " end" * class_path.size
22
22
  route route_config
23
23
  end
24
24
  end
@@ -68,7 +68,7 @@ module Rails
68
68
  # Captures the given stream and returns it:
69
69
  #
70
70
  # stream = capture(:stdout){ puts "Cool" }
71
- # stream #=> "Cool\n"
71
+ # stream # => "Cool\n"
72
72
  #
73
73
  def capture(stream)
74
74
  begin
@@ -1,6 +1,6 @@
1
1
  class Rails::InfoController < ActionController::Base
2
2
  def properties
3
- if consider_all_requests_local? || local_request?
3
+ if consider_all_requests_local? || request.local?
4
4
  render :inline => Rails::Info.to_html
5
5
  else
6
6
  render :text => '<p>For security purposes, this information is only available to local requests.</p>', :status => :forbidden
data/lib/rails/plugin.rb CHANGED
@@ -16,7 +16,7 @@ module Rails
16
16
  # Besides this conceptual difference, the only difference between Rails::Engine and
17
17
  # Rails::Plugin is that plugins automatically load the file "init.rb" at the plugin
18
18
  # root during the boot process.
19
- #
19
+ #
20
20
  class Plugin < Engine
21
21
  def self.inherited(base)
22
22
  raise "You cannot inherit from Rails::Plugin"
@@ -6,7 +6,6 @@ module Rails
6
6
 
7
7
  path = Pathname.new(log || "#{File.expand_path(Rails.root)}/log/#{Rails.env}.log").cleanpath
8
8
  @cursor = ::File.size(path)
9
- @last_checked = Time.now.to_f
10
9
 
11
10
  @file = ::File.open(path, 'r')
12
11
  end
@@ -20,11 +19,9 @@ module Rails
20
19
  def tail!
21
20
  @file.seek @cursor
22
21
 
23
- mod = @file.mtime.to_f
24
- if mod > @last_checked
22
+ if !@file.eof?
25
23
  contents = @file.read
26
- @last_checked = mod
27
- @cursor += contents.size
24
+ @cursor = @file.tell
28
25
  $stdout.print contents
29
26
  end
30
27
  end
data/lib/rails/railtie.rb CHANGED
@@ -6,53 +6,53 @@ require 'active_support/deprecation'
6
6
  module Rails
7
7
  # Railtie is the core of the Rails Framework and provides several hooks to extend
8
8
  # Rails and/or modify the initialization process.
9
- #
9
+ #
10
10
  # Every major component of Rails (Action Mailer, Action Controller,
11
11
  # Action View, Active Record and Active Resource) are all Railties, so each of
12
12
  # them is responsible to set their own initialization. This makes, for example,
13
13
  # Rails absent of any Active Record hook, allowing any other ORM framework to hook in.
14
- #
14
+ #
15
15
  # Developing a Rails extension does _not_ require any implementation of
16
16
  # Railtie, but if you need to interact with the Rails framework during
17
17
  # or after boot, then Railtie is what you need to do that interaction.
18
- #
18
+ #
19
19
  # For example, the following would need you to implement Railtie in your
20
20
  # plugin:
21
- #
21
+ #
22
22
  # * creating initializers
23
23
  # * configuring a Rails framework or the Application, like setting a generator
24
24
  # * adding Rails config.* keys to the environment
25
25
  # * setting up a subscriber to the Rails +ActiveSupport::Notifications+
26
26
  # * adding rake tasks into rails
27
- #
27
+ #
28
28
  # == Creating your Railtie
29
29
  #
30
30
  # Implementing Railtie in your Rails extension is done by creating a class
31
31
  # Railtie that has your extension name and making sure that this gets loaded
32
32
  # during boot time of the Rails stack.
33
- #
33
+ #
34
34
  # You can do this however you wish, but here is an example if you want to provide
35
35
  # it for a gem that can be used with or without Rails:
36
- #
36
+ #
37
37
  # * Create a file (say, lib/my_gem/railtie.rb) which contains class Railtie inheriting from
38
38
  # Rails::Railtie and is namespaced to your gem:
39
39
  #
40
- # # lib/my_gem/railtie.rb
41
- # module MyGem
42
- # class Railtie < Rails::Railtie
40
+ # # lib/my_gem/railtie.rb
41
+ # module MyGem
42
+ # class Railtie < Rails::Railtie
43
+ # end
43
44
  # end
44
- # end
45
- #
45
+ #
46
46
  # * Require your own gem as well as rails in this file:
47
- #
48
- # # lib/my_gem/railtie.rb
49
- # require 'my_gem'
50
- # require 'rails'
51
- #
52
- # module MyGem
53
- # class Railtie < Rails::Railtie
47
+ #
48
+ # # lib/my_gem/railtie.rb
49
+ # require 'my_gem'
50
+ # require 'rails'
51
+ #
52
+ # module MyGem
53
+ # class Railtie < Rails::Railtie
54
+ # end
54
55
  # end
55
- # end
56
56
  #
57
57
  # == Initializers
58
58
  #
@@ -65,7 +65,7 @@ module Rails
65
65
  # end
66
66
  # end
67
67
  #
68
- # If specified, the block can also receive the application object, in case you
68
+ # If specified, the block can also receive the application object, in case you
69
69
  # need to access some application specific configuration, like middleware:
70
70
  #
71
71
  # class MyRailtie < Rails::Railtie
@@ -121,7 +121,7 @@ module Rails
121
121
  # described here can be used in all three.
122
122
  #
123
123
  # Be sure to look at the documentation of those specific classes for more information.
124
- #
124
+ #
125
125
  class Railtie
126
126
  autoload :Configurable, "rails/railtie/configurable"
127
127
  autoload :Configuration, "rails/railtie/configuration"
@@ -17,11 +17,11 @@ module Rails
17
17
  rescue SystemCallError
18
18
  # could not chdir, no problem just return
19
19
  end
20
-
20
+
21
21
  def self.in_rails_application?
22
22
  File.exists?(SCRIPT_RAILS)
23
23
  end
24
-
24
+
25
25
  def self.in_rails_application_subdirectory?(path = Pathname.new(Dir.pwd))
26
26
  File.exists?(File.join(path, SCRIPT_RAILS)) || !path.root? && in_rails_application_subdirectory?(path.parent)
27
27
  end
@@ -4,15 +4,15 @@ require 'rake/rdoctask'
4
4
  class RDocTaskWithoutDescriptions < Rake::RDocTask
5
5
  def define
6
6
  task rdoc_task_name
7
-
7
+
8
8
  task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
9
-
9
+
10
10
  task clobber_task_name do
11
11
  rm_r rdoc_dir rescue nil
12
12
  end
13
-
13
+
14
14
  task :clobber => [clobber_task_name]
15
-
15
+
16
16
  directory @rdoc_dir
17
17
  task rdoc_task_name => [rdoc_target]
18
18
  file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
@@ -55,7 +55,7 @@ namespace :doc do
55
55
  rdoc.template = "#{ENV['template']}.rb" if ENV['template']
56
56
  rdoc.title = "Rails Framework Documentation"
57
57
  rdoc.options << '--line-numbers' << '--inline-source'
58
- rdoc.rdoc_files.include('README.rdoc')
58
+ rdoc.rdoc_files.include('README')
59
59
 
60
60
  gem_path('actionmailer') do |actionmailer|
61
61
  %w(README.rdoc CHANGELOG MIT-LICENSE lib/action_mailer/base.rb).each do |file|
@@ -54,7 +54,7 @@ namespace :rails do
54
54
 
55
55
  namespace :update do
56
56
  def invoke_from_app_generator(method)
57
- app_generator.invoke(method)
57
+ app_generator.send(method)
58
58
  end
59
59
 
60
60
  def app_generator
@@ -1,21 +1,35 @@
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
3
  Rails.application.reload_routes!
4
- all_routes = ENV['CONTROLLER'] ? Rails.application.routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : Rails.application.routes.routes
4
+
5
+ all_routes = Rails.application.routes.routes
6
+ named_routes = Rails.application.routes.named_routes.routes
7
+
8
+ if ENV['CONTROLLER']
9
+ all_routes = all_routes.select{ |route| route.defaults[:controller] == ENV['CONTROLLER'] }
10
+ end
11
+
5
12
  routes = all_routes.collect do |route|
6
13
  # TODO: The :index method is deprecated in 1.9 in favor of :key
7
14
  # but we don't have :key in 1.8.7. We can remove this check when
8
15
  # stop supporting 1.8.x
9
- key_method = Hash.method_defined?('key') ? 'key' : 'index'
10
- name = Rails.application.routes.named_routes.routes.send(key_method, route).to_s
11
- reqs = route.requirements.empty? ? "" : route.requirements.inspect
16
+ key = Hash.method_defined?('key') ? 'key' : 'index'
17
+ name = named_routes.send(key, route).to_s
18
+
19
+ reqs = route.requirements.dup
20
+ reqs[:to] = route.app unless route.app.is_a?(ActionDispatch::Routing::RouteSet::Dispatcher)
21
+ reqs = reqs.empty? ? "" : reqs.inspect
22
+
12
23
  {:name => name, :verb => route.verb.to_s, :path => route.path, :reqs => reqs}
13
24
  end
14
- routes.reject!{ |r| r[:path] == "/rails/info/properties" } # skip the route if it's internal info route
15
- name_width = routes.collect {|r| r[:name]}.collect {|n| n.length}.max
16
- verb_width = routes.collect {|r| r[:verb]}.collect {|v| v.length}.max
17
- path_width = routes.collect {|r| r[:path]}.collect {|s| s.length}.max
25
+
26
+ routes.reject! { |r| r[:path] == "/rails/info/properties" } # Skip the route if it's internal info route
27
+
28
+ name_width = routes.map{ |r| r[:name] }.map(&:length).max
29
+ verb_width = routes.map{ |r| r[:verb] }.map(&:length).max
30
+ path_width = routes.map{ |r| r[:path] }.map(&:length).max
31
+
18
32
  routes.each do |r|
19
33
  puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}"
20
34
  end
21
- end
35
+ end
@@ -1,3 +1,4 @@
1
+ require 'rbconfig'
1
2
  require 'rake/testtask'
2
3
 
3
4
  # Monkey-patch to silence the description from Rake::TestTask to cut down on rake -T noise
@@ -62,7 +63,7 @@ end
62
63
  module Kernel
63
64
  def silence_stderr
64
65
  old_stderr = STDERR.dup
65
- STDERR.reopen(Config::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
66
+ STDERR.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
66
67
  STDERR.sync = true
67
68
  yield
68
69
  ensure
@@ -70,7 +71,7 @@ module Kernel
70
71
  end
71
72
  end
72
73
 
73
- desc 'Runs test:unit, test:functional, test:integration together (also available: test:benchmark, test:profile, test:plugins)'
74
+ desc 'Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)'
74
75
  task :test do
75
76
  errors = %w(test:units test:functionals test:integration).collect do |task|
76
77
  begin
data/lib/rails/version.rb CHANGED
@@ -3,7 +3,7 @@ module Rails
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
5
  TINY = 0
6
- BUILD = "rc"
6
+ BUILD = "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7712042
4
+ hash: 977940607
5
5
  prerelease: true
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
- - rc
11
- version: 3.0.0.rc
10
+ - rc2
11
+ version: 3.0.0.rc2
12
12
  platform: ruby
13
13
  authors:
14
14
  - David Heinemeier Hansson
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-07-26 00:00:00 -05:00
19
+ date: 2010-08-23 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -59,13 +59,13 @@ dependencies:
59
59
  requirements:
60
60
  - - "="
61
61
  - !ruby/object:Gem::Version
62
- hash: 7712042
62
+ hash: 977940607
63
63
  segments:
64
64
  - 3
65
65
  - 0
66
66
  - 0
67
- - rc
68
- version: 3.0.0.rc
67
+ - rc2
68
+ version: 3.0.0.rc2
69
69
  type: :runtime
70
70
  version_requirements: *id003
71
71
  - !ruby/object:Gem::Dependency
@@ -76,13 +76,13 @@ dependencies:
76
76
  requirements:
77
77
  - - "="
78
78
  - !ruby/object:Gem::Version
79
- hash: 7712042
79
+ hash: 977940607
80
80
  segments:
81
81
  - 3
82
82
  - 0
83
83
  - 0
84
- - rc
85
- version: 3.0.0.rc
84
+ - rc2
85
+ version: 3.0.0.rc2
86
86
  type: :runtime
87
87
  version_requirements: *id004
88
88
  description: "Rails internals: application bootup, plugins, generators, and rake tasks."