Permalink
Browse files

CI breakage

This reverts commit a288b74.
  • Loading branch information...
1 parent 976c264 commit 14370e1aab6ddfb5b86cf50bd7e5abcebae0684c @wycats wycats committed Nov 3, 2009
View
17 railties/lib/rails/generators/base.rb
@@ -12,16 +12,6 @@ class Base < Thor::Group
add_runtime_options!
- # Always move to rails source root.
- #
- def initialize(*args) #:nodoc:
- if !invoked?(args) && defined?(Rails.root) && Rails.root
- self.destination_root = Rails.root
- FileUtils.cd(destination_root)
- end
- super
- end
-
# Automatically sets the source root based on the class name.
#
def self.source_root
@@ -257,13 +247,6 @@ def class_collisions(*class_names) #:nodoc:
end
end
- # Check if this generator was invoked from another one by inspecting
- # parameters.
- #
- def invoked?(args)
- args.last.is_a?(Hash) && args.last.key?(:invocations)
- end
-
# Use Rails default banner.
#
def self.banner
View
2 railties/test/generators/actions_test.rb
@@ -182,7 +182,7 @@ def run_generator
end
def generator(config={})
- @generator ||= Rails::Generators::Base.new([], {}, config)
+ @generator ||= Rails::Generators::Base.new([], {}, { :destination_root => destination_root }.merge!(config))
end
def action(*args, &block)
View
4 railties/test/generators/app_generator_test.rb
@@ -126,7 +126,7 @@ def test_rails_is_frozen
def test_template_from_dir_pwd
FileUtils.cd(Rails.root)
- assert_match /It works from file!/, run_generator(["-m", "../lib/template.rb"])
+ assert_match /It works from file!/, run_generator(["-m", "lib/template.rb"])
end
def test_template_raises_an_error_with_invalid_path
@@ -170,7 +170,7 @@ def run_generator(args=[])
end
def generator(options={})
- @generator ||= Rails::Generators::AppGenerator.new([destination_root], options)
+ @generator ||= Rails::Generators::AppGenerator.new([destination_root], options, :destination_root => destination_root)
end
def action(*args, &block)
View
2 railties/test/generators/controller_generator_test.rb
@@ -74,7 +74,7 @@ def test_actions_are_turned_into_methods
protected
def run_generator(args=["Account", "foo", "bar"])
- silence(:stdout) { Rails::Generators::ControllerGenerator.start args }
+ silence(:stdout) { Rails::Generators::ControllerGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/generator_generator_test.rb
@@ -20,7 +20,7 @@ def test_generator_skeleton_is_created
protected
def run_generator(args=["awesome"], config={})
- silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config }
+ silence(:stdout) { Rails::Generators::GeneratorGenerator.start args, config.merge(:destination_root => destination_root) }
end
end
View
11 railties/test/generators/generators_test_helper.rb
@@ -1,5 +1,5 @@
# TODO: Fix this RAILS_ENV stuff
-RAILS_ENV = 'test' unless defined?(RAILS_ENV)
+RAILS_ENV = 'test'
require 'abstract_unit'
Rails.application.config.root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures'))
@@ -11,17 +11,12 @@
CURRENT_PATH = File.expand_path(Dir.pwd)
Rails::Generators.no_color!
-module Rails
- def self.root
- @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures', 'tmp'))
- end
-end
-
class GeneratorsTestCase < Test::Unit::TestCase
include FileUtils
def destination_root
- Rails.root
+ @destination_root ||= File.expand_path(File.join(File.dirname(__FILE__),
+ '..', 'fixtures', 'tmp'))
end
def setup
View
2 railties/test/generators/helper_generator_test.rb
@@ -54,7 +54,7 @@ def test_namespaced_and_not_namespaced_helpers
protected
def run_generator(args=["admin"])
- silence(:stdout) { Rails::Generators::HelperGenerator.start args }
+ silence(:stdout) { Rails::Generators::HelperGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/integration_test_generator_test.rb
@@ -12,7 +12,7 @@ def test_integration_test_skeleton_is_created
protected
def run_generator(args=["integration"])
- silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args }
+ silence(:stdout) { Rails::Generators::IntegrationTestGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/mailer_generator_test.rb
@@ -46,7 +46,7 @@ def test_actions_are_turned_into_methods
protected
def run_generator(args=["notifier", "foo", "bar"])
- silence(:stdout) { Rails::Generators::MailerGenerator.start args }
+ silence(:stdout) { Rails::Generators::MailerGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/metal_generator_test.rb
@@ -17,7 +17,7 @@ def test_check_class_collision
protected
def run_generator(args=["foo"])
- silence(:stdout) { Rails::Generators::MetalGenerator.start args }
+ silence(:stdout) { Rails::Generators::MetalGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/migration_generator_test.rb
@@ -53,7 +53,7 @@ def test_remove_migration_with_attributes
protected
def run_generator(args=[@migration])
- silence(:stdout) { Rails::Generators::MigrationGenerator.start args }
+ silence(:stdout) { Rails::Generators::MigrationGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/model_generator_test.rb
@@ -175,7 +175,7 @@ def test_check_class_collision
protected
def run_generator(args=["Account", "name:string", "age:integer"], config={})
- silence(:stdout) { Rails::Generators::ModelGenerator.start args, config }
+ silence(:stdout) { Rails::Generators::ModelGenerator.start args, config.merge(:destination_root => destination_root) }
end
end
View
2 railties/test/generators/observer_generator_test.rb
@@ -27,7 +27,7 @@ def test_logs_if_the_test_framework_cannot_be_found
protected
def run_generator(args=["account"])
- silence(:stdout) { Rails::Generators::ObserverGenerator.start args }
+ silence(:stdout) { Rails::Generators::ObserverGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/performance_test_generator_test.rb
@@ -12,7 +12,7 @@ def test_performance_test_skeleton_is_created
protected
def run_generator(args=["performance"])
- silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args }
+ silence(:stdout) { Rails::Generators::PerformanceTestGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/plugin_generator_test.rb
@@ -50,7 +50,7 @@ def test_plugin_generator_on_revoke
protected
def run_generator(args=["plugin_fu"], config={})
- silence(:stdout){ Rails::Generators::PluginGenerator.start args, config }
+ silence(:stdout) { Rails::Generators::PluginGenerator.start args, config.merge(:destination_root => destination_root) }
end
end
View
2 railties/test/generators/resource_generator_test.rb
@@ -100,7 +100,7 @@ def test_route_is_removed_on_revoke
protected
def run_generator(args=["account"], config={})
- silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config }
+ silence(:stdout) { Rails::Generators::ResourceGenerator.start args, config.merge(:destination_root => destination_root) }
end
end
View
2 railties/test/generators/scaffold_controller_generator_test.rb
@@ -139,7 +139,7 @@ def self.all(klass)
protected
def run_generator(args=["User", "name:string", "age:integer"])
- silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args }
+ silence(:stdout) { Rails::Generators::ScaffoldControllerGenerator.start args, :destination_root => destination_root }
end
end
View
3 railties/test/generators/scaffold_generator_test.rb
@@ -122,7 +122,8 @@ def test_scaffold_on_revoke
def run_generator(config={})
silence(:stdout) do
- Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"], config
+ Rails::Generators::ScaffoldGenerator.start ["product_line", "title:string", "price:integer"],
+ config.merge(:destination_root => destination_root)
end
end
View
2 railties/test/generators/session_migration_generator_test.rb
@@ -28,7 +28,7 @@ def test_session_migration_with_custom_table_name
protected
def run_generator(args=[])
- silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args }
+ silence(:stdout) { Rails::Generators::SessionMigrationGenerator.start args, :destination_root => destination_root }
end
end
View
2 railties/test/generators/stylesheets_generator_test.rb
@@ -18,7 +18,7 @@ def test_stylesheets_are_not_deleted_on_revoke
protected
def run_generator(config={})
- silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config }
+ silence(:stdout) { Rails::Generators::StylesheetsGenerator.start [], config.merge(:destination_root => destination_root) }
end
end

0 comments on commit 14370e1

Please sign in to comment.