forked from sous-chefs/rvm
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial rvm_environment and rvm_gem resources.
- Loading branch information
Showing
8 changed files
with
172 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# Cookbook Name:: rvm | ||
# Provider:: environment | ||
# | ||
# Author:: Fletcher Nichol <fnichol@nichol.ca> | ||
# | ||
# Copyright 2011, Fletcher Nichol | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
action :create do | ||
ruby_string = new_resource.ruby_string | ||
rubie = select_ruby(ruby_string) | ||
gemset = select_gemset(ruby_string) | ||
|
||
if ruby_unknown?(rubie) | ||
Chef::Log.warn("rvm_environment[#{rubie}] is either not fully " + | ||
"qualified or not known . Use `rvm list known` to get a full list.") | ||
else | ||
# ensure ruby version is installed | ||
r = rvm_ruby rubie do | ||
action :nothing | ||
end | ||
|
||
# ensure gemset is created, if specified | ||
unless gemset.nil? | ||
g = rvm_gemset gemset do | ||
ruby_string rubie | ||
action :nothing | ||
end | ||
g.run_action(:create) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# | ||
# Cookbook Name:: rvm | ||
# Provider:: gem | ||
# | ||
# Author:: Fletcher Nichol <fnichol@nichol.ca> | ||
# | ||
# Copyright 2011, Fletcher Nichol | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
action :install do | ||
ruby_string = new_resource.ruby_string | ||
|
||
# get the actual ruby string that corresponds to "default" | ||
if ruby_string.start_with?("default") | ||
ruby_string.sub!(/default/, current_ruby_default) | ||
end | ||
|
||
# ensure ruby is installed and gemset exists | ||
e = rvm_environment ruby_string do | ||
action :nothing | ||
end | ||
e.run_action(:create) | ||
|
||
g = gem_package new_resource.gem do | ||
gem_binary "rvm #{ruby_string} gem" | ||
source new_resource.source if new_resource.source | ||
options new_resource.options if new_resource.options | ||
version new_resource.version if new_resource.version | ||
action :nothing | ||
end | ||
g.run_action(:install) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Cookbook Name:: rvm | ||
# Resource:: environment | ||
# | ||
# Author:: Fletcher Nichol <fnichol@nichol.ca> | ||
# | ||
# Copyright 2011, Fletcher Nichol | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
actions :create | ||
|
||
attribute :ruby_string, :kind_of => String, :name_attribute => true | ||
|
||
def initialize(name, run_context=nil) | ||
super | ||
@action = :create | ||
@command = name | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Cookbook Name:: rvm | ||
# Resource:: gem | ||
# | ||
# Author:: Fletcher Nichol <fnichol@nichol.ca> | ||
# | ||
# Copyright 2011, Fletcher Nichol | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
actions :install | ||
|
||
attribute :gem, :kind_of => String, :name_attribute => true | ||
attribute :ruby_string, :kind_of => String, :default => "default" | ||
attribute :source, :kind_of => String | ||
attribute :options, :kind_of => Hash | ||
attribute :version, :kind_of => String | ||
|
||
def initialize(name, run_context=nil) | ||
super | ||
@action = :install | ||
@command = name | ||
end |