提交 5252f5c1 编写于 作者: J José Valim

Bundle automatically if --dev or --edge is given as option.

上级 c905fce3
......@@ -168,12 +168,14 @@ def apply_rails_template
raise Error, "The template [#{rails_template}] could not be loaded. Error: #{e}"
end
def bundle_if_dev_or_edge
run "gem bundle" if dev_or_edge?
end
protected
attr_accessor :rails_template
def set_default_accessors!
app_name # Cache app name
self.rails_template = case options[:template]
when /^http:\/\//
options[:template]
......
......@@ -144,7 +144,7 @@ def test_template_is_executed_when_supplied
template = %{ say "It works!" }
template.instance_eval "def read; self; end" # Make the string respond to read
generator([destination_root], :template => path, :database => "sqlite3").expects(:open).with(path).returns(template)
generator([destination_root], :template => path).expects(:open).with(path).returns(template)
assert_match /It works!/, silence(:stdout){ generator.invoke }
end
......@@ -168,14 +168,16 @@ def test_file_is_added_for_backwards_compatibility
end
def test_dev_option
run_generator [destination_root, "--dev"]
generator([destination_root], :dev => true).expects(:run).with("gem bundle")
silence(:stdout){ generator.invoke }
rails_path = File.expand_path('../../..', Rails.root)
dev_gem = %(directory #{rails_path.inspect}, :glob => "{*/,}*.gemspec")
assert_file 'Gemfile', /^#{Regexp.escape(dev_gem)}$/
end
def test_edge_option
run_generator [destination_root, "--edge"]
generator([destination_root], :edge => true).expects(:run).with("gem bundle")
silence(:stdout){ generator.invoke }
edge_gem = %(gem "rails", :git => "git://github.com/rails/rails.git")
assert_file 'Gemfile', /^#{Regexp.escape(edge_gem)}$/
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册