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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +77 -567
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.rdoc +3 -3
- data/README.rdoc +1 -1
- data/exe/rails +2 -2
- data/lib/rails.rb +18 -18
- data/lib/rails/all.rb +1 -1
- data/lib/rails/api/generator.rb +28 -0
- data/lib/rails/api/task.rb +54 -42
- data/lib/rails/app_loader.rb +9 -9
- data/lib/rails/application.rb +30 -35
- data/lib/rails/application/bootstrap.rb +13 -7
- data/lib/rails/application/configuration.rb +30 -53
- data/lib/rails/application/default_middleware_stack.rb +3 -5
- data/lib/rails/application/finisher.rb +16 -7
- data/lib/rails/application/routes_reloader.rb +16 -1
- data/lib/rails/application_controller.rb +10 -10
- data/lib/rails/backtrace_cleaner.rb +5 -5
- data/lib/rails/cli.rb +7 -5
- data/lib/rails/code_statistics.rb +16 -17
- data/lib/rails/code_statistics_calculator.rb +3 -3
- data/lib/rails/command.rb +111 -0
- data/lib/rails/command/actions.rb +42 -0
- data/lib/rails/command/base.rb +149 -0
- data/lib/rails/command/behavior.rb +123 -0
- data/lib/rails/command/environment_argument.rb +34 -0
- data/lib/rails/commands.rb +2 -4
- data/lib/rails/commands/application/application_command.rb +29 -0
- data/lib/rails/commands/console/console_command.rb +89 -0
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +155 -0
- data/lib/rails/commands/destroy/destroy_command.rb +21 -0
- data/lib/rails/commands/generate/generate_command.rb +23 -0
- data/lib/rails/commands/help/USAGE +15 -0
- data/lib/rails/commands/help/help_command.rb +13 -0
- data/lib/rails/commands/new/new_command.rb +15 -0
- data/lib/rails/commands/plugin/plugin_command.rb +43 -0
- data/lib/rails/commands/rake/rake_command.rb +49 -0
- data/lib/rails/commands/runner/USAGE +17 -0
- data/lib/rails/commands/runner/runner_command.rb +46 -0
- data/lib/rails/commands/secrets/USAGE +52 -0
- data/lib/rails/commands/secrets/secrets_command.rb +36 -0
- data/lib/rails/commands/server/server_command.rb +177 -0
- data/lib/rails/commands/test/test_command.rb +20 -0
- data/lib/rails/commands/version/version_command.rb +9 -0
- data/lib/rails/configuration.rb +7 -7
- data/lib/rails/console/app.rb +4 -4
- data/lib/rails/dev_caching.rb +8 -8
- data/lib/rails/engine.rb +62 -63
- data/lib/rails/engine/commands.rb +6 -13
- data/lib/rails/engine/configuration.rb +2 -2
- data/lib/rails/gem_version.rb +3 -3
- data/lib/rails/generators.rb +229 -313
- data/lib/rails/generators/actions.rb +20 -21
- data/lib/rails/generators/actions/create_migration.rb +24 -25
- data/lib/rails/generators/active_model.rb +3 -3
- data/lib/rails/generators/app_base.rb +123 -93
- data/lib/rails/generators/base.rb +32 -33
- data/lib/rails/generators/css/assets/assets_generator.rb +1 -1
- data/lib/rails/generators/erb.rb +14 -14
- data/lib/rails/generators/erb/controller/controller_generator.rb +1 -1
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +12 -12
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +3 -3
- data/lib/rails/generators/generated_attribute.rb +27 -27
- data/lib/rails/generators/js/assets/assets_generator.rb +1 -1
- data/lib/rails/generators/migration.rb +8 -8
- data/lib/rails/generators/model_helpers.rb +2 -2
- data/lib/rails/generators/named_base.rb +56 -56
- data/lib/rails/generators/rails/app/app_generator.rb +98 -81
- data/lib/rails/generators/rails/app/templates/Gemfile +7 -2
- data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -2
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +6 -4
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.js +1 -1
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +2 -2
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/bin/{setup → setup.tt} +6 -0
- data/lib/rails/generators/rails/app/templates/bin/{update → update.tt} +2 -1
- data/lib/rails/generators/rails/app/templates/bin/yarn +9 -0
- data/lib/rails/generators/rails/app/templates/config/cable.yml +1 -0
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +1 -0
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +1 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +1 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +2 -1
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +1 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +1 -0
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -0
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +10 -1
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb +4 -6
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +8 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt +6 -5
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +10 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb +16 -7
- data/lib/rails/generators/rails/app/templates/config/secrets.yml +12 -2
- data/lib/rails/generators/rails/app/templates/gitignore +5 -1
- data/lib/rails/generators/rails/app/templates/package.json +5 -0
- data/lib/rails/generators/rails/app/templates/public/404.html +6 -6
- data/lib/rails/generators/rails/app/templates/public/422.html +6 -6
- data/lib/rails/generators/rails/app/templates/public/500.html +6 -6
- data/lib/rails/generators/rails/app/templates/public/robots.txt +0 -4
- data/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb +5 -0
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb +0 -1
- data/lib/rails/generators/rails/assets/assets_generator.rb +10 -10
- data/lib/rails/generators/rails/controller/controller_generator.rb +15 -12
- data/lib/rails/generators/rails/encrypted_secrets/encrypted_secrets_generator.rb +66 -0
- data/lib/rails/generators/rails/encrypted_secrets/templates/config/secrets.yml.enc +3 -0
- data/lib/rails/generators/rails/generator/generator_generator.rb +2 -3
- data/lib/rails/generators/rails/helper/helper_generator.rb +1 -1
- data/lib/rails/generators/rails/model/model_generator.rb +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +21 -26
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -0
- data/lib/rails/generators/rails/plugin/templates/bin/test.tt +3 -9
- data/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb +5 -0
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +0 -3
- data/lib/rails/generators/rails/resource/resource_generator.rb +2 -2
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +5 -1
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +4 -8
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +2 -3
- data/lib/rails/generators/rails/system_test/USAGE +10 -0
- data/lib/rails/generators/rails/system_test/system_test_generator.rb +7 -0
- data/lib/rails/generators/rails/task/task_generator.rb +1 -2
- data/lib/rails/generators/resource_helpers.rb +13 -10
- data/lib/rails/generators/test_case.rb +5 -6
- data/lib/rails/generators/test_unit.rb +1 -1
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +3 -3
- data/lib/rails/generators/test_unit/generator/generator_generator.rb +3 -3
- data/lib/rails/generators/test_unit/helper/helper_generator.rb +1 -1
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +2 -2
- data/lib/rails/generators/test_unit/job/job_generator.rb +3 -3
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +5 -5
- data/lib/rails/generators/test_unit/model/model_generator.rb +3 -4
- data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +3 -3
- data/lib/rails/generators/test_unit/system/system_generator.rb +17 -0
- data/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb +5 -0
- data/lib/rails/generators/test_unit/system/templates/system_test.rb +9 -0
- data/lib/rails/generators/testing/assertions.rb +4 -4
- data/lib/rails/generators/testing/behaviour.rb +20 -21
- data/lib/rails/info.rb +20 -20
- data/lib/rails/info_controller.rb +15 -15
- data/lib/rails/initializable.rb +6 -2
- data/lib/rails/mailers_controller.rb +11 -11
- data/lib/rails/paths.rb +4 -5
- data/lib/rails/plugin/test.rb +7 -0
- data/lib/rails/rack/logger.rb +44 -46
- data/lib/rails/railtie.rb +41 -38
- data/lib/rails/railtie/configurable.rb +6 -6
- data/lib/rails/railtie/configuration.rb +1 -1
- data/lib/rails/ruby_version_check.rb +1 -1
- data/lib/rails/secrets.rb +111 -0
- data/lib/rails/source_annotation_extractor.rb +15 -9
- data/lib/rails/tasks.rb +3 -2
- data/lib/rails/tasks/annotations.rake +3 -3
- data/lib/rails/tasks/dev.rake +2 -2
- data/lib/rails/tasks/engine.rake +4 -4
- data/lib/rails/tasks/framework.rake +4 -18
- data/lib/rails/tasks/initializers.rake +1 -1
- data/lib/rails/tasks/log.rake +14 -10
- data/lib/rails/tasks/middleware.rake +1 -1
- data/lib/rails/tasks/misc.rake +10 -10
- data/lib/rails/tasks/restart.rake +4 -4
- data/lib/rails/tasks/routes.rake +3 -12
- data/lib/rails/tasks/statistics.rake +3 -3
- data/lib/rails/tasks/tmp.rake +7 -7
- data/lib/rails/tasks/yarn.rake +11 -0
- data/lib/rails/templates/rails/mailers/email.html.erb +4 -1
- data/lib/rails/test_help.rb +28 -10
- data/lib/rails/test_unit/line_filtering.rb +69 -3
- data/lib/rails/test_unit/minitest_plugin.rb +139 -0
- data/lib/rails/test_unit/railtie.rb +2 -1
- data/lib/rails/test_unit/reporter.rb +3 -8
- data/lib/rails/test_unit/test_requirer.rb +28 -0
- data/lib/rails/test_unit/testing.rake +19 -14
- data/lib/rails/version.rb +1 -1
- data/lib/rails/welcome_controller.rb +1 -1
- metadata +53 -30
- data/lib/minitest/rails_plugin.rb +0 -49
- data/lib/rails/commands/application.rb +0 -17
- data/lib/rails/commands/commands_tasks.rb +0 -180
- data/lib/rails/commands/console.rb +0 -68
- data/lib/rails/commands/console_helper.rb +0 -34
- data/lib/rails/commands/dbconsole.rb +0 -173
- data/lib/rails/commands/destroy.rb +0 -11
- data/lib/rails/commands/generate.rb +0 -13
- data/lib/rails/commands/plugin.rb +0 -23
- data/lib/rails/commands/rake_proxy.rb +0 -41
- data/lib/rails/commands/runner.rb +0 -71
- data/lib/rails/commands/server.rb +0 -163
- data/lib/rails/commands/test.rb +0 -10
- data/lib/rails/engine/commands_tasks.rb +0 -118
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +0 -3
- data/lib/rails/rack/debugger.rb +0 -3
- data/lib/rails/test_unit/runner.rb +0 -141
data/MIT-LICENSE
CHANGED
data/RDOC_MAIN.rdoc
CHANGED
@@ -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
|
|
data/README.rdoc
CHANGED
@@ -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/
|
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(
|
3
|
+
git_path = File.expand_path("../../../.git", __FILE__)
|
4
4
|
|
5
5
|
if File.exist?(git_path)
|
6
|
-
railties_path = File.expand_path(
|
6
|
+
railties_path = File.expand_path("../../lib", __FILE__)
|
7
7
|
$:.unshift(railties_path)
|
8
8
|
end
|
9
9
|
require "rails/cli"
|
data/lib/rails.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
require
|
1
|
+
require "rails/ruby_version_check"
|
2
2
|
|
3
|
-
require
|
3
|
+
require "pathname"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
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
|
13
|
-
require
|
12
|
+
require "rails/application"
|
13
|
+
require "rails/version"
|
14
14
|
|
15
|
-
require
|
16
|
-
require
|
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
|
51
|
-
require
|
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
|
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
|
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
|
-
#
|
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>
|
data/lib/rails/all.rb
CHANGED
@@ -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
|
data/lib/rails/api/task.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
require
|
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
|
-
|
8
|
-
:
|
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
|
-
|
16
|
-
:
|
15
|
+
"activerecord" => {
|
16
|
+
include: %w(
|
17
17
|
README.rdoc
|
18
18
|
lib/active_record/**/*.rb
|
19
19
|
)
|
20
20
|
},
|
21
21
|
|
22
|
-
|
23
|
-
:
|
22
|
+
"activemodel" => {
|
23
|
+
include: %w(
|
24
24
|
README.rdoc
|
25
25
|
lib/active_model/**/*.rb
|
26
26
|
)
|
27
27
|
},
|
28
28
|
|
29
|
-
|
30
|
-
:
|
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
|
-
|
39
|
-
:
|
38
|
+
"actionview" => {
|
39
|
+
include: %w(
|
40
40
|
README.rdoc
|
41
41
|
lib/action_view/**/*.rb
|
42
42
|
),
|
43
|
-
:
|
43
|
+
exclude: "lib/action_view/vendor/*"
|
44
44
|
},
|
45
45
|
|
46
|
-
|
47
|
-
:
|
46
|
+
"actionmailer" => {
|
47
|
+
include: %w(
|
48
48
|
README.rdoc
|
49
49
|
lib/action_mailer/**/*.rb
|
50
50
|
)
|
51
51
|
},
|
52
52
|
|
53
|
-
|
54
|
-
:
|
53
|
+
"activejob" => {
|
54
|
+
include: %w(
|
55
55
|
README.md
|
56
56
|
lib/active_job/**/*.rb
|
57
57
|
)
|
58
58
|
},
|
59
59
|
|
60
|
-
|
61
|
-
:
|
60
|
+
"actioncable" => {
|
61
|
+
include: %w(
|
62
62
|
README.md
|
63
63
|
lib/action_cable/**/*.rb
|
64
64
|
)
|
65
65
|
},
|
66
66
|
|
67
|
-
|
68
|
-
:
|
67
|
+
"railties" => {
|
68
|
+
include: %w(
|
69
69
|
README.rdoc
|
70
70
|
lib/**/*.rb
|
71
71
|
),
|
72
|
-
:
|
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
|
-
|
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
|
95
|
-
|
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 <<
|
101
|
-
options <<
|
102
|
+
options << "-m" << api_main
|
103
|
+
options << "-e" << "UTF-8"
|
102
104
|
|
103
|
-
options <<
|
104
|
-
options <<
|
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[
|
128
|
-
ENV[
|
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(
|
144
|
+
component_root_dir("railties") + "/RDOC_MAIN.rdoc"
|
133
145
|
end
|
134
146
|
end
|
135
147
|
|
136
148
|
class RepoTask < Task
|
137
|
-
def
|
149
|
+
def configure_sdoc
|
138
150
|
super
|
139
|
-
options <<
|
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
|
-
|
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(
|
171
|
+
File.read("RAILS_VERSION").strip
|
160
172
|
end
|
161
173
|
end
|
162
174
|
end
|
data/lib/rails/app_loader.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
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 = [
|
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?(
|
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(
|
45
|
-
require File.expand_path(
|
46
|
-
require
|
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)
|
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
|
|
data/lib/rails/application.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
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
|
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,
|
79
|
-
autoload :Configuration,
|
80
|
-
autoload :DefaultMiddlewareStack,
|
81
|
-
autoload :Finisher,
|
82
|
-
autoload :Railties,
|
83
|
-
autoload :RoutesReloader,
|
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
|
269
|
-
# passed up to the
|
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,
|
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
|
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
|
-
|
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
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
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
|
-
|
528
|
-
|
529
|
-
|
522
|
+
def build_middleware
|
523
|
+
config.app_middleware + super
|
524
|
+
end
|
530
525
|
end
|
531
526
|
end
|