railties 4.1.0 → 4.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +229 -197
  3. data/RDOC_MAIN.rdoc +1 -1
  4. data/README.rdoc +6 -2
  5. data/lib/rails/all.rb +1 -0
  6. data/lib/rails/api/task.rb +7 -0
  7. data/lib/rails/app_rails_loader.rb +5 -3
  8. data/lib/rails/application/bootstrap.rb +15 -1
  9. data/lib/rails/application/configuration.rb +65 -8
  10. data/lib/rails/application/default_middleware_stack.rb +6 -2
  11. data/lib/rails/application/finisher.rb +0 -2
  12. data/lib/rails/application.rb +119 -24
  13. data/lib/rails/backtrace_cleaner.rb +9 -4
  14. data/lib/rails/code_statistics.rb +3 -4
  15. data/lib/rails/commands/commands_tasks.rb +2 -7
  16. data/lib/rails/commands/console.rb +24 -12
  17. data/lib/rails/commands/dbconsole.rb +20 -5
  18. data/lib/rails/commands/destroy.rb +2 -0
  19. data/lib/rails/commands/generate.rb +2 -0
  20. data/lib/rails/commands/plugin.rb +1 -1
  21. data/lib/rails/commands/server.rb +32 -21
  22. data/lib/rails/configuration.rb +2 -2
  23. data/lib/rails/engine/configuration.rb +1 -1
  24. data/lib/rails/engine.rb +15 -12
  25. data/lib/rails/gem_version.rb +2 -2
  26. data/lib/rails/generators/actions/create_migration.rb +4 -3
  27. data/lib/rails/generators/actions.rb +33 -12
  28. data/lib/rails/generators/app_base.rb +63 -55
  29. data/lib/rails/generators/base.rb +2 -2
  30. data/lib/rails/generators/erb/mailer/mailer_generator.rb +25 -2
  31. data/lib/rails/generators/erb/mailer/templates/layout.html.erb +5 -0
  32. data/lib/rails/generators/erb/mailer/templates/layout.text.erb +1 -0
  33. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +1 -6
  34. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +1 -1
  35. data/lib/rails/generators/erb/scaffold/templates/index.html.erb +3 -1
  36. data/lib/rails/generators/erb/scaffold/templates/new.html.erb +1 -1
  37. data/lib/rails/generators/generated_attribute.rb +28 -4
  38. data/lib/rails/generators/model_helpers.rb +28 -0
  39. data/lib/rails/generators/named_base.rb +10 -1
  40. data/lib/rails/generators/rails/app/app_generator.rb +34 -2
  41. data/lib/rails/generators/rails/app/templates/Gemfile +22 -7
  42. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +2 -2
  43. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +1 -1
  44. data/lib/rails/generators/rails/app/templates/bin/rails +1 -1
  45. data/lib/rails/generators/rails/app/templates/bin/setup +28 -0
  46. data/lib/rails/generators/rails/app/templates/config/application.rb +8 -1
  47. data/lib/rails/generators/rails/app/templates/config/boot.rb +1 -2
  48. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +1 -3
  49. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
  50. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +4 -0
  51. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +14 -20
  52. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +5 -2
  53. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +11 -0
  54. data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb +1 -1
  55. data/lib/rails/generators/rails/app/templates/config/initializers/to_time_preserves_timezone.rb +10 -0
  56. data/lib/rails/generators/rails/app/templates/config.ru +1 -1
  57. data/lib/rails/generators/rails/app/templates/gitignore +4 -1
  58. data/lib/rails/generators/rails/app/templates/test/test_helper.rb +0 -3
  59. data/lib/rails/generators/rails/controller/USAGE +0 -1
  60. data/lib/rails/generators/rails/controller/controller_generator.rb +8 -4
  61. data/lib/rails/generators/rails/helper/USAGE +0 -4
  62. data/lib/rails/generators/rails/model/USAGE +12 -3
  63. data/lib/rails/generators/rails/model/model_generator.rb +4 -0
  64. data/lib/rails/generators/rails/plugin/plugin_generator.rb +23 -1
  65. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec +3 -3
  66. data/lib/rails/generators/rails/plugin/templates/Gemfile +14 -6
  67. data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE +1 -1
  68. data/lib/rails/generators/rails/plugin/templates/Rakefile +4 -0
  69. data/lib/rails/generators/rails/plugin/templates/app/controllers/%name%/application_controller.rb.tt +1 -0
  70. data/lib/rails/generators/rails/plugin/templates/rails/application.rb +1 -1
  71. data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +2 -2
  72. data/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +1 -1
  73. data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb +0 -4
  74. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +13 -3
  75. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +4 -2
  76. data/lib/rails/generators/rails/scaffold/USAGE +7 -1
  77. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +1 -0
  78. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +1 -1
  79. data/lib/rails/generators/resource_helpers.rb +2 -11
  80. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +6 -0
  81. data/lib/rails/generators/test_unit/helper/helper_generator.rb +1 -5
  82. data/lib/rails/generators/test_unit/job/job_generator.rb +13 -0
  83. data/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb +9 -0
  84. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +9 -0
  85. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +4 -1
  86. data/lib/rails/generators/testing/assertions.rb +3 -1
  87. data/lib/rails/generators/testing/behaviour.rb +18 -1
  88. data/lib/rails/generators.rb +66 -15
  89. data/lib/rails/info.rb +8 -24
  90. data/lib/rails/info_controller.rb +1 -1
  91. data/lib/rails/mailers_controller.rb +20 -14
  92. data/lib/rails/paths.rb +3 -3
  93. data/lib/rails/rack/log_tailer.rb +4 -0
  94. data/lib/rails/rack/logger.rb +1 -1
  95. data/lib/rails/rack.rb +1 -1
  96. data/lib/rails/railtie.rb +3 -3
  97. data/lib/rails/ruby_version_check.rb +1 -1
  98. data/lib/rails/source_annotation_extractor.rb +25 -19
  99. data/lib/rails/tasks/framework.rake +2 -2
  100. data/lib/rails/tasks/statistics.rake +9 -2
  101. data/lib/rails/tasks.rb +3 -2
  102. data/lib/rails/templates/rails/mailers/email.html.erb +22 -4
  103. data/lib/rails/templates/rails/mailers/index.html.erb +2 -2
  104. data/lib/rails/templates/rails/mailers/mailer.html.erb +1 -1
  105. data/lib/rails/templates/rails/welcome/index.html.erb +23 -7
  106. data/lib/rails/test_help.rb +1 -0
  107. data/lib/rails/test_unit/sub_test_task.rb +2 -2
  108. data/lib/rails/test_unit/testing.rake +23 -5
  109. data/lib/rails.rb +7 -1
  110. metadata +17 -12
  111. data/lib/rails/commands/update.rb +0 -9
  112. data/lib/rails/generators/test_unit/helper/templates/helper_test.rb +0 -6
  113. data/lib/rails/rubyprof_ext.rb +0 -35
