railties 4.2.11.3 → 5.0.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 +262 -206
- data/MIT-LICENSE +20 -0
- data/README.rdoc +1 -1
- data/{bin → exe}/rails +0 -0
- data/lib/rails.rb +19 -1
- data/lib/rails/all.rb +10 -9
- data/lib/rails/api/task.rb +7 -14
- data/lib/rails/{app_rails_loader.rb → app_loader.rb} +4 -3
- data/lib/rails/application.rb +31 -41
- data/lib/rails/application/bootstrap.rb +1 -14
- data/lib/rails/application/configuration.rb +94 -95
- data/lib/rails/application/default_middleware_stack.rb +30 -16
- data/lib/rails/application/finisher.rb +11 -2
- data/lib/rails/application/routes_reloader.rb +1 -3
- data/lib/rails/application_controller.rb +1 -1
- data/lib/rails/cli.rb +2 -2
- data/lib/rails/code_statistics.rb +6 -8
- data/lib/rails/code_statistics_calculator.rb +8 -1
- data/lib/rails/command.rb +70 -0
- data/lib/rails/commands.rb +5 -3
- data/lib/rails/commands/commands_tasks.rb +25 -14
- data/lib/rails/commands/console.rb +7 -52
- data/lib/rails/commands/console_helper.rb +34 -0
- data/lib/rails/commands/dbconsole.rb +59 -78
- data/lib/rails/commands/dev_cache.rb +21 -0
- data/lib/rails/commands/plugin.rb +1 -1
- data/lib/rails/commands/rake_proxy.rb +34 -0
- data/lib/rails/commands/runner.rb +0 -1
- data/lib/rails/commands/server.rb +29 -36
- data/lib/rails/commands/test.rb +9 -0
- data/lib/rails/configuration.rb +21 -5
- data/lib/rails/console/app.rb +5 -0
- data/lib/rails/console/helpers.rb +1 -1
- data/lib/rails/engine.rb +68 -58
- data/lib/rails/engine/commands.rb +4 -2
- data/lib/rails/engine/configuration.rb +4 -10
- data/lib/rails/gem_version.rb +4 -4
- data/lib/rails/generators.rb +30 -7
- data/lib/rails/generators/.named_base.rb.swp +0 -0
- data/lib/rails/generators/actions.rb +19 -5
- data/lib/rails/generators/app_base.rb +65 -45
- data/lib/rails/generators/base.rb +6 -6
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +5 -8
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +9 -7
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +1 -1
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +2 -2
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb +1 -1
- data/lib/rails/generators/generated_attribute.rb +5 -1
- data/lib/rails/generators/migration.rb +7 -7
- data/lib/rails/generators/named_base.rb +21 -5
- data/lib/rails/generators/rails/app/USAGE +0 -1
- data/lib/rails/generators/rails/app/app_generator.rb +75 -11
- data/lib/rails/generators/rails/app/templates/Gemfile +17 -13
- data/lib/rails/generators/rails/app/templates/{README.rdoc → README.md} +1 -5
- data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +7 -0
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.coffee +11 -0
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +3 -3
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/channel.rb +5 -0
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb +5 -0
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb +2 -0
- data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb +4 -0
- data/lib/rails/generators/rails/app/templates/app/models/application_record.rb +3 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +20 -17
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +13 -0
- data/lib/rails/generators/{erb/mailer/templates/layout.text.erb → rails/app/templates/app/views/layouts/mailer.text.erb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/bin/setup +17 -12
- data/lib/rails/generators/rails/app/templates/bin/update +28 -0
- data/lib/rails/generators/rails/app/templates/config.ru.tt +11 -0
- data/lib/rails/generators/rails/app/templates/config/application.rb +9 -14
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +2 -2
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +20 -3
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +18 -11
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +7 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/active_record_belongs_to_required_by_default.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb +6 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/callback_terminator.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb +1 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb +16 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/request_forgery_protection.rb +4 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/redis/cable.yml +9 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb +3 -53
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +3 -3
- data/lib/rails/generators/rails/app/templates/gitignore +7 -1
- data/lib/rails/generators/rails/controller/controller_generator.rb +6 -4
- data/lib/rails/generators/rails/migration/migration_generator.rb +1 -1
- data/lib/rails/generators/rails/model/USAGE +6 -1
- data/lib/rails/generators/rails/model/model_generator.rb +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +88 -35
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec +6 -9
- data/lib/rails/generators/rails/plugin/templates/Gemfile +3 -7
- data/lib/rails/generators/rails/plugin/templates/README.md +3 -0
- data/lib/rails/generators/rails/plugin/templates/Rakefile +2 -2
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +5 -0
- data/lib/rails/generators/rails/plugin/templates/app/helpers/%namespaced_name%/application_helper.rb.tt +5 -0
- data/lib/rails/generators/rails/plugin/templates/app/jobs/%namespaced_name%/application_job.rb.tt +5 -0
- data/lib/rails/generators/rails/plugin/templates/app/models/application_record.rb.tt +6 -0
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +14 -0
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/test.tt +8 -0
- data/lib/rails/generators/rails/plugin/templates/config/routes.rb +1 -1
- data/lib/rails/generators/rails/plugin/templates/gitignore +2 -3
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb +5 -0
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb +7 -0
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb +1 -0
- data/lib/rails/generators/rails/plugin/templates/lib/tasks/{%name%_tasks.rake → %namespaced_name%_tasks.rake} +1 -1
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb +3 -3
- data/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js +11 -0
- data/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js +6 -0
- data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +1 -1
- data/lib/rails/generators/rails/plugin/templates/rails/routes.rb +1 -2
- data/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +3 -3
- data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb +7 -0
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +4 -2
- data/lib/rails/generators/rails/resource/resource_generator.rb +0 -1
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +0 -1
- data/lib/rails/generators/rails/scaffold/USAGE +1 -1
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -1
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +35 -7
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +4 -1
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb +61 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +1 -1
- data/lib/rails/generators/resource_helpers.rb +3 -3
- data/lib/rails/generators/test_unit/controller/templates/.functional_test.rb.swp +0 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +3 -5
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +8 -3
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +2 -2
- data/lib/rails/generators/test_unit/mailer/templates/preview.rb +4 -4
- data/lib/rails/generators/test_unit/model/model_generator.rb +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml +2 -0
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +5 -1
- data/lib/rails/generators/test_unit/scaffold/templates/.api_functional_test.rb.swp +0 -0
- data/lib/rails/generators/test_unit/scaffold/templates/.functional_test.rb.swp +0 -0
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb +44 -0
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +14 -14
- data/lib/rails/generators/testing/assertions.rb +0 -2
- data/lib/rails/generators/testing/behaviour.rb +4 -17
- data/lib/rails/info.rb +2 -2
- data/lib/rails/info_controller.rb +23 -2
- data/lib/rails/mailers_controller.rb +2 -2
- data/lib/rails/paths.rb +14 -6
- data/lib/rails/rack.rb +1 -3
- data/lib/rails/rack/debugger.rb +2 -23
- data/lib/rails/rack/logger.rb +4 -0
- data/lib/rails/ruby_version_check.rb +3 -3
- data/lib/rails/source_annotation_extractor.rb +1 -1
- data/lib/rails/tasks.rb +4 -1
- data/lib/rails/tasks/engine.rake +1 -1
- data/lib/rails/tasks/framework.rake +18 -16
- data/lib/rails/tasks/initializers.rake +6 -0
- data/lib/rails/tasks/restart.rake +5 -0
- data/lib/rails/tasks/statistics.rake +5 -6
- data/lib/rails/tasks/tmp.rake +4 -12
- data/lib/rails/templates/rails/mailers/email.html.erb +17 -3
- data/lib/rails/templates/rails/welcome/index.html.erb +10 -3
- data/lib/rails/test_help.rb +7 -8
- data/lib/rails/test_unit/minitest_plugin.rb +91 -0
- data/lib/rails/test_unit/reporter.rb +74 -0
- data/lib/rails/test_unit/test_requirer.rb +28 -0
- data/lib/rails/test_unit/testing.rake +18 -39
- metadata +80 -33
- data/lib/rails/deprecation.rb +0 -19
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb +0 -5
- data/lib/rails/generators/rails/app/templates/config.ru +0 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/to_time_preserves_timezone.rb +0 -10
- data/lib/rails/generators/rails/plugin/templates/README.rdoc +0 -3
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%name%/application_controller.rb.tt +0 -5
- data/lib/rails/generators/rails/plugin/templates/app/helpers/%name%/application_helper.rb.tt +0 -4
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%name%/application.html.erb.tt +0 -14
- data/lib/rails/generators/rails/plugin/templates/lib/%name%.rb +0 -6
- data/lib/rails/generators/rails/plugin/templates/lib/%name%/engine.rb +0 -7
- data/lib/rails/generators/rails/plugin/templates/lib/%name%/version.rb +0 -3
- data/lib/rails/generators/rails/plugin/templates/test/%name%_test.rb +0 -7
- data/lib/rails/rack/log_tailer.rb +0 -38
- data/lib/rails/tasks/documentation.rake +0 -70
- data/lib/rails/test_unit/sub_test_task.rb +0 -126
@@ -1,70 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'rdoc/task'
|
3
|
-
rescue LoadError
|
4
|
-
# Rubinius installs RDoc as a gem, and for this interpreter "rdoc/task" is
|
5
|
-
# available only if the application bundle includes "rdoc" (normally as a
|
6
|
-
# dependency of the "sdoc" gem.)
|
7
|
-
#
|
8
|
-
# If RDoc is not available it is fine that we do not generate the tasks that
|
9
|
-
# depend on it. Just be robust to this gotcha and go on.
|
10
|
-
else
|
11
|
-
require 'rails/api/task'
|
12
|
-
|
13
|
-
# Monkey-patch to remove redoc'ing and clobber descriptions to cut down on rake -T noise
|
14
|
-
class RDocTaskWithoutDescriptions < RDoc::Task
|
15
|
-
include ::Rake::DSL
|
16
|
-
|
17
|
-
def define
|
18
|
-
task rdoc_task_name
|
19
|
-
|
20
|
-
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
|
21
|
-
|
22
|
-
task clobber_task_name do
|
23
|
-
rm_r rdoc_dir rescue nil
|
24
|
-
end
|
25
|
-
|
26
|
-
task :clobber => [clobber_task_name]
|
27
|
-
|
28
|
-
directory @rdoc_dir
|
29
|
-
task rdoc_task_name => [rdoc_target]
|
30
|
-
file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
|
31
|
-
rm_r @rdoc_dir rescue nil
|
32
|
-
@before_running_rdoc.call if @before_running_rdoc
|
33
|
-
args = option_list + @rdoc_files
|
34
|
-
if @external
|
35
|
-
argstring = args.join(' ')
|
36
|
-
sh %{ruby -Ivendor vendor/rd #{argstring}}
|
37
|
-
else
|
38
|
-
require 'rdoc/rdoc'
|
39
|
-
RDoc::RDoc.new.document(args)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
self
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
namespace :doc do
|
47
|
-
RDocTaskWithoutDescriptions.new("app") { |rdoc|
|
48
|
-
rdoc.rdoc_dir = 'doc/app'
|
49
|
-
rdoc.template = ENV['template'] if ENV['template']
|
50
|
-
rdoc.title = ENV['title'] || "Rails Application Documentation"
|
51
|
-
rdoc.options << '--line-numbers'
|
52
|
-
rdoc.options << '--charset' << 'utf-8'
|
53
|
-
rdoc.rdoc_files.include('README.rdoc')
|
54
|
-
rdoc.rdoc_files.include('app/**/*.rb')
|
55
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
-
}
|
57
|
-
Rake::Task['doc:app'].comment = "Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE=\"Custom Title\")"
|
58
|
-
|
59
|
-
# desc 'Generate documentation for the Rails framework.'
|
60
|
-
Rails::API::AppTask.new('rails')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
namespace :doc do
|
65
|
-
task :guides do
|
66
|
-
rails_gem_dir = Gem::Specification.find_by_name("rails").gem_dir
|
67
|
-
require File.expand_path(File.join(rails_gem_dir, "/guides/rails_guides"))
|
68
|
-
RailsGuides::Generator.new(Rails.root.join("doc/guides")).generate
|
69
|
-
end
|
70
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
require 'rake/testtask'
|
2
|
-
|
3
|
-
module Rails
|
4
|
-
class TestTask < Rake::TestTask # :nodoc: all
|
5
|
-
# A utility class which is used primarily in "rails/test_unit/testing.rake"
|
6
|
-
# to help define rake tasks corresponding to <tt>rake test</tt>.
|
7
|
-
#
|
8
|
-
# This class takes a TestInfo class and defines the appropriate rake task
|
9
|
-
# based on the information, then invokes it.
|
10
|
-
class TestCreator # :nodoc:
|
11
|
-
def initialize(info)
|
12
|
-
@info = info
|
13
|
-
end
|
14
|
-
|
15
|
-
def invoke_rake_task
|
16
|
-
if @info.files.any?
|
17
|
-
create_and_run_single_test
|
18
|
-
reset_application_tasks
|
19
|
-
else
|
20
|
-
Rake::Task[ENV['TEST'] ? 'test:single' : 'test:run'].invoke
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def create_and_run_single_test
|
27
|
-
Rails::TestTask.new('test:single') { |t|
|
28
|
-
t.test_files = @info.files
|
29
|
-
}
|
30
|
-
ENV['TESTOPTS'] ||= @info.opts
|
31
|
-
Rake::Task['test:single'].invoke
|
32
|
-
end
|
33
|
-
|
34
|
-
def reset_application_tasks
|
35
|
-
Rake.application.top_level_tasks.replace @info.tasks
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# This is a utility class used by the <tt>TestTask::TestCreator</tt> class.
|
40
|
-
# This class takes a set of test tasks and checks to see if they correspond
|
41
|
-
# to test files (or can be transformed into test files). Calling <tt>files</tt>
|
42
|
-
# provides the set of test files and is used when initializing tests after
|
43
|
-
# a call to <tt>rake test</tt>.
|
44
|
-
class TestInfo # :nodoc:
|
45
|
-
def initialize(tasks)
|
46
|
-
@tasks = tasks
|
47
|
-
@files = nil
|
48
|
-
end
|
49
|
-
|
50
|
-
def files
|
51
|
-
@files ||= @tasks.map { |task|
|
52
|
-
[task, translate(task)].find { |file| test_file?(file) }
|
53
|
-
}.compact
|
54
|
-
end
|
55
|
-
|
56
|
-
def translate(file)
|
57
|
-
if file =~ /^app\/(.*)$/
|
58
|
-
"test/#{$1.sub(/\.rb$/, '')}_test.rb"
|
59
|
-
else
|
60
|
-
"test/#{file}_test.rb"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def tasks
|
65
|
-
@tasks - test_file_tasks - opt_names
|
66
|
-
end
|
67
|
-
|
68
|
-
def opts
|
69
|
-
opts = opt_names
|
70
|
-
if opts.any?
|
71
|
-
"-n #{opts.join ' '}"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def test_file_tasks
|
78
|
-
@tasks.find_all { |task|
|
79
|
-
[task, translate(task)].any? { |file| test_file?(file) }
|
80
|
-
}
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_file?(file)
|
84
|
-
file =~ /^test/ && File.file?(file) && !File.directory?(file)
|
85
|
-
end
|
86
|
-
|
87
|
-
def opt_names
|
88
|
-
(@tasks - test_file_tasks).reject { |t| task_defined? t }
|
89
|
-
end
|
90
|
-
|
91
|
-
def task_defined?(task)
|
92
|
-
Rake::Task.task_defined? task
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def self.test_creator(tasks)
|
97
|
-
info = TestInfo.new(tasks)
|
98
|
-
TestCreator.new(info)
|
99
|
-
end
|
100
|
-
|
101
|
-
def initialize(name = :test)
|
102
|
-
super
|
103
|
-
@libs << "test" # lib *and* test seem like a better default
|
104
|
-
end
|
105
|
-
|
106
|
-
def define
|
107
|
-
task @name do
|
108
|
-
if ENV['TESTOPTS']
|
109
|
-
ARGV.replace Shellwords.split ENV['TESTOPTS']
|
110
|
-
end
|
111
|
-
libs = @libs - $LOAD_PATH
|
112
|
-
$LOAD_PATH.unshift(*libs)
|
113
|
-
file_list.each { |fl|
|
114
|
-
FileList[fl].to_a.each { |f| require File.expand_path f }
|
115
|
-
}
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
# Silence the default description to cut down on `rake -T` noise.
|
121
|
-
class SubTestTask < Rake::TestTask # :nodoc:
|
122
|
-
def desc(string)
|
123
|
-
# Ignore the description.
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|