Created
February 20, 2020 18:40
-
-
Save bradreid/bbf45aaa7eb49403e75eb84fe13b0917 to your computer and use it in GitHub Desktop.
cookbooks/br-ruby-0.5.2
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
# file: providers/ruby_runtime.rb | |
# | |
# Cookbook Name:: br-ruby | |
# Provider:: ruby_runtime | |
# | |
provides :ruby_runtime | |
use_inline_resources | |
def whyrun_supported? | |
true | |
end | |
def runtime | |
@runtime ||= BR::Ruby::Runtime.new(new_resource.version, new_resource.install_path) | |
end | |
def installer | |
@installer ||= BR::Ruby::Installer.provider_for(new_resource, run_context) | |
end | |
def gems | |
@gems ||= new_resource.gems.map do |name, version| | |
BR::Ruby::Gem.new(name, version, runtime) | |
end | |
end | |
action :install do | |
return if runtime.installed? | |
new_resource.dependencies.each do |dependency| | |
package dependency do | |
action :install | |
end | |
end | |
directory new_resource.install_path do | |
owner new_resource.owner | |
group new_resource.group | |
mode new_resource.mode | |
recursive true | |
end | |
installer.run_action(:install) | |
execute "/opt/rubies/2.3.1/bin/gem install bundler --version=1.17.3" | |
#gems.each do |gem| | |
# execute gem.install_command | |
#end | |
end | |
action :remove do | |
return unless runtime.exist? | |
directory runtime.root do | |
recursive true | |
action :delete | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment