Skip to content

Commit

Permalink
Merge pull request #149 from eagletmt/gem_binary-array
Browse files Browse the repository at this point in the history
Allow array gem_binary
  • Loading branch information
ryotarai committed Jul 21, 2015
2 parents fa9a02f + fb1ea46 commit 8c39029
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/itamae/resource/gem_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Resource
class GemPackage < Base
define_attribute :action, default: :install
define_attribute :package_name, type: String, default_name: true
define_attribute :gem_binary, type: String, default: 'gem'
define_attribute :gem_binary, type: [String, Array], default: 'gem'
define_attribute :version, type: String
define_attribute :source, type: String

Expand Down Expand Up @@ -51,7 +51,7 @@ def action_upgrade(action_options)

def installed_gems
gems = []
run_command([attributes.gem_binary, 'list', '-l']).stdout.each_line do |line|
run_command([*Array(attributes.gem_binary), 'list', '-l']).stdout.each_line do |line|
if /\A([^ ]+) \(([^\)]+)\)\z/ =~ line.strip
name = $1
versions = $2.split(', ')
Expand All @@ -64,7 +64,7 @@ def installed_gems
end

def install!
cmd = [attributes.gem_binary, 'install']
cmd = [*Array(attributes.gem_binary), 'install']
if attributes.version
cmd << '-v' << attributes.version
end
Expand Down

0 comments on commit 8c39029

Please sign in to comment.