提交 fe7038ea 编写于 作者: A Alexey Vakhov

Use new hash syntax for generators gem method

The Gemfile of new application uses ruby 1.9 hashes. Gem method of
generators should use them too. It prevents from mixing two kinds of
syntax in one file.
上级 0638e6bb
...@@ -27,7 +27,7 @@ def gem(*args) ...@@ -27,7 +27,7 @@ def gem(*args)
log :gemfile, message log :gemfile, message
options.each do |option, value| options.each do |option, value|
parts << ":#{option} => #{value.inspect}" parts << "#{option}: #{value.inspect}"
end end
in_root do in_root do
......
...@@ -139,7 +139,7 @@ def gemfile_entry ...@@ -139,7 +139,7 @@ def gemfile_entry
gemfile_in_app_path = File.join(rails_app_path, "Gemfile") gemfile_in_app_path = File.join(rails_app_path, "Gemfile")
if File.exist? gemfile_in_app_path if File.exist? gemfile_in_app_path
entry = "gem '#{name}', :path => '#{relative_path}'" entry = "gem '#{name}', path: '#{relative_path}'"
append_file gemfile_in_app_path, entry append_file gemfile_in_app_path, entry
end end
end end
......
...@@ -67,6 +67,14 @@ def test_gem_should_insert_on_separate_lines ...@@ -67,6 +67,14 @@ def test_gem_should_insert_on_separate_lines
assert_file 'Gemfile', /^gem "rspec-rails"$/ assert_file 'Gemfile', /^gem "rspec-rails"$/
end end
def test_gem_should_include_options
run_generator
action :gem, 'rspec', github: 'dchelimsky/rspec', tag: '1.2.9.rc1'
assert_file 'Gemfile', /gem "rspec", github: "dchelimsky\/rspec", tag: "1\.2\.9\.rc1"/
end
def test_gem_group_should_wrap_gems_in_a_group def test_gem_group_should_wrap_gems_in_a_group
run_generator run_generator
......
...@@ -279,7 +279,7 @@ def test_creating_plugin_in_app_directory_adds_gemfile_entry ...@@ -279,7 +279,7 @@ def test_creating_plugin_in_app_directory_adds_gemfile_entry
run_generator [destination_root] run_generator [destination_root]
assert_file gemfile_path, /gem 'bukkits', :path => 'tmp\/bukkits'/ assert_file gemfile_path, /gem 'bukkits', path: 'tmp\/bukkits'/
ensure ensure
Object.send(:remove_const, 'APP_PATH') Object.send(:remove_const, 'APP_PATH')
FileUtils.rm gemfile_path FileUtils.rm gemfile_path
...@@ -294,7 +294,7 @@ def test_skipping_gemfile_entry ...@@ -294,7 +294,7 @@ def test_skipping_gemfile_entry
run_generator [destination_root, "--skip-gemfile-entry"] run_generator [destination_root, "--skip-gemfile-entry"]
assert_file gemfile_path do |contents| assert_file gemfile_path do |contents|
assert_no_match(/gem 'bukkits', :path => 'tmp\/bukkits'/, contents) assert_no_match(/gem 'bukkits', path: 'tmp\/bukkits'/, contents)
end end
ensure ensure
Object.send(:remove_const, 'APP_PATH') Object.send(:remove_const, 'APP_PATH')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册