Skip to content

Commit

Permalink
Add options attribute to gem_package resource
Browse files Browse the repository at this point in the history
  • Loading branch information
hico-horiuchi committed Dec 21, 2015
1 parent 8a844ff commit dd46b87
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/itamae/resource/gem_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class GemPackage < Base
define_attribute :action, default: :install
define_attribute :package_name, type: String, default_name: true
define_attribute :gem_binary, type: [String, Array], default: 'gem'
define_attribute :options, type: [String, Array], default: ''
define_attribute :version, type: String
define_attribute :source, type: String

Expand Down Expand Up @@ -64,7 +65,7 @@ def installed_gems
end

def install!
cmd = [*Array(attributes.gem_binary), 'install']
cmd = [*Array(attributes.gem_binary), 'install', *Array(attributes.options)]
if attributes.version
cmd << '-v' << attributes.version
end
Expand All @@ -78,4 +79,3 @@ def install!
end
end
end

4 changes: 4 additions & 0 deletions spec/integration/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@
its(:stdout) { should include('tzinfo (1.2.2, 1.1.0)') }
end

describe command('ri Bundler') do
its(:stderr) { should eq("Nothing known about Bundler\n") }
end

describe file('/tmp/created_by_definition') do
it { should be_file }
its(:content) { should eq("name:name,key:value,message:Hello, Itamae\n") }
Expand Down
4 changes: 4 additions & 0 deletions spec/integration/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
version '1.2.2'
end

gem_package 'bundler' do
options ['--no-ri', '--no-rdoc']
end

######

execute "echo -n > /tmp/notifies"
Expand Down

0 comments on commit dd46b87

Please sign in to comment.