@@ -3,32 +3,50 @@ require 'rails/test_unit/sub_test_task'
3
3
 
4
4
  task default: :test
5
5
 
6
- desc 'Runs test:units, test:functionals, test:generators, test:integration together'
6
+ desc "Runs all tests in test folder"
7
7
  task :test do
8
8
  Rails::TestTask.test_creator(Rake.application.top_level_tasks).invoke_rake_task
9
9
  end
10
10
 
11
11
  namespace :test do
12
12
  task :prepare do
13
- # Placeholder task for other Railtie and plugins to enhance. See Active Record for an example.
13
+ # Placeholder task for other Railtie and plugins to enhance.
14
+ # If used with Active Record, this task runs before the database schema is synchronized.
14
15
  end
15
16
 
16
- task :run => ['test:units', 'test:functionals', 'test:generators', 'test:integration']
17
+ Rails::TestTask.new(:run) do |t|
18
+ t.pattern = "test/**/*_test.rb"
19
+ end
20
+
21
+ desc "Run tests quickly, but also reset db"
22
+ task :db => %w[db:test:prepare test]
17
23
 
18
- # Inspired by: http://ngauthier.com/2012/02/quick-tests-with-bash.html
19
24
  desc "Run tests quickly by merging all types and not resetting db"
20
25
  Rails::TestTask.new(:all) do |t|
