Skip to content

Commit

Permalink
Merge pull request #46 from jf647/prefix_path
Browse files Browse the repository at this point in the history
Add a definition_file attribute to the rbenv_ruby resource.
  • Loading branch information
fnichol committed May 30, 2013
2 parents 96119f7 + b06ba5b commit 1e54656
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,14 @@ in the run list to perform the builds.
<td>definition</td>
<td>
<b>Name attribute:</b> the name of a built-in definition<sup>(1)</sup>
or the path to a ruby-build definition file.
or the name of the ruby installed by a ruby-build defintion file<sup>(2)</sup>
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>definition_file</td>
<td>
The path to a ruby-build definition file.
</td>
<td><code>nil</code></td>
</tr>
Expand All @@ -917,6 +924,7 @@ in the run list to perform the builds.
</table>

1. [built-in definition][rb_definitions]
2. the recipe checks for the existence of the naming attribute under the root_path, and if not found invokes ruby-build with the definition file as an argument

#### <a name="lwrps-rbr-examples"></a> Examples

Expand All @@ -937,6 +945,12 @@ usage.
action :reinstall
end

##### Install a custom ruby

rbenv_ruby "2.0.0p116" do
definition_file "/usr/local/rbenv/custom/2.0.0p116"
end

## <a name="mac-system-note"></a> System-Wide Mac Installation Note

This cookbook takes advantage of managing profile fragments in an
Expand Down
4 changes: 3 additions & 1 deletion providers/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

def load_current_resource
@rubie = new_resource.definition
@definition_file = new_resource.definition_file
@root_path = new_resource.root_path
@user = new_resource.user
@environment = new_resource.environment
Expand Down Expand Up @@ -54,9 +55,10 @@ def perform_install
# bypass block scoping issues
rbenv_user = @user
rubie = @rubie
definition = @definition_file || @rubie
rbenv_prefix = @root_path
rbenv_env = @environment
command = %{rbenv install #{rubie}}
command = %{rbenv install #{definition}}

rbenv_script "#{command} #{which_rbenv}" do
code command
Expand Down
1 change: 1 addition & 0 deletions resources/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
actions :install, :reinstall

attribute :definition, :kind_of => String, :name_attribute => true
attribute :definition_file, :kind_of => String
attribute :root_path, :kind_of => String
attribute :user, :kind_of => String
attribute :environment, :kind_of => Hash
Expand Down

0 comments on commit 1e54656

Please sign in to comment.