support the ruby version option

This commit is contained in:
John Bintz 2012-10-06 16:42:51 -04:00
parent dacc9d9334
commit a0f610602b
2 changed files with 18 additions and 3 deletions

View File

@ -411,3 +411,14 @@ Feature: Gemfiles
gem "one"
"""
Scenario: Pass through the Ruby version
Given I have the file "Gemfile.penchant" with the content:
"""
ruby '1.9.3'
"""
When I rebuild the Gemfile for "local" mode
Then the file "Gemfile" should have the following content:
"""
# generated by penchant, environment: local
ruby "1.9.3"
"""

View File

@ -203,6 +203,10 @@ module Penchant
end
end
def ruby(version)
@output << %{ruby "#{version}"}
end
protected
def args_to_string(args)
args.inspect[1..-2]
@ -218,9 +222,9 @@ module Penchant
[ args, template ]
end
def call_and_indent_output(block)
def call_and_indent_output(block = nil, &given_block)
index = @output.length
block.call
(block || given_block).call
index.upto(@output.length - 1) do |i|
@output[i] = " " + @output[i]
end
@ -270,7 +274,7 @@ module Penchant
properties[key] = value
end
end
properties
end