21
26
  t.pattern = "test/**/*_test.rb"
22
27
  end
23
28
 
29
+ Rake::Task["test:all"].enhance do
30
+ Rake::Task["test:deprecate_all"].invoke
31
+ end
32
+
33
+ task :deprecate_all do
34
+ ActiveSupport::Deprecation.warn "rake test:all is deprecated and will be removed in Rails 5. " \
35
+ "Use rake test to run all tests in test directory."
36
+ end
37
+
24
38
  namespace :all do
25
39
  desc "Run tests quickly, but also reset db"
26
40
  task :db => %w[db:test:prepare test:all]
41
+
42
+ Rake::Task["test:all:db"].enhance do
43
+ Rake::Task["test:deprecate_all"].invoke
44
+ end
27
45
  end
28
46
 
29
47
  Rails::TestTask.new(single: "test:prepare")
30
48
 
31
- ["models", "helpers", "controllers", "mailers", "integration"].each do |name|
49
+ ["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name|
32
50
  Rails::TestTask.new(name => "test:prepare") do |t|
33
51
  t.pattern = "test/#{name}/**/*_test.rb"
34
52
  end
data/lib/rails.rb CHANGED
@@ -29,7 +29,13 @@ module Rails
29
29
  autoload :WelcomeController
30
30
 
31
31
  class << self
32
- attr_accessor :application, :cache, :logger
32
+ @application = @app_class = nil
33
+
34
+ attr_writer :application
35
+ attr_accessor :app_class, :cache, :logger
36
+ def application
37
+ @application ||= (app_class.instance if app_class)
38
+ end
33
39
 
34
40
  delegate :initialize!, :initialized?, to: :application
35
41
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.0
19
+ version: 4.2.10
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.1.0
26
+ version: 4.2.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.1.0
33
+ version: 4.2.10
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.1.0
40
+ version: 4.2.10
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 4.1.0
81
+ version: 4.2.10
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 4.1.0
88
+ version: 4.2.10
89
89
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
90
90
  email: david@loudthinking.com
91
91
  executables:
@@ -122,7 +122,6 @@ files:
122
122
  - lib/rails/commands/plugin.rb
123
123
  - lib/rails/commands/runner.rb
124
124
  - lib/rails/commands/server.rb
125
- - lib/rails/commands/update.rb
126
125
  - lib/rails/configuration.rb
127
126
  - lib/rails/console/app.rb
128
127
  - lib/rails/console/helpers.rb
@@ -145,6 +144,8 @@ files:
145
144
  - lib/rails/generators/erb/controller/controller_generator.rb
146
145
  - lib/rails/generators/erb/controller/templates/view.html.erb
147
146
  - lib/rails/generators/erb/mailer/mailer_generator.rb
147
+ - lib/rails/generators/erb/mailer/templates/layout.html.erb
148
+ - lib/rails/generators/erb/mailer/templates/layout.text.erb
148
149
  - lib/rails/generators/erb/mailer/templates/view.html.erb
149
150
  - lib/rails/generators/erb/mailer/templates/view.text.erb
150
151
  - lib/rails/generators/erb/scaffold/scaffold_generator.rb
@@ -157,6 +158,7 @@ files:
157
158
  - lib/rails/generators/js/assets/assets_generator.rb
158
159
  - lib/rails/generators/js/assets/templates/javascript.js
159
160
  - lib/rails/generators/migration.rb
161
+ - lib/rails/generators/model_helpers.rb
160
162
  - lib/rails/generators/named_base.rb
161
163
  - lib/rails/generators/rails/app/USAGE
162
164
  - lib/rails/generators/rails/app/app_generator.rb
@@ -171,6 +173,7 @@ files:
171
173
  - lib/rails/generators/rails/app/templates/bin/bundle
172
174
  - lib/rails/generators/rails/app/templates/bin/rails
173
175
  - lib/rails/generators/rails/app/templates/bin/rake
176
+ - lib/rails/generators/rails/app/templates/bin/setup
174
177
  - lib/rails/generators/rails/app/templates/config.ru
175
178
  - lib/rails/generators/rails/app/templates/config/application.rb
176
179
  - lib/rails/generators/rails/app/templates/config/boot.rb
@@ -189,12 +192,14 @@ files:
189
192
  - lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
190
193
  - lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
191
194
  - lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
195
+ - lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt
192
196
  - lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb
193
197
  - lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb
194
198
  - lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb
195
199
  - lib/rails/generators/rails/app/templates/config/initializers/inflections.rb
196
200
  - lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb
197
201
  - lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt
202
+ - lib/rails/generators/rails/app/templates/config/initializers/to_time_preserves_timezone.rb
198
203
  - lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt
199
204
  - lib/rails/generators/rails/app/templates/config/locales/en.yml
200
205
  - lib/rails/generators/rails/app/templates/config/routes.rb
@@ -275,9 +280,10 @@ files:
275
280
  - lib/rails/generators/test_unit/generator/generator_generator.rb
276
281
  - lib/rails/generators/test_unit/generator/templates/generator_test.rb
277
282
  - lib/rails/generators/test_unit/helper/helper_generator.rb
278
- - lib/rails/generators/test_unit/helper/templates/helper_test.rb
279
283
  - lib/rails/generators/test_unit/integration/integration_generator.rb
280
284
  - lib/rails/generators/test_unit/integration/templates/integration_test.rb
285
+ - lib/rails/generators/test_unit/job/job_generator.rb
286
+ - lib/rails/generators/test_unit/job/templates/unit_test.rb.erb
281
287
  - lib/rails/generators/test_unit/mailer/mailer_generator.rb
282
288
  - lib/rails/generators/test_unit/mailer/templates/functional_test.rb
283
289
  - lib/rails/generators/test_unit/mailer/templates/preview.rb
@@ -305,7 +311,6 @@ files:
305
311
  - lib/rails/railtie/configurable.rb
306
312
  - lib/rails/railtie/configuration.rb
307
313
  - lib/rails/ruby_version_check.rb
308
- - lib/rails/rubyprof_ext.rb
309
314
  - lib/rails/source_annotation_extractor.rb
310
315
  - lib/rails/tasks.rb
311
316
  - lib/rails/tasks/annotations.rake
@@ -353,7 +358,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
358
  version: '0'
354
359
  requirements: []
355
360
  rubyforge_project:
356
- rubygems_version: 2.2.0
361
+ rubygems_version: 2.5.2
357
362
  signing_key:
358
363
  specification_version: 4
359
364
  summary: Tools for creating, working with, and running Rails applications.
@@ -1,9 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
2
-
3
- if ARGV.size == 0
4
- Rails::Generators.help
5
- exit
6
- end
7
-
8
- name = ARGV.shift
9
- Rails::Generators.invoke name, ARGV, behavior: :skip
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- <% module_namespacing do -%>
4
- class <%= class_name %>HelperTest < ActionView::TestCase
5
- end
6
- <% end -%>
@@ -1,35 +0,0 @@
1
- require 'prof'
2
-
3
- module Prof #:nodoc:
4
- # Adapted from Shugo Maeda's unprof.rb
5
- def self.print_profile(results, io = $stderr)
6
- total = results.detect { |i|
7
- i.method_class.nil? && i.method_id == :"#toplevel"
8
- }.total_time
9
- total = 0.001 if total < 0.001
10
-
11
- io.puts " %% cumulative self self total"
12
- io.puts " time seconds seconds calls ms/call ms/call name"
13
-
14
- sum = 0.0
15
- results.each do |r|
16
- sum += r.self_time
17
-
18
- name = if r.method_class.nil?
19
- r.method_id.to_s
20
- elsif r.method_class.is_a?(Class)
21
- "#{r.method_class}##{r.method_id}"
22
- else
23
- "#{r.method_class}.#{r.method_id}"
24
- end
25
- io.printf "%6.2f %8.3f %8.3f %8d %8.2f %8.2f %s\n",
26
- r.self_time / total * 100,
27
- sum,
28
- r.self_time,
29
- r.count,
30
- r.self_time * 1000 / r.count,
31
- r.total_time * 1000 / r.count,
32
- name
33
- end
34
- end
35
- end