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

Add options attribute to gem_package resource #186

Merged
Show file tree
Hide file tree
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
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']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--no-ri and --no-rdoc are deprecated options. Please use --no-document

end

######

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