Skip to content

Commit

Permalink
Merge pull request #123 from tas50/master
Browse files Browse the repository at this point in the history
Allow setting rbenv cli command action for rvm-download
  • Loading branch information
tas50 committed Aug 28, 2015
2 parents 010e4cf + 3e33bca commit 39a936d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,13 @@ in the run list to perform the builds.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>rbenv_action</td>
<td>
The action that rbenv takes to install ruby via the command line. By default this is 'install' which results in a command such as <code>rbenv install ruby 2.2.0</code>. When using the rvm-download rbenv plugin use 'download' to have the provider execute a command such as <code>rbenv download 2.2.0</code>.
</td>
<td><code>install</code></td>
</tr>
</tbody>
</table>

Expand Down
3 changes: 2 additions & 1 deletion providers/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def load_current_resource
@environment = new_resource.environment
@patch_url = new_resource.patch_url
@patch_file = new_resource.patch_file
@rbenv_action = new_resource.rbenv_action
end

action :install do # ~FC017
Expand Down Expand Up @@ -67,7 +68,7 @@ def perform_install

patch_command = "--patch < #{@patch_file}" if @patch_file

command = %(rbenv install #{definition} #{patch_command})
command = %(rbenv #{@rbenv_action} #{definition} #{patch_command})

rbenv_script "#{command} #{which_rbenv}" do
code command
Expand Down
3 changes: 2 additions & 1 deletion resources/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#

actions :install, :reinstall
default_action :install

attribute :definition, kind_of: String, name_attribute: true
attribute :definition_file, kind_of: String
Expand All @@ -28,10 +29,10 @@
attribute :environment, kind_of: Hash
attribute :patch_url, kind_of: String
attribute :patch_file, kind_of: String
attribute :rbenv_action, kind_of: String, default: 'install'

def initialize(*args)
super
@action = :install
@rbenv_version = @definition
end

Expand Down
2 changes: 1 addition & 1 deletion test/unit/resources/ruby_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
end

it 'action defaults to :install' do
expect(resource.action).to eq(:install)
expect(resource.action).to eq([:install])
end

it 'actions include :reinstall' do
Expand Down

0 comments on commit 39a936d

Please sign in to comment.