Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

backport #8139, `plugin new` adds dummy app tasks when necessary. …

The `plugin new` generator always adds the dummy app rake tasks,
when a dummy app was created.

Closes #8224

Conflicts:

	railties/CHANGELOG.md
  • Loading branch information...
commit e69058c15389b7f88771a95c1637b2f306d0c02f 1 parent 00fbee5
@senny authored
View
5 railties/CHANGELOG.md
@@ -1,5 +1,10 @@
## Rails 3.2.9 (Nov 12, 2012) ##
+* Add dummy app Rake tasks when --skip-test-unit and --dummy-path is passed to the plugin generator. [Backport #8139]
+ Fix #8121
+
+ *Yves Senn*
+
* Update supported ruby versions error message in ruby_version_check.rb *Lihan Li*
## Rails 3.2.8 (Aug 9, 2012) ##
View
6 railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
@@ -204,7 +204,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
@@ -242,6 +242,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
View
2  railties/lib/rails/generators/rails/plugin_new/templates/Rakefile
@@ -20,7 +20,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 %>
View
6 railties/test/generators/plugin_new_generator_test.rb
@@ -65,6 +65,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"]))
Please sign in to comment.
Something went wrong with that request. Please try again.