提交 1785bf7d 编写于 作者: Y Yves Senn 提交者: Yves Senn

`plugin new` adds dummy app tasks when necessary.

Closes #8121

The `plugin new` generator always adds the dummy app rake tasks,
when a dummy app was created.
上级 c1488232
## Rails 4.0.0 (unreleased) ##
* Add dummy app Rake tasks when --skip-test-unit and --dummy-path is passed to the plugin generator.
Fix #8121
*Yves Senn*
* Ensure that RAILS_ENV is set when accessing Rails.env *Steve Klabnik*
* Don't eager-load app/assets and app/views *Elia Schito*
......@@ -9,7 +14,7 @@
* New test locations `test/models`, `test/helpers`, `test/controllers`, and
`test/mailers`. Corresponding rake tasks added as well. *Mike Moore*
* Set a different cache per environment for assets pipeline
* Set a different cache per environment for assets pipeline
through `config.assets.cache`.
*Guillermo Iguaran*
......
......@@ -225,7 +225,7 @@ def create_test_files
end
def create_test_dummy_files
return if options[:skip_test_unit] && options[:dummy_path] == 'test/dummy'
return unless with_dummy_app?
create_dummy_app
end
......@@ -279,6 +279,10 @@ def mountable?
options[:mountable]
end
def with_dummy_app?
options[:skip_test_unit].blank? || options[:dummy_path] != 'test/dummy'
end
def self.banner
"rails plugin new #{self.arguments.map(&:usage).join(' ')} [options]"
end
......
......@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('lib/**/*.rb')
end
<% if full? && !options[:skip_active_record] && !options[:skip_test_unit] -%>
<% if full? && !options[:skip_active_record] && with_dummy_app? -%>
APP_RAKEFILE = File.expand_path("../<%= dummy_path -%>/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
<% end %>
......
......@@ -66,6 +66,12 @@ def test_generating_test_files_in_full_mode_without_unit_test_files
assert_no_match(/APP_RAKEFILE/, File.read(File.join(destination_root, "Rakefile")))
end
def test_generating_adds_dummy_app_rake_tasks_without_unit_test_files
run_generator [destination_root, "-T", "--mountable", '--dummy-path', 'my_dummy_app']
assert_match(/APP_RAKEFILE/, File.read(File.join(destination_root, "Rakefile")))
end
def test_ensure_that_plugin_options_are_not_passed_to_app_generator
FileUtils.cd(Rails.root)
assert_no_match(/It works from file!.*It works_from_file/, run_generator([destination_root, "-m", "lib/template.rb"]))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册