railties 5.0.7.2 → 5.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +77 -567
  3. data/MIT-LICENSE +1 -1
  4. data/RDOC_MAIN.rdoc +3 -3
  5. data/README.rdoc +1 -1
  6. data/exe/rails +2 -2
  7. data/lib/rails.rb +18 -18
  8. data/lib/rails/all.rb +1 -1
  9. data/lib/rails/api/generator.rb +28 -0
  10. data/lib/rails/api/task.rb +54 -42
  11. data/lib/rails/app_loader.rb +9 -9
  12. data/lib/rails/application.rb +30 -35
  13. data/lib/rails/application/bootstrap.rb +13 -7
  14. data/lib/rails/application/configuration.rb +30 -53
  15. data/lib/rails/application/default_middleware_stack.rb +3 -5
  16. data/lib/rails/application/finisher.rb +16 -7
  17. data/lib/rails/application/routes_reloader.rb +16 -1
  18. data/lib/rails/application_controller.rb +10 -10
  19. data/lib/rails/backtrace_cleaner.rb +5 -5
  20. data/lib/rails/cli.rb +7 -5
  21. data/lib/rails/code_statistics.rb +16 -17
  22. data/lib/rails/code_statistics_calculator.rb +3 -3
  23. data/lib/rails/command.rb +111 -0
  24. data/lib/rails/command/actions.rb +42 -0
  25. data/lib/rails/command/base.rb +149 -0
  26. data/lib/rails/command/behavior.rb +123 -0
  27. data/lib/rails/command/environment_argument.rb +34 -0
  28. data/lib/rails/commands.rb +2 -4
  29. data/lib/rails/commands/application/application_command.rb +29 -0
  30. data/lib/rails/commands/console/console_command.rb +89 -0
  31. data/lib/rails/commands/dbconsole/dbconsole_command.rb +155 -0
  32. data/lib/rails/commands/destroy/destroy_command.rb +21 -0
  33. data/lib/rails/commands/generate/generate_command.rb +23 -0
  34. data/lib/rails/commands/help/USAGE +15 -0
  35. data/lib/rails/commands/help/help_command.rb +13 -0
  36. data/lib/rails/commands/new/new_command.rb +15 -0
  37. data/lib/rails/commands/plugin/plugin_command.rb +43 -0
  38. data/lib/rails/commands/rake/rake_command.rb +49 -0
  39. data/lib/rails/commands/runner/USAGE +17 -0
  40. data/lib/rails/commands/runner/runner_command.rb +46 -0
  41. data/lib/rails/commands/secrets/USAGE +52 -0
  42. data/lib/rails/commands/secrets/secrets_command.rb +36 -0
  43. data/lib/rails/commands/server/server_command.rb +177 -0
  44. data/lib/rails/commands/test/test_command.rb +20 -0
  45. data/lib/rails/commands/version/version_command.rb +9 -0
  46. data/lib/rails/configuration.rb +7 -7
  47. data/lib/rails/console/app.rb +4 -4
  48. data/lib/rails/dev_caching.rb +8 -8
  49. data/lib/rails/engine.rb +62 -63
  50. data/lib/rails/engine/commands.rb +6 -13
  51. data/lib/rails/engine/configuration.rb +2 -2
  52. data/lib/rails/gem_version.rb +3 -3
  53. data/lib/rails/generators.rb +229 -313
  54. data/lib/rails/generators/actions.rb +20 -21
  55. data/lib/rails/generators/actions/create_migration.rb +24 -25
  56. data/lib/rails/generators/active_model.rb +3 -3
  57. data/lib/rails/generators/app_base.rb +123 -93
  58. data/lib/rails/generators/base.rb +32 -33
  59. data/lib/rails/generators/css/assets/assets_generator.rb +1 -1
  60. data/lib/rails/generators/erb.rb +14 -14
  61. data/lib/rails/generators/erb/controller/controller_generator.rb +1 -1
  62. data/lib/rails/generators/erb/mailer/mailer_generator.rb +12 -12
  63. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +3 -3
  64. data/lib/rails/generators/generated_attribute.rb +27 -27
  65. data/lib/rails/generators/js/assets/assets_generator.rb +1 -1
  66. data/lib/rails/generators/migration.rb +8 -8
  67. data/lib/rails/generators/model_helpers.rb +2 -2
  68. data/lib/rails/generators/named_base.rb +56 -56
  69. data/lib/rails/generators/rails/app/app_generator.rb +98 -81
  70. data/lib/rails/generators/rails/app/templates/Gemfile +7 -2
  71. data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -2
  72. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +6 -4
  73. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.js +1 -1
  74. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +2 -2
  75. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -1
  76. data/lib/rails/generators/rails/app/templates/bin/{setup → setup.tt} +6 -0
  77. data/lib/rails/generators/rails/app/templates/bin/{update → update.tt} +2 -1
  78. data/lib/rails/generators/rails/app/templates/bin/yarn +9 -0
  79. data/lib/rails/generators/rails/app/templates/config/cable.yml +1 -0
  80. data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +1 -0
  81. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +1 -0
  82. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +1 -0
  83. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +2 -1
  84. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +1 -0
  85. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +1 -0
  86. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +2 -2
  87. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -0
  88. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +1 -1
  89. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +1 -1
  90. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +1 -1
  91. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +10 -1
  92. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +1 -1
  93. data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb +4 -6
  94. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +8 -3
  95. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt +6 -5
  96. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +10 -0
  97. data/lib/rails/generators/rails/app/templates/config/puma.rb +16 -7
  98. data/lib/rails/generators/rails/app/templates/config/secrets.yml +12 -2
  99. data/lib/rails/generators/rails/app/templates/gitignore +5 -1
  100. data/lib/rails/generators/rails/app/templates/package.json +5 -0
  101. data/lib/rails/generators/rails/app/templates/public/404.html +6 -6
  102. data/lib/rails/generators/rails/app/templates/public/422.html +6 -6
  103. data/lib/rails/generators/rails/app/templates/public/500.html +6 -6
  104. data/lib/rails/generators/rails/app/templates/public/robots.txt +0 -4
  105. data/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb +5 -0
  106. data/lib/rails/generators/rails/app/templates/test/test_helper.rb +0 -1
  107. data/lib/rails/generators/rails/assets/assets_generator.rb +10 -10
  108. data/lib/rails/generators/rails/controller/controller_generator.rb +15 -12
  109. data/lib/rails/generators/rails/encrypted_secrets/encrypted_secrets_generator.rb +66 -0
  110. data/lib/rails/generators/rails/encrypted_secrets/templates/config/secrets.yml.enc +3 -0
  111. data/lib/rails/generators/rails/generator/generator_generator.rb +2 -3
  112. data/lib/rails/generators/rails/helper/helper_generator.rb +1 -1
  113. data/lib/rails/generators/rails/model/model_generator.rb +1 -1
  114. data/lib/rails/generators/rails/plugin/plugin_generator.rb +21 -26
  115. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -0
  116. data/lib/rails/generators/rails/plugin/templates/bin/test.tt +3 -9
  117. data/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb +5 -0
  118. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +0 -3
  119. data/lib/rails/generators/rails/resource/resource_generator.rb +2 -2
  120. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +5 -1
  121. data/lib/rails/generators/rails/scaffold/templates/scaffold.css +4 -8
  122. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +2 -3
  123. data/lib/rails/generators/rails/system_test/USAGE +10 -0
  124. data/lib/rails/generators/rails/system_test/system_test_generator.rb +7 -0
  125. data/lib/rails/generators/rails/task/task_generator.rb +1 -2
  126. data/lib/rails/generators/resource_helpers.rb +13 -10
  127. data/lib/rails/generators/test_case.rb +5 -6
  128. data/lib/rails/generators/test_unit.rb +1 -1
  129. data/lib/rails/generators/test_unit/controller/controller_generator.rb +3 -3
  130. data/lib/rails/generators/test_unit/generator/generator_generator.rb +3 -3
  131. data/lib/rails/generators/test_unit/helper/helper_generator.rb +1 -1
  132. data/lib/rails/generators/test_unit/integration/integration_generator.rb +2 -2
  133. data/lib/rails/generators/test_unit/job/job_generator.rb +3 -3
  134. data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +5 -5
  135. data/lib/rails/generators/test_unit/model/model_generator.rb +3 -4
  136. data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +2 -2
  137. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +3 -3
  138. data/lib/rails/generators/test_unit/system/system_generator.rb +17 -0
  139. data/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb +5 -0
  140. data/lib/rails/generators/test_unit/system/templates/system_test.rb +9 -0
  141. data/lib/rails/generators/testing/assertions.rb +4 -4
  142. data/lib/rails/generators/testing/behaviour.rb +20 -21
  143. data/lib/rails/info.rb +20 -20
  144. data/lib/rails/info_controller.rb +15 -15
  145. data/lib/rails/initializable.rb +6 -2
  146. data/lib/rails/mailers_controller.rb +11 -11
  147. data/lib/rails/paths.rb +4 -5
  148. data/lib/rails/plugin/test.rb +7 -0
  149. data/lib/rails/rack/logger.rb +44 -46
  150. data/lib/rails/railtie.rb +41 -38
  151. data/lib/rails/railtie/configurable.rb +6 -6
  152. data/lib/rails/railtie/configuration.rb +1 -1
  153. data/lib/rails/ruby_version_check.rb +1 -1
  154. data/lib/rails/secrets.rb +111 -0
  155. data/lib/rails/source_annotation_extractor.rb +15 -9
  156. data/lib/rails/tasks.rb +3 -2
  157. data/lib/rails/tasks/annotations.rake +3 -3
  158. data/lib/rails/tasks/dev.rake +2 -2
  159. data/lib/rails/tasks/engine.rake +4 -4
  160. data/lib/rails/tasks/framework.rake +4 -18
  161. data/lib/rails/tasks/initializers.rake +1 -1
  162. data/lib/rails/tasks/log.rake +14 -10
  163. data/lib/rails/tasks/middleware.rake +1 -1
  164. data/lib/rails/tasks/misc.rake +10 -10
  165. data/lib/rails/tasks/restart.rake +4 -4
  166. data/lib/rails/tasks/routes.rake +3 -12
  167. data/lib/rails/tasks/statistics.rake +3 -3
  168. data/lib/rails/tasks/tmp.rake +7 -7
  169. data/lib/rails/tasks/yarn.rake +11 -0
  170. data/lib/rails/templates/rails/mailers/email.html.erb +4 -1
  171. data/lib/rails/test_help.rb +28 -10
  172. data/lib/rails/test_unit/line_filtering.rb +69 -3
  173. data/lib/rails/test_unit/minitest_plugin.rb +139 -0
  174. data/lib/rails/test_unit/railtie.rb +2 -1
  175. data/lib/rails/test_unit/reporter.rb +3 -8
  176. data/lib/rails/test_unit/test_requirer.rb +28 -0
  177. data/lib/rails/test_unit/testing.rake +19 -14
  178. data/lib/rails/version.rb +1 -1
  179. data/lib/rails/welcome_controller.rb +1 -1
  180. metadata +53 -30
  181. data/lib/minitest/rails_plugin.rb +0 -49
  182. data/lib/rails/commands/application.rb +0 -17
  183. data/lib/rails/commands/commands_tasks.rb +0 -180
  184. data/lib/rails/commands/console.rb +0 -68
  185. data/lib/rails/commands/console_helper.rb +0 -34
  186. data/lib/rails/commands/dbconsole.rb +0 -173
  187. data/lib/rails/commands/destroy.rb +0 -11
  188. data/lib/rails/commands/generate.rb +0 -13
  189. data/lib/rails/commands/plugin.rb +0 -23
  190. data/lib/rails/commands/rake_proxy.rb +0 -41
  191. data/lib/rails/commands/runner.rb +0 -71
  192. data/lib/rails/commands/server.rb +0 -163
  193. data/lib/rails/commands/test.rb +0 -10
  194. data/lib/rails/engine/commands_tasks.rb +0 -118
  195. data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +0 -3
  196. data/lib/rails/rack/debugger.rb +0 -3
  197. data/lib/rails/test_unit/runner.rb +0 -141
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2016 David Heinemeier Hansson
1
+ Copyright (c) 2004-2017 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -35,17 +35,17 @@ can read more about Action Pack in its {README}[link:files/actionpack/README_rdo
35
35
 
36
36
  1. Install \Rails at the command prompt if you haven't yet:
37
37
 
38
- gem install rails
38
+ $ gem install rails
39
39
 
40
40
  2. At the command prompt, create a new \Rails application:
41
41
 
42
- rails new myapp
42
+ $ rails new myapp
43
43
 
44
44
  where "myapp" is the application name.
45
45
 
46
46
  3. Change directory to +myapp+ and start the web server:
47
47
 
48
- cd myapp; rails server
48
+ $ cd myapp; rails server
49
49
 
50
50
  Run with <tt>--help</tt> or <tt>-h</tt> for options.
51
51
 
@@ -17,7 +17,7 @@ The latest version of Railties can be installed with RubyGems:
17
17
 
18
18
  Source code can be downloaded as part of the Rails project on GitHub
19
19
 
20
- * https://github.com/rails/rails/tree/5-0-stable/railties
20
+ * https://github.com/rails/rails/tree/master/railties
21
21
 
22
22
  == License
23
23
 
data/exe/rails CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- git_path = File.expand_path('../../../.git', __FILE__)
3
+ git_path = File.expand_path("../../../.git", __FILE__)
4
4
 
5
5
  if File.exist?(git_path)
6
- railties_path = File.expand_path('../../lib', __FILE__)
6
+ railties_path = File.expand_path("../../lib", __FILE__)
7
7
  $:.unshift(railties_path)
8
8
  end
9
9
  require "rails/cli"
@@ -1,19 +1,19 @@
1
- require 'rails/ruby_version_check'
1
+ require "rails/ruby_version_check"
2
2
 
3
- require 'pathname'
3
+ require "pathname"
4
4
 
5
- require 'active_support'
6
- require 'active_support/dependencies/autoload'
7
- require 'active_support/core_ext/kernel/reporting'
8
- require 'active_support/core_ext/module/delegation'
9
- require 'active_support/core_ext/array/extract_options'
10
- require 'active_support/core_ext/object/blank'
5
+ require "active_support"
6
+ require "active_support/dependencies/autoload"
7
+ require "active_support/core_ext/kernel/reporting"
8
+ require "active_support/core_ext/module/delegation"
9
+ require "active_support/core_ext/array/extract_options"
10
+ require "active_support/core_ext/object/blank"
11
11
 
12
- require 'rails/application'
13
- require 'rails/version'
12
+ require "rails/application"
13
+ require "rails/version"
14
14
 
15
- require 'active_support/railtie'
16
- require 'action_dispatch/railtie'
15
+ require "active_support/railtie"
16
+ require "action_dispatch/railtie"
17
17
 
18
18
  # UTF-8 is the default internal and external encoding.
19
19
  silence_warnings do
@@ -47,14 +47,14 @@ module Rails
47
47
 
48
48
  def backtrace_cleaner
49
49
  @backtrace_cleaner ||= begin
50
- # Relies on Active Support, so we have to lazy load to postpone definition until AS has been loaded
51
- require 'rails/backtrace_cleaner'
50
+ # Relies on Active Support, so we have to lazy load to postpone definition until Active Support has been loaded
51
+ require "rails/backtrace_cleaner"
52
52
  Rails::BacktraceCleaner.new
53
53
  end
54
54
  end
55
55
 
56
- # Returns a Pathname object of the current rails project,
57
- # otherwise it returns nil if there is no project:
56
+ # Returns a Pathname object of the current Rails project,
57
+ # otherwise it returns +nil+ if there is no project:
58
58
  #
59
59
  # Rails.root
60
60
  # # => #<Pathname:/Users/someuser/some/path/project>
@@ -78,7 +78,7 @@ module Rails
78
78
  @_env = ActiveSupport::StringInquirer.new(environment)
79
79
  end
80
80
 
81
- # Returns all rails groups for loading based on:
81
+ # Returns all Rails groups for loading based on:
82
82
  #
83
83
  # * The Rails environment;
84
84
  # * The environment variable RAILS_GROUPS;
@@ -101,7 +101,7 @@ module Rails
101
101
  end
102
102
 
103
103
  # Returns a Pathname object of the public folder of the current
104
- # rails project, otherwise it returns nil if there is no project:
104
+ # Rails project, otherwise it returns +nil+ if there is no project:
105
105
  #
106
106
  # Rails.public_path
107
107
  # # => #<Pathname:/Users/someuser/some/path/project/public>
@@ -1,4 +1,4 @@
1
- require 'rails'
1
+ require "rails"
2
2
 
3
3
  %w(
4
4
  active_record/railtie
@@ -0,0 +1,28 @@
1
+ require "sdoc"
2
+
3
+ class RDoc::Generator::API < RDoc::Generator::SDoc # :nodoc:
4
+ RDoc::RDoc.add_generator self
5
+
6
+ def generate_class_tree_level(classes, visited = {})
7
+ # Only process core extensions on the first visit.
8
+ if visited.empty?
9
+ core_exts, classes = classes.partition { |klass| core_extension?(klass) }
10
+
11
+ super.unshift([ "Core extensions", "", "", build_core_ext_subtree(core_exts, visited) ])
12
+ else
13
+ super
14
+ end
15
+ end
16
+
17
+ private
18
+ def build_core_ext_subtree(classes, visited)
19
+ classes.map do |klass|
20
+ [ klass.name, klass.document_self_or_methods ? klass.path : "", "",
21
+ generate_class_tree_level(klass.classes_and_modules, visited) ]
22
+ end
23
+ end
24
+
25
+ def core_extension?(klass)
26
+ klass.name != "ActiveSupport" && klass.in_files.any? { |file| file.absolute_name.include?("core_ext") }
27
+ end
28
+ end
@@ -1,33 +1,33 @@
1
- require 'rdoc/task'
1
+ require "rdoc/task"
2
+ require_relative "generator"
2
3
 
3
4
  module Rails
4
5
  module API
5
6
  class Task < RDoc::Task
6
7
  RDOC_FILES = {
7
- 'activesupport' => {
8
- :include => %w(
8
+ "activesupport" => {
9
+ include: %w(
9
10
  README.rdoc
10
11
  lib/active_support/**/*.rb
11
- ),
12
- :exclude => 'lib/active_support/vendor/*'
12
+ )
13
13
  },
14
14
 
15
- 'activerecord' => {
16
- :include => %w(
15
+ "activerecord" => {
16
+ include: %w(
17
17
  README.rdoc
18
18
  lib/active_record/**/*.rb
19
19
  )
20
20
  },
21
21
 
22
- 'activemodel' => {
23
- :include => %w(
22
+ "activemodel" => {
23
+ include: %w(
24
24
  README.rdoc
25
25
  lib/active_model/**/*.rb
26
26
  )
27
27
  },
28
28
 
29
- 'actionpack' => {
30
- :include => %w(
29
+ "actionpack" => {
30
+ include: %w(
31
31
  README.rdoc
32
32
  lib/abstract_controller/**/*.rb
33
33
  lib/action_controller/**/*.rb
@@ -35,41 +35,45 @@ module Rails
35
35
  )
36
36
  },
37
37
 
38
- 'actionview' => {
39
- :include => %w(
38
+ "actionview" => {
39
+ include: %w(
40
40
  README.rdoc
41
41
  lib/action_view/**/*.rb
42
42
  ),
43
- :exclude => 'lib/action_view/vendor/*'
43
+ exclude: "lib/action_view/vendor/*"
44
44
  },
45
45
 
46
- 'actionmailer' => {
47
- :include => %w(
46
+ "actionmailer" => {
47
+ include: %w(
48
48
  README.rdoc
49
49
  lib/action_mailer/**/*.rb
50
50
  )
51
51
  },
52
52
 
53
- 'activejob' => {
54
- :include => %w(
53
+ "activejob" => {
54
+ include: %w(
55
55
  README.md
56
56
  lib/active_job/**/*.rb
57
57
  )
58
58
  },
59
59
 
60
- 'actioncable' => {
61
- :include => %w(
60
+ "actioncable" => {
61
+ include: %w(
62
62
  README.md
63
63
  lib/action_cable/**/*.rb
64
64
  )
65
65
  },
66
66
 
67
- 'railties' => {
68
- :include => %w(
67
+ "railties" => {
68
+ include: %w(
69
69
  README.rdoc
70
70
  lib/**/*.rb
71
71
  ),
72
- :exclude => 'lib/rails/generators/rails/**/templates/**/*.rb'
72
+ exclude: %w(
73
+ lib/rails/generators/**/templates/**/*.rb
74
+ lib/rails/test_unit/*
75
+ lib/rails/api/generator.rb
76
+ )
73
77
  }
74
78
  }
75
79
 
@@ -80,7 +84,7 @@ module Rails
80
84
  # Be lazy computing stuff to have as light impact as possible to
81
85
  # the rest of tasks.
82
86
  before_running_rdoc do
83
- load_and_configure_sdoc
87
+ configure_sdoc
84
88
  configure_rdoc_files
85
89
  setup_horo_variables
86
90
  end
@@ -91,20 +95,15 @@ module Rails
91
95
  # no-op
92
96
  end
93
97
 
94
- def load_and_configure_sdoc
95
- require 'sdoc'
96
-
97
- self.title = 'Ruby on Rails API'
98
+ def configure_sdoc
99
+ self.title = "Ruby on Rails API"
98
100
  self.rdoc_dir = api_dir
99
101
 
100
- options << '-m' << api_main
101
- options << '-e' << 'UTF-8'
102
+ options << "-m" << api_main
103
+ options << "-e" << "UTF-8"
102
104
 
103
- options << '-f' << 'sdoc'
104
- options << '-T' << 'rails'
105
- rescue LoadError
106
- $stderr.puts %(Unable to load SDoc, please add\n\n gem 'sdoc', require: false\n\nto the Gemfile.)
107
- exit 1
105
+ options << "-f" << "api"
106
+ options << "-T" << "rails"
108
107
  end
109
108
 
110
109
  def configure_rdoc_files
@@ -121,22 +120,35 @@ module Rails
121
120
  rdoc_files.exclude("#{cdr}/#{pattern}")
122
121
  end
123
122
  end
123
+
124
+ # Only generate documentation for files that have been
125
+ # changed since the API was generated.
126
+ if Dir.exist?("doc/rdoc") && !ENV["ALL"]
127
+ last_generation = DateTime.rfc2822(File.open("doc/rdoc/created.rid", &:readline))
128
+
129
+ rdoc_files.keep_if do |file|
130
+ File.mtime(file).to_datetime > last_generation
131
+ end
132
+
133
+ # Nothing to do
134
+ exit(0) if rdoc_files.empty?
135
+ end
124
136
  end
125
137
 
126
138
  def setup_horo_variables
127
- ENV['HORO_PROJECT_NAME'] = 'Ruby on Rails'
128
- ENV['HORO_PROJECT_VERSION'] = rails_version
139
+ ENV["HORO_PROJECT_NAME"] = "Ruby on Rails"
140
+ ENV["HORO_PROJECT_VERSION"] = rails_version
129
141
  end
130
142
 
131
143
  def api_main
132
- component_root_dir('railties') + '/RDOC_MAIN.rdoc'
144
+ component_root_dir("railties") + "/RDOC_MAIN.rdoc"
133
145
  end
134
146
  end
135
147
 
136
148
  class RepoTask < Task
137
- def load_and_configure_sdoc
149
+ def configure_sdoc
138
150
  super
139
- options << '-g' # link to GitHub, SDoc flag
151
+ options << "-g" # link to GitHub, SDoc flag
140
152
  end
141
153
 
142
154
  def component_root_dir(component)
@@ -144,7 +156,7 @@ module Rails
144
156
  end
145
157
 
146
158
  def api_dir
147
- 'doc/rdoc'
159
+ "doc/rdoc"
148
160
  end
149
161
  end
150
162
 
@@ -156,7 +168,7 @@ module Rails
156
168
 
157
169
  class StableTask < RepoTask
158
170
  def rails_version
159
- File.read('RAILS_VERSION').strip
171
+ File.read("RAILS_VERSION").strip
160
172
  end
161
173
  end
162
174
  end
@@ -1,12 +1,12 @@
1
- require 'pathname'
2
- require 'rails/version'
1
+ require "pathname"
2
+ require "rails/version"
3
3
 
4
4
  module Rails
5
5
  module AppLoader # :nodoc:
6
6
  extend self
7
7
 
8
8
  RUBY = Gem.ruby
9
- EXECUTABLES = ['bin/rails', 'script/rails']
9
+ EXECUTABLES = ["bin/rails", "script/rails"]
10
10
  BUNDLER_WARNING = <<EOS
11
11
  Looks like your app's ./bin/rails is a stub that was generated by Bundler.
12
12
 
@@ -39,21 +39,21 @@ EOS
39
39
  if contents =~ /(APP|ENGINE)_PATH/
40
40
  exec RUBY, exe, *ARGV
41
41
  break # non reachable, hack to be able to stub exec in the test suite
42
- elsif exe.end_with?('bin/rails') && contents.include?('This file was generated by Bundler')
42
+ elsif exe.end_with?("bin/rails") && contents.include?("This file was generated by Bundler")
43
43
  $stderr.puts(BUNDLER_WARNING)
44
- Object.const_set(:APP_PATH, File.expand_path('config/application', Dir.pwd))
45
- require File.expand_path('../boot', APP_PATH)
46
- require 'rails/commands'
44
+ Object.const_set(:APP_PATH, File.expand_path("config/application", Dir.pwd))
45
+ require File.expand_path("../boot", APP_PATH)
46
+ require "rails/commands"
47
47
  break
48
48
  end
49
49
  end
50
50
 
51
51
  # If we exhaust the search there is no executable, this could be a
52
52
  # call to generate a new application, so restore the original cwd.
53
- Dir.chdir(original_cwd) and return if Pathname.new(Dir.pwd).root?
53
+ Dir.chdir(original_cwd) && return if Pathname.new(Dir.pwd).root?
54
54
 
55
55
  # Otherwise keep moving upwards in search of an executable.
56
- Dir.chdir('..')
56
+ Dir.chdir("..")
57
57
  end
58
58
  end
59
59
 
@@ -1,9 +1,10 @@
1
- require 'yaml'
2
- require 'active_support/core_ext/hash/keys'
3
- require 'active_support/core_ext/object/blank'
4
- require 'active_support/key_generator'
5
- require 'active_support/message_verifier'
6
- require 'rails/engine'
1
+ require "yaml"
2
+ require "active_support/core_ext/hash/keys"
3
+ require "active_support/core_ext/object/blank"
4
+ require "active_support/key_generator"
5
+ require "active_support/message_verifier"
6
+ require "rails/engine"
7
+ require "rails/secrets"
7
8
 
8
9
  module Rails
9
10
  # An Engine with the responsibility of coordinating the whole boot process.
@@ -72,15 +73,15 @@ module Rails
72
73
  # on one of the applications to create a copy of the application which shares
73
74
  # the configuration.
74
75
  #
75
- # If you decide to define rake tasks, runners, or initializers in an
76
+ # If you decide to define Rake tasks, runners, or initializers in an
76
77
  # application other than +Rails.application+, then you must run them manually.
77
78
  class Application < Engine
78
- autoload :Bootstrap, 'rails/application/bootstrap'
79
- autoload :Configuration, 'rails/application/configuration'
80
- autoload :DefaultMiddlewareStack, 'rails/application/default_middleware_stack'
81
- autoload :Finisher, 'rails/application/finisher'
82
- autoload :Railties, 'rails/engine/railties'
83
- autoload :RoutesReloader, 'rails/application/routes_reloader'
79
+ autoload :Bootstrap, "rails/application/bootstrap"
80
+ autoload :Configuration, "rails/application/configuration"
81
+ autoload :DefaultMiddlewareStack, "rails/application/default_middleware_stack"
82
+ autoload :Finisher, "rails/application/finisher"
83
+ autoload :Railties, "rails/engine/railties"
84
+ autoload :RoutesReloader, "rails/application/routes_reloader"
84
85
 
85
86
  class << self
86
87
  def inherited(base)
@@ -265,8 +266,8 @@ module Rails
265
266
  end
266
267
  end
267
268
 
268
- # If you try to define a set of rake tasks on the instance, these will get
269
- # passed up to the rake tasks defined on the application's class.
269
+ # If you try to define a set of Rake tasks on the instance, these will get
270
+ # passed up to the Rake tasks defined on the application's class.
270
271
  def rake_tasks(&block)
271
272
  self.class.rake_tasks(&block)
272
273
  end
@@ -274,7 +275,7 @@ module Rails
274
275
  # Sends the initializers to the +initializer+ method defined in the
275
276
  # Rails::Initializable module. Each Rails::Application class has its own
276
277
  # set of initializers, as defined by the Initializable module.
277
- def initializer(name, opts={}, &block)
278
+ def initializer(name, opts = {}, &block)
278
279
  self.class.initializer(name, opts, &block)
279
280
  end
280
281
 
@@ -317,7 +318,7 @@ module Rails
317
318
  # Rails application, you will need to add lib to $LOAD_PATH on your own in case
318
319
  # you need to load files in lib/ during the application configuration as well.
319
320
  def self.add_lib_to_load_path!(root) #:nodoc:
320
- path = File.join root, 'lib'
321
+ path = File.join root, "lib"
321
322
  if File.exist?(path) && !$LOAD_PATH.include?(path)
322
323
  $LOAD_PATH.unshift(path)
323
324
  end
@@ -347,7 +348,7 @@ module Rails
347
348
 
348
349
  # Initialize the application passing the given group. By default, the
349
350
  # group is :default
350
- def initialize!(group=:default) #:nodoc:
351
+ def initialize!(group = :default) #:nodoc:
351
352
  raise "Application has been already initialized." if @initialized
352
353
  run_initializers(group, self)
353
354
  @initialized = true
@@ -385,13 +386,7 @@ module Rails
385
386
  def secrets
386
387
  @secrets ||= begin
387
388
  secrets = ActiveSupport::OrderedOptions.new
388
- yaml = config.paths["config/secrets"].first
389
- if File.exist?(yaml)
390
- require "erb"
391
- all_secrets = YAML.load(ERB.new(IO.read(yaml)).result) || {}
392
- env_secrets = all_secrets[Rails.env]
393
- secrets.merge!(env_secrets.symbolize_keys) if env_secrets
394
- end
389
+ secrets.merge! Rails::Secrets.parse(config.paths["config/secrets"].existent, env: Rails.env)
395
390
 
396
391
  # Fallback to config.secret_key_base if secrets.secret_key_base isn't set
397
392
  secrets.secret_key_base ||= config.secret_key_base
@@ -506,7 +501,7 @@ module Rails
506
501
 
507
502
  def validate_secret_key_config! #:nodoc:
508
503
  if secrets.secret_key_base.blank?
509
- ActiveSupport::Deprecation.warn "You didn't set `secret_key_base`. " +
504
+ ActiveSupport::Deprecation.warn "You didn't set `secret_key_base`. " \
510
505
  "Read the upgrade documentation to learn more about this new config option."
511
506
 
512
507
  if secrets.secret_token.blank?
@@ -517,15 +512,15 @@ module Rails
517
512
 
518
513
  private
519
514
 
520
- def build_request(env)
521
- req = super
522
- env["ORIGINAL_FULLPATH"] = req.fullpath
523
- env["ORIGINAL_SCRIPT_NAME"] = req.script_name
524
- req
525
- end
515
+ def build_request(env)
516
+ req = super
517
+ env["ORIGINAL_FULLPATH"] = req.fullpath
518
+ env["ORIGINAL_SCRIPT_NAME"] = req.script_name
519
+ req
520
+ end
526
521
 
527
- def build_middleware
528
- config.app_middleware + super
529
- end
522
+ def build_middleware
523
+ config.app_middleware + super
524
+ end
530
525
  end
531
526
  end