Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
Drop default "global" version in rbenv_script provider.
Browse files Browse the repository at this point in the history
This will lead to errors if rbenv_script is invoked before any rbenv
Ruby versions are installed (and a global Ruby version is set).

References sous-chefs#33
References sous-chefs#43
  • Loading branch information
fnichol committed May 31, 2013
1 parent 0c453b9 commit 29160e6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -487,7 +487,7 @@ notifies it.
<td>
A version of Ruby being managed by rbenv.
</td>
<td><code>"global"</code></td>
<td><code>nil</code></td>
</tr>
<tr>
<td>root_path</td>
Expand Down
18 changes: 9 additions & 9 deletions providers/script.rb
Expand Up @@ -45,15 +45,15 @@
private

def build_script_code
<<-SYSTEM_WIDE.gsub(/^ +/, '')
export RBENV_ROOT="#{rbenv_root}"
export PATH="${RBENV_ROOT}/bin:$PATH"
eval "$(rbenv init -)"
rbenv shell #{new_resource.rbenv_version}
#{new_resource.code}
SYSTEM_WIDE
script = []
script << %{export RBENV_ROOT="#{rbenv_root}"}
script << %{export PATH="${RBENV_ROOT}/bin:$PATH"}
script << %{eval "$(rbenv init -)"}
if new_resource.rbenv_version
script << %{export RBENV_VERSION="#{new_resource.rbenv_version}"}
end
script << new_resource.code
script.join("\n")
end

def build_script_environment
Expand Down
2 changes: 1 addition & 1 deletion resources/script.rb
Expand Up @@ -22,7 +22,7 @@
actions :run

attribute :name, :kind_of => String, :name_attribute => true
attribute :rbenv_version, :kind_of => String, :default => "global"
attribute :rbenv_version, :kind_of => String
attribute :root_path, :kind_of => String
attribute :code, :kind_of => String
attribute :creates, :kind_of => String
Expand Down

0 comments on commit 29160e6

Please sign in to comment.