Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow array gem_binary #149

Merged
merged 1 commit into from
Jul 21, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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