aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-11-02 17:12:01 -0800
committerYehuda Katz <wycats@gmail.com>2009-11-02 17:12:01 -0800
commit14370e1aab6ddfb5b86cf50bd7e5abcebae0684c (patch)
tree431146dfb0b15c4507fd49bb7d6f18bd40ccf839 /railties
parent976c2647240fd40a2b706ab5e41856cd47e7b212 (diff)
downloadrails-14370e1aab6ddfb5b86cf50bd7e5abcebae0684c.tar.gz
rails-14370e1aab6ddfb5b86cf50bd7e5abcebae0684c.tar.bz2
rails-14370e1aab6ddfb5b86cf50bd7e5abcebae0684c.zip
CI breakage
This reverts commit a288b74f1c75c6f100de7611a5093a421f1ad6d1.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/base.rb17
-rw-r--r--railties/test/generators/actions_test.rb2
-rw-r--r--railties/test/generators/app_generator_test.rb4
-rw-r--r--railties/test/generators/controller_generator_test.rb2
-rw-r--r--railties/test/generators/generator_generator_test.rb2
-rw-r--r--railties/test/generators/generators_test_helper.rb11
-rw-r--r--railties/test/generators/helper_generator_test.rb2
-rw-r--r--railties/test/generators/integration_test_generator_test.rb2
-rw-r--r--railties/test/generators/mailer_generator_test.rb2
-rw-r--r--railties/test/generators/metal_generator_test.rb2
-rw-r--r--railties/test/generators/migration_generator_test.rb2
-rw-r--r--railties/test/generators/model_generator_test.rb2
-rw-r--r--railties/test/generators/observer_generator_test.rb2
-rw-r--r--railties/test/generators/performance_test_generator_test.rb2
-rw-r--r--railties/test/generators/plugin_generator_test.rb2
-rw-r--r--railties/test/generators/resource_generator_test.rb2
-rw-r--r--railties/test/generators/scaffold_controller_generator_test.rb2
-rw-r--r--railties/test/generators/scaffold_generator_test.rb3
-rw-r--r--railties/test/generators/session_migration_generator_test.rb2
-rw-r--r--railties/test/generators/stylesheets_generator_test.rb2
20 files changed, 23 insertions, 44 deletions
diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb
index e6baf2fc79..7af99797ea 100644
--- a/railties/lib/rails/generators/base.rb
+++ b/railties/lib/rails/generators/base.rb
@@ -12,16 +12,6 @@ module Rails
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 @@ module Rails
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
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb
index f5cb26cf52..199b5fa8b4 100644
--- a/railties/test/generators/actions_test.rb
+++ b/railties/test/generators/actions_test.rb
@@ -182,7 +182,7 @@ class ActionsTest < GeneratorsTestCase
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)
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index c44d25b72c..20f2a24e6d 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -126,7 +126,7 @@ class AppGeneratorTest < GeneratorsTestCase
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 @@ class AppGeneratorTest < GeneratorsTestCase
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)
diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb
index 3020e928dc..56bc688ad0 100644
--- a/railties/test/generators/controller_generator_test.rb
+++ b/railties/test/generators/controller_generator_test.rb
@@ -74,7 +74,7 @@ class ControllerGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb
index 703aa20914..aea3f4da51 100644
--- a/railties/test/generators/generator_generator_test.rb
+++ b/railties/test/generators/generator_generator_test.rb
@@ -20,7 +20,7 @@ class GeneratorGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb
index 829a38c103..ccf08c347c 100644
--- a/railties/test/generators/generators_test_helper.rb
+++ b/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 @@ require 'action_dispatch'
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
diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb
index 44f5a324af..f8bfc517a2 100644
--- a/railties/test/generators/helper_generator_test.rb
+++ b/railties/test/generators/helper_generator_test.rb
@@ -54,7 +54,7 @@ class HelperGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb
index 68b55a66f9..6a504ceea2 100644
--- a/railties/test/generators/integration_test_generator_test.rb
+++ b/railties/test/generators/integration_test_generator_test.rb
@@ -12,7 +12,7 @@ class IntegrationTestGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb
index e33af25773..251474ad16 100644
--- a/railties/test/generators/mailer_generator_test.rb
+++ b/railties/test/generators/mailer_generator_test.rb
@@ -46,7 +46,7 @@ class MailerGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb
index 4f36e0f612..80bf342892 100644
--- a/railties/test/generators/metal_generator_test.rb
+++ b/railties/test/generators/metal_generator_test.rb
@@ -17,7 +17,7 @@ class MetalGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb
index b1fdbef425..35172a8be4 100644
--- a/railties/test/generators/migration_generator_test.rb
+++ b/railties/test/generators/migration_generator_test.rb
@@ -53,7 +53,7 @@ class MigrationGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index a0d4bed992..e073b11e1e 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -175,7 +175,7 @@ class ModelGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb
index becc217ac0..6fed2998dd 100644
--- a/railties/test/generators/observer_generator_test.rb
+++ b/railties/test/generators/observer_generator_test.rb
@@ -27,7 +27,7 @@ class ObserverGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb
index 00906a61e0..d19128f79a 100644
--- a/railties/test/generators/performance_test_generator_test.rb
+++ b/railties/test/generators/performance_test_generator_test.rb
@@ -12,7 +12,7 @@ class PerformanceTestGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb
index c8bfaf3d97..f5b8b6ffb6 100644
--- a/railties/test/generators/plugin_generator_test.rb
+++ b/railties/test/generators/plugin_generator_test.rb
@@ -50,7 +50,7 @@ class PluginGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb
index 99811bc07b..dcae81c204 100644
--- a/railties/test/generators/resource_generator_test.rb
+++ b/railties/test/generators/resource_generator_test.rb
@@ -100,7 +100,7 @@ class ResourceGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb
index 43647360d6..02155c295c 100644
--- a/railties/test/generators/scaffold_controller_generator_test.rb
+++ b/railties/test/generators/scaffold_controller_generator_test.rb
@@ -139,7 +139,7 @@ class ScaffoldControllerGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index 09ab58e404..c0652c034f 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -122,7 +122,8 @@ class ScaffoldGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb
index 342b9a900e..34fb996b7f 100644
--- a/railties/test/generators/session_migration_generator_test.rb
+++ b/railties/test/generators/session_migration_generator_test.rb
@@ -28,7 +28,7 @@ class SessionMigrationGeneratorTest < GeneratorsTestCase
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
diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb
index 6a07898c51..15263d4bb8 100644
--- a/railties/test/generators/stylesheets_generator_test.rb
+++ b/railties/test/generators/stylesheets_generator_test.rb
@@ -18,7 +18,7 @@ class StylesheetsGeneratorTest < GeneratorsTestCase
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