railties 4.2.0.beta4 → 4.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -1
  3. data/lib/rails/application.rb +19 -9
  4. data/lib/rails/application/bootstrap.rb +13 -0
  5. data/lib/rails/application/configuration.rb +11 -2
  6. data/lib/rails/code_statistics.rb +1 -0
  7. data/lib/rails/commands/dbconsole.rb +16 -1
  8. data/lib/rails/commands/destroy.rb +2 -0
  9. data/lib/rails/commands/generate.rb +2 -0
  10. data/lib/rails/configuration.rb +2 -2
  11. data/lib/rails/engine.rb +9 -6
  12. data/lib/rails/gem_version.rb +1 -1
  13. data/lib/rails/generators/app_base.rb +4 -13
  14. data/lib/rails/generators/erb/mailer/mailer_generator.rb +23 -2
  15. data/lib/rails/generators/erb/mailer/templates/layout.html.erb +5 -0
  16. data/lib/rails/generators/erb/mailer/templates/layout.text.erb +1 -0
  17. data/lib/rails/generators/rails/app/templates/Gemfile +1 -1
  18. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +1 -1
  19. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +1 -1
  20. data/lib/rails/generators/rails/app/templates/bin/rails +1 -1
  21. data/lib/rails/generators/rails/app/templates/config.ru +1 -1
  22. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +3 -2
  23. data/lib/rails/generators/rails/app/templates/gitignore +2 -1
  24. data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +1 -1
  25. data/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +1 -1
  26. data/lib/rails/info.rb +3 -0
  27. data/lib/rails/paths.rb +2 -2
  28. data/lib/rails/source_annotation_extractor.rb +2 -3
  29. data/lib/rails/tasks/statistics.rake +2 -1
  30. data/lib/rails/templates/rails/welcome/index.html.erb +1 -1
  31. data/lib/rails/test_unit/testing.rake +22 -4
  32. metadata +21 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0762e4948920f6a4982be97cdf7941b8fba50810
4
- data.tar.gz: afc9c44925b92fadaea2e6556f6ae29707dc98d7
3
+ metadata.gz: 519bfb3b0886ff84ec44b002f52d73222ecc9206
4
+ data.tar.gz: 7e48cb155bb48412838653cb39be7d634a7589ef
5
5
  SHA512:
6
- metadata.gz: 7f52cbcfea3201647694b0ff274dc56e84c226676f923af1525f6e35fa48696a64a815b5da8d07aa0d9bdc15a38c91dec7ca51371e8a559b4dd510eb34802190
7
- data.tar.gz: 8ff73da75dda716b4f5218ee127129b382ae5bd2256debfa897d3a340f127d1fd13398aeab17a0af7e2b5b6e59f8b33eb5fa636580576fd9ec780245a1d69b54
6
+ metadata.gz: 2fd29a2e7250ec1c3c95ecbca895f76947192a18181fcdffdc26b5738903efd7379aa7858e3bb947eff249492e4af3b3432e103690a003bb793bb1ad9e79a8b0
7
+ data.tar.gz: f31a4de2be716c3bd057cd00106fbf174f589ebbdfc1b9d4fba78c2e8e60e50fb22233363722d09877e84092bba6d509b47f0e5f67ba18153c7e8b0559d163d4
@@ -1,3 +1,33 @@
1
+ * Generated migrations add the appropriate foreign key constraints to
2
+ references.
3
+
4
+ *Derek Prior*
5
+
6
+ * Deprecate different default for `log_level` in production.
7
+
8
+ *Godfrey Chan*, *Matthew Draper*
9
+
10
+ * Generated `.gitignore` excludes the whole `log/` directory, not only
11
+ `*.log` files.
12
+
13
+ *ShunsukeAida*
14
+
15
+ * `Rails::Paths::Path.unshift` now has the same interface as `Array.unshift`.
16
+
17
+ *Igor Kapkov*
18
+
19
+ * Make `rake test` run all tests in test folder.
20
+
21
+ Deprecate `rake test:all` and replace `rake test:all:db` with `rake test:db`
22
+
23
+ *David Geukers*
24
+
25
+ * `secret_token` is now saved in `Rails.application.secrets.secret_token`
26
+ and it falls back to the value of `config.secret_token` when it is not
27
+ present in `config/secrets.yml`.
28
+
29
+ *Benjamin Fleischer*
30
+
1
31
  * Remove `--skip-action-view` option from `Rails::Generators::AppBase`.
2
32
 
3
33
  Fixes #17023.
@@ -89,7 +119,7 @@
89
119
 
90
120
  *Rafael Mendonça França*
91
121
 
92
- * Add a generic --skip-turbolinks options to generator.
122
+ * Add `--skip-turbolinks` option to the app generator.
93
123
 
94
124
  *Rafael Mendonça França*
95
125
 
@@ -88,6 +88,7 @@ module Rails
88
88
  def inherited(base)
89
89
  super
90
90
  Rails.app_class = base
91
+ add_lib_to_load_path!(find_root(base.called_from))
91
92
  end
92
93
 
93
94
  def instance
@@ -98,6 +99,10 @@ module Rails
98
99
  new(initial_variable_values, &block).run_load_hooks!
99
100
  end
100
101
 
102
+ def find_root(from)
103
+ find_root_with_flag "config.ru", from, Dir.pwd
104
+ end
105
+
101
106
  # Makes the +new+ method public.
102
107
  #
103
108
  # Note that Rails::Application inherits from Rails::Engine, which
@@ -129,8 +134,6 @@ module Rails
129
134
  # are these actually used?
130
135
  @initial_variable_values = initial_variable_values
131
136
  @block = block
132
-
133
- add_lib_to_load_path!
134
137
  end
135
138
 
136
139
  # Returns true if the application is initialized.
@@ -175,7 +178,7 @@ module Rails
175
178
  key_generator = ActiveSupport::KeyGenerator.new(secrets.secret_key_base, iterations: 1000)
176
179
  ActiveSupport::CachingKeyGenerator.new(key_generator)
177
180
  else
178
- ActiveSupport::LegacyKeyGenerator.new(config.secret_token)
181
+ ActiveSupport::LegacyKeyGenerator.new(secrets.secret_token)
179
182
  end
180
183
  end
181
184
 
@@ -245,7 +248,7 @@ module Rails
245
248
  super.merge({
246
249
  "action_dispatch.parameter_filter" => config.filter_parameters,
247
250
  "action_dispatch.redirect_filter" => config.filter_redirect,
248
- "action_dispatch.secret_token" => config.secret_token,
251
+ "action_dispatch.secret_token" => secrets.secret_token,
249
252
  "action_dispatch.secret_key_base" => secrets.secret_key_base,
250
253
  "action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions,
251
254
  "action_dispatch.show_detailed_exceptions" => config.consider_all_requests_local,
@@ -313,8 +316,8 @@ module Rails
313
316
  # are changing config.root inside your application definition or having a custom
314
317
  # Rails application, you will need to add lib to $LOAD_PATH on your own in case
315
318
  # you need to load files in lib/ during the application configuration as well.
316
- def add_lib_to_load_path! #:nodoc:
317
- path = File.join config.root, 'lib'
319
+ def self.add_lib_to_load_path!(root) #:nodoc:
320
+ path = File.join root, 'lib'
318
321
  if File.exist?(path) && !$LOAD_PATH.include?(path)
319
322
  $LOAD_PATH.unshift(path)
320
323
  end
@@ -358,7 +361,7 @@ module Rails
358
361
  end
359
362
 
360
363
  def config #:nodoc:
361
- @config ||= Application::Configuration.new(find_root_with_flag("config.ru", Dir.pwd))
364
+ @config ||= Application::Configuration.new(self.class.find_root(self.class.called_from))
362
365
  end
363
366
 
364
367
  def config=(configuration) #:nodoc:
@@ -378,6 +381,8 @@ module Rails
378
381
 
379
382
  # Fallback to config.secret_key_base if secrets.secret_key_base isn't set
380
383
  secrets.secret_key_base ||= config.secret_key_base
384
+ # Fallback to config.secret_token if secrets.secret_token isn't set
385
+ secrets.secret_token ||= config.secret_token
381
386
 
382
387
  secrets
383
388
  end
@@ -507,8 +512,13 @@ module Rails
507
512
  end
508
513
 
509
514
  def validate_secret_key_config! #:nodoc:
510
- if secrets.secret_key_base.blank? && config.secret_token.blank?
511
- raise "Missing `secret_key_base` for '#{Rails.env}' environment, set this value in `config/secrets.yml`"
515
+ if secrets.secret_key_base.blank?
516
+ ActiveSupport::Deprecation.warn "You didn't set `secret_key_base`. " +
517
+ "Read the upgrade documentation to learn more about this new config option."
518
+
519
+ if secrets.secret_token.blank?
520
+ raise "Missing `secret_token` and `secret_key_base` for '#{Rails.env}' environment, set these values in `config/secrets.yml`"
521
+ end
512
522
  end
513
523
  end
514
524
  end
@@ -1,5 +1,6 @@
1
1
  require "active_support/notifications"
2
2
  require "active_support/dependencies"
3
+ require "active_support/deprecation"
3
4
  require "active_support/descendants_tracker"
4
5
 
5
6
  module Rails
@@ -54,6 +55,18 @@ INFO
54
55
  logger
55
56
  end
56
57
 
58
+ if Rails.env.production? && !config.has_explicit_log_level?
59
+ ActiveSupport::Deprecation.warn \
60
+ "You did not specify a `log_level` in `production.rb`. Currently, " \
61
+ "the default value for `log_level` is `:info` for the production " \
62
+ "environment and `:debug` in all other environments. In Rails 5 " \
63
+ "the default value will be unified to `:debug` across all " \
64
+ "environments. To preserve the current setting, add the following " \
65
+ "line to your `production.rb`:\n" \
66
+ "\n" \
67
+ " config.log_level = :info\n\n"
68
+ end
69
+
57
70
  Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
58
71
  end
59
72
 
@@ -15,7 +15,6 @@ module Rails
15
15
  :time_zone, :reload_classes_only_on_change,
16
16
  :beginning_of_week, :filter_redirect, :x
17
17
 
18
- attr_writer :log_level
19
18
  attr_reader :encoding
20
19
 
21
20
  def initialize(*)
@@ -34,6 +33,7 @@ module Rails
34
33
  @session_options = {}
35
34
  @time_zone = "UTC"
36
35
  @beginning_of_week = :monday
36
+ @has_explicit_log_level = false
37
37
  @log_level = nil
38
38
  @middleware = app_middleware
39
39
  @generators = app_generators
@@ -117,8 +117,17 @@ module Rails
117
117
  raise e, "Cannot load `Rails.application.database_configuration`:\n#{e.message}", e.backtrace
118
118
  end
119
119
 
120
+ def has_explicit_log_level? # :nodoc:
121
+ @has_explicit_log_level
122
+ end
123
+
124
+ def log_level=(level)
125
+ @has_explicit_log_level = !!(level)
126
+ @log_level = level
127
+ end
128
+
120
129
  def log_level
121
- @log_level ||= :debug
130
+ @log_level ||= (Rails.env.production? ? :info : :debug)
122
131
  end
123
132
 
124
133
  def colorize_logging
@@ -6,6 +6,7 @@ class CodeStatistics #:nodoc:
6
6
  'Helper tests',
7
7
  'Model tests',
8
8
  'Mailer tests',
9
+ 'Job tests',
9
10
  'Integration tests',
10
11
  'Functional tests (old)',
11
12
  'Unit tests (old)']
@@ -44,7 +44,7 @@ module Rails
44
44
 
45
45
  find_cmd_and_exec(['mysql', 'mysql5'], *args)
46
46
 
47
- when "postgresql", "postgres", "postgis"
47
+ when /^postgres|^postgis/
48
48
  ENV['PGUSER'] = config["username"] if config["username"]
49
49
  ENV['PGHOST'] = config["host"] if config["host"]
50
50
  ENV['PGPORT'] = config["port"].to_s if config["port"]
@@ -74,6 +74,21 @@ module Rails
74
74
 
75
75
  find_cmd_and_exec('sqlplus', logon)
76
76
 
77
+ when "sqlserver"
78
+ args = []
79
+
80
+ args += ["-D", "#{config['database']}"] if config['database']
81
+ args += ["-U", "#{config['username']}"] if config['username']
82
+ args += ["-P", "#{config['password']}"] if config['password']
83
+
84
+ if config['host']
85
+ host_arg = "#{config['host']}"
86
+ host_arg << ":#{config['port']}" if config['port']
87
+ args += ["-S", host_arg]
88
+ end
89
+
90
+ find_cmd_and_exec("sqsh", *args)
91
+
77
92
  else
78
93
  abort "Unknown command-line client for #{config['database']}. Submit a Rails patch to add support!"
79
94
  end
@@ -1,5 +1,7 @@
1
1
  require 'rails/generators'
2
2
 
3
+ #if no argument/-h/--help is passed to rails destroy command, then
4
+ #it generates the help associated.
3
5
  if [nil, "-h", "--help"].include?(ARGV.first)
4
6
  Rails::Generators.help 'destroy'
5
7
  exit
@@ -1,5 +1,7 @@
1
1
  require 'rails/generators'
2
2
 
3
+ #if no argument/-h/--help is passed to rails generate command, then
4
+ #it generates the help associated.
3
5
  if [nil, "-h", "--help"].include?(ARGV.first)
4
6
  Rails::Generators.help 'generate'
5
7
  exit
@@ -18,11 +18,11 @@ module Rails
18
18
  # This will put the <tt>Magical::Unicorns</tt> middleware on the end of the stack.
19
19
  # You can use +insert_before+ if you wish to add a middleware before another:
20
20
  #
21
- # config.middleware.insert_before ActionDispatch::Head, Magical::Unicorns
21
+ # config.middleware.insert_before Rack::Head, Magical::Unicorns
22
22
  #
23
23
  # There's also +insert_after+ which will insert a middleware after another:
24
24
  #
25
- # config.middleware.insert_after ActionDispatch::Head, Magical::Unicorns
25
+ # config.middleware.insert_after Rack::Head, Magical::Unicorns
26
26
  #
27
27
  # Middlewares can also be completely swapped out and replaced with others:
28
28
  #
@@ -110,8 +110,8 @@ module Rails
110
110
  #
111
111
  # == Endpoint
112
112
  #
113
- # An engine can be also a rack application. It can be useful if you have a rack application that
114
- # you would like to wrap with +Engine+ and provide some of the +Engine+'s features.
113
+ # An engine can also be a rack application. It can be useful if you have a rack application that
114
+ # you would like to wrap with +Engine+ and provide with some of the +Engine+'s features.
115
115
  #
116
116
  # To do that, use the +endpoint+ method:
117
117
  #
@@ -351,7 +351,7 @@ module Rails
351
351
 
352
352
  base.called_from = begin
353
353
  call_stack = if Kernel.respond_to?(:caller_locations)
354
- caller_locations.map(&:path)
354
+ caller_locations.map(&:absolute_path)
355
355
  else
356
356
  # Remove the line number from backtraces making sure we don't leave anything behind
357
357
  caller.map { |p| p.sub(/:\d+.*/, '') }
@@ -364,6 +364,10 @@ module Rails
364
364
  super
365
365
  end
366
366
 
367
+ def find_root(from)
368
+ find_root_with_flag "lib", from
369
+ end
370
+
367
371
  def endpoint(endpoint = nil)
368
372
  @endpoint ||= nil
369
373
  @endpoint = endpoint if endpoint
@@ -531,7 +535,7 @@ module Rails
531
535
 
532
536
  # Define the configuration object for the engine.
533
537
  def config
534
- @config ||= Engine::Configuration.new(find_root_with_flag("lib"))
538
+ @config ||= Engine::Configuration.new(self.class.find_root(self.class.called_from))
535
539
  end
536
540
 
537
541
  # Load data from db/seeds.rb file. It can be used in to load engines'
@@ -658,8 +662,7 @@ module Rails
658
662
  paths["db/migrate"].existent.any?
659
663
  end
660
664
 
661
- def find_root_with_flag(flag, default=nil) #:nodoc:
662
- root_path = self.class.called_from
665
+ def self.find_root_with_flag(flag, root_path, default=nil) #:nodoc:
663
666
 
664
667
  while root_path && File.directory?(root_path) && !File.exist?("#{root_path}/#{flag}")
665
668
  parent = File.dirname(root_path)
@@ -8,7 +8,7 @@ module Rails
8
8
  MAJOR = 4
9
9
  MINOR = 2
10
10
  TINY = 0
11
- PRE = "beta4"
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -237,13 +237,10 @@ module Rails
237
237
 
238
238
  gems = []
239
239
  if options.dev? || options.edge?
240
- gems << GemfileEntry.github('sprockets-rails', 'rails/sprockets-rails',
241
- 'Use edge version of sprockets-rails')
242
240
  gems << GemfileEntry.github('sass-rails', 'rails/sass-rails',
243
241
  'Use SCSS for stylesheets')
244
242
  else
245
- gems << GemfileEntry.version('sass-rails',
246
- '~> 5.0.0.beta1',
243
+ gems << GemfileEntry.version('sass-rails', '~> 4.0',
247
244
  'Use SCSS for stylesheets')
248
245
  end
249
246
 
@@ -278,14 +275,8 @@ module Rails
278
275
  []
279
276
  else
280
277
  gems = [coffee_gemfile_entry, javascript_runtime_gemfile_entry]
281
-
282
- if options[:javascript] == 'jquery'
283
- gems << GemfileEntry.version('jquery-rails', '~> 4.0.0.beta2',
284
- 'Use jQuery as the JavaScript library')
285
- else
286
- gems << GemfileEntry.version("#{options[:javascript]}-rails", nil,
287
- "Use #{options[:javascript]} as the JavaScript library")
288
- end
278
+ gems << GemfileEntry.version("#{options[:javascript]}-rails", nil,
279
+ "Use #{options[:javascript]} as the JavaScript library")
289
280
 
290
281
  unless options[:skip_turbolinks]
291
282
  gems << GemfileEntry.version("turbolinks", nil,
@@ -342,7 +333,7 @@ module Rails
342
333
  end
343
334
 
344
335
  def spring_install?
345
- !options[:skip_spring] && Process.respond_to?(:fork)
336
+ !options[:skip_spring] && Process.respond_to?(:fork) && !RUBY_PLATFORM.include?("cygwin")
346
337
  end
347
338
 
348
339
  def run_bundle
@@ -1,8 +1,29 @@
1
- require 'rails/generators/erb/controller/controller_generator'
1
+ require 'rails/generators/erb'
2
2
 
3
3
  module Erb # :nodoc:
4
4
  module Generators # :nodoc:
5
- class MailerGenerator < ControllerGenerator # :nodoc:
5
+ class MailerGenerator < Base # :nodoc:
6
+ argument :actions, type: :array, default: [], banner: "method method"
7
+
8
+ def copy_view_files
9
+ view_base_path = File.join("app/views", class_path, file_name)
10
+ empty_directory view_base_path
11
+
12
+ formats.each do |format|
13
+ layout_path = File.join("app/views/layouts", filename_with_extensions("mailer", format))
14
+ template filename_with_extensions(:layout, format), layout_path
15
+ end
16
+
17
+ actions.each do |action|
18
+ @action = action
19
+
20
+ formats.each do |format|
21
+ @path = File.join(view_base_path, filename_with_extensions(action, format))
22
+ template filename_with_extensions(:view, format), @path
23
+ end
24
+ end
25
+ end
26
+
6
27
  protected
7
28
 
8
29
  def formats
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <body>
3
+ <%%= yield %>
4
+ </body>
5
+ </html>
@@ -32,7 +32,7 @@ group :development, :test do
32
32
  <%- end -%>
33
33
 
34
34
  # Access an IRB console on exception pages or by using <%%= console %> in views
35
- gem 'web-console', '~> 2.0.0.beta4'
35
+ gem 'web-console', '~> 2.0'
36
36
  <%- if spring_install? %>
37
37
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
38
38
  gem 'spring'
@@ -2,7 +2,7 @@
2
2
  // listed below.
3
3
  //
4
4
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
8
  // compiled file.
@@ -3,7 +3,7 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
8
  * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
9
  * compiled file so the styles you add here take precedence over styles defined in any styles
@@ -1,3 +1,3 @@
1
- APP_PATH = File.expand_path('../../config/application', __FILE__)
1
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
2
2
  require_relative '../config/boot'
3
3
  require 'rails/commands'
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Rails.application
@@ -45,8 +45,9 @@ Rails.application.configure do
45
45
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
46
46
  # config.force_ssl = true
47
47
 
48
- # Decrease the log volume.
49
- # config.log_level = :info
48
+ # Use the lowest log level to ensure availability of diagnostic information
49
+ # when problems arise.
50
+ config.log_level = :debug
50
51
 
51
52
  # Prepend all log lines with the following tags.
52
53
  # config.log_tags = [ :subdomain, :uuid ]
@@ -14,5 +14,6 @@
14
14
 
15
15
  <% end -%>
16
16
  # Ignore all logfiles and tempfiles.
17
- /log/*.log
17
+ /log/*
18
+ !/log/.keep
18
19
  /tmp
@@ -2,7 +2,7 @@
2
2
  // listed below.
3
3
  //
4
4
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
8
  // compiled file.
@@ -3,7 +3,7 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
8
  * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
9
  * compiled file so the styles you add here take precedence over styles defined in any styles
@@ -1,6 +1,9 @@
1
1
  require "cgi"
2
2
 
3
3
  module Rails
4
+ # This module helps build the runtime properties used to display in the
5
+ # Rails::InfoController responses. Including the active Rails version, Ruby
6
+ # version, Rack version, and so on.
4
7
  module Info
5
8
  mattr_accessor :properties
6
9
  class << (@@properties = [])
@@ -167,8 +167,8 @@ module Rails
167
167
  @paths.concat paths
168
168
  end
169
169
 
170
- def unshift(path)
171
- @paths.unshift path
170
+ def unshift(*paths)
171
+ @paths.unshift(*paths)
172
172
  end
173
173
 
174
174
  def to_ary
@@ -80,9 +80,8 @@ class SourceAnnotationExtractor
80
80
 
81
81
  # Returns a hash that maps filenames under +dir+ (recursively) to arrays
82
82
  # with their annotations. Only files with annotations are included. Files
83
- # with extension +.builder+, +.rb+, +.erb+, +.haml+, +.slim+, +.css+,
84
- # +.scss+, +.js+, +.coffee+, +.rake+, +.sass+ and +.less+
85
- # are taken into account.
83
+ # with extension +.builder+, +.rb+, +.rake+, +.yml+, +.yaml+, +.ruby+,
84
+ # +.css+, +.js+ and +.erb+ are taken into account.
86
85
  def find_in(dir)
87
86
  results = {}
88
87
 
@@ -14,10 +14,11 @@ STATS_DIRECTORIES = [
14
14
  %w(Helper\ tests test/helpers),
15
15
  %w(Model\ tests test/models),
16
16
  %w(Mailer\ tests test/mailers),
17
+ %w(Job\ tests test/jobs),
17
18
  %w(Integration\ tests test/integration),
18
19
  %w(Functional\ tests\ (old) test/functional),
19
20
  %w(Unit\ tests \ (old) test/unit)
20
- ].collect do |name, dir|
21
+ ].collect do |name, dir|
21
22
  [ name, "#{File.dirname(Rake.application.rakefile_location)}/#{dir}" ]
22
23
  end.select { |name, dir| File.directory?(dir) }
23
24
 
@@ -237,7 +237,7 @@
237
237
 
238
238
  <ol>
239
239
  <li>
240
- <h2>Use <code>rails generate</code> to create your models and controllers</h2>
240
+ <h2>Use <code>bin/rails generate</code> to create your models and controllers</h2>
241
241
  <p>To see all available options, run it without parameters.</p>
242
242
  </li>
243
243
 
@@ -3,27 +3,45 @@ 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, test:jobs 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', 'test:jobs']
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")
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.2.0.beta4
4
+ version: 4.2.0.rc1
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-10-30 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,60 +16,60 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0.beta4
19
+ version: 4.2.0.rc1
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.2.0.beta4
26
+ version: 4.2.0.rc1
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.2.0.beta4
33
+ version: 4.2.0.rc1
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.2.0.beta4
40
+ version: 4.2.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.8.7
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.8.7
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: thor
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.18.1
62
- - - <
62
+ - - "<"
63
63
  - !ruby/object:Gem::Version
64
64
  version: '2.0'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: 0.18.1
72
- - - <
72
+ - - "<"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '2.0'
75
75
  - !ruby/object:Gem::Dependency
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 4.2.0.beta4
81
+ version: 4.2.0.rc1
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.2.0.beta4
88
+ version: 4.2.0.rc1
89
89
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
90
90
  email: david@loudthinking.com
91
91
  executables:
@@ -144,6 +144,8 @@ files:
144
144
  - lib/rails/generators/erb/controller/controller_generator.rb
145
145
  - lib/rails/generators/erb/controller/templates/view.html.erb
146
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
147
149
  - lib/rails/generators/erb/mailer/templates/view.html.erb
148
150
  - lib/rails/generators/erb/mailer/templates/view.text.erb
149
151
  - lib/rails/generators/erb/scaffold/scaffold_generator.rb
@@ -339,23 +341,23 @@ licenses:
339
341
  metadata: {}
340
342
  post_install_message:
341
343
  rdoc_options:
342
- - --exclude
343
- - .
344
+ - "--exclude"
345
+ - "."
344
346
  require_paths:
345
347
  - lib
346
348
  required_ruby_version: !ruby/object:Gem::Requirement
347
349
  requirements:
348
- - - '>='
350
+ - - ">="
349
351
  - !ruby/object:Gem::Version
350
352
  version: 1.9.3
351
353
  required_rubygems_version: !ruby/object:Gem::Requirement
352
354
  requirements:
353
- - - '>'
355
+ - - ">"
354
356
  - !ruby/object:Gem::Version
355
357
  version: 1.3.1
356
358
  requirements: []
357
359
  rubyforge_project:
358
- rubygems_version: 2.2.1
360
+ rubygems_version: 2.2.2
359
361
  signing_key:
360
362
  specification_version: 4
361
363
  summary: Tools for creating, working with, and running Rails applications.