From bc09df6bce7e5c67110d6ba98b72dfd026f3e6c4 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 11 Jun 2012 16:46:34 -0400 Subject: [PATCH] gem by itself handles version now --- features/ruby_gemfile.feature | 4 ++-- lib/penchant/gemfile.rb | 10 +++++++++- lib/penchant/version.rb | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/features/ruby_gemfile.feature b/features/ruby_gemfile.feature index 9d449b9..a840fca 100644 --- a/features/ruby_gemfile.feature +++ b/features/ruby_gemfile.feature @@ -124,13 +124,13 @@ Feature: Gemfiles Scenario: Single gem gets processed like a gems list Given I have the file "Gemfile.penchant" with the content: """ - gem 'one', :path => '../%s' + gem 'one', '1.2.3', :path => '../%s' """ When I rebuild the Gemfile for "local" mode Then the file "Gemfile" should have the following content: """ # generated by penchant, environment: local - gem "one", {:path=>"../one"} + gem "one", "1.2.3", {:path=>"../one"} """ @mocha diff --git a/lib/penchant/gemfile.rb b/lib/penchant/gemfile.rb index c6cfc93..1f54de1 100644 --- a/lib/penchant/gemfile.rb +++ b/lib/penchant/gemfile.rb @@ -233,11 +233,19 @@ module Penchant end def gem(*args) - gem_name, template = split_args(args) + gem_name = [ args.shift ] + template = {} + + if args.last.kind_of?(::Hash) + template = args.pop + end + + version = args.first options = process_options(gem_name, template) args = [ gem_name.first ] + args << version if version args << options if !options.empty? if options[:git] diff --git a/lib/penchant/version.rb b/lib/penchant/version.rb index b1da38c..a46aa20 100644 --- a/lib/penchant/version.rb +++ b/lib/penchant/version.rb @@ -1,3 +1,3 @@ module Penchant - VERSION = "0.2.4" + VERSION = "0.2.5" end