CI breakage

This reverts commit a288b74f1c.
This commit is contained in:
Yehuda Katz 2009-11-02 17:12:01 -08:00
parent 976c264724
commit 14370e1aab
20 changed files with 23 additions and 44 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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