class PoiseRuby::RubyProviders::Base

Public Class Methods

default_inversion_options(node, new_resource) click to toggle source

Set default inversion options.

@api private

Calls superclass method
# File lib/poise_ruby/ruby_providers/base.rb, line 32
def self.default_inversion_options(node, new_resource)
  super.merge({
    bundler_version: new_resource.bundler_version,
    version: new_resource.version,
  })
end

Public Instance Methods

action_install() click to toggle source

The `install` action for the `ruby_runtime` resource.

@return [void]

# File lib/poise_ruby/ruby_providers/base.rb, line 42
def action_install
  notifying_block do
    install_ruby
    install_bundler
  end
end
action_uninstall() click to toggle source

The `uninstall` action for the `ruby_runtime` resource.

@return [void]

# File lib/poise_ruby/ruby_providers/base.rb, line 52
def action_uninstall
  notifying_block do
    uninstall_ruby
  end
end
gem_binary() click to toggle source

The path to the `gem` binary. Look relative to the `ruby` binary for a default implementation.

@return [String]

# File lib/poise_ruby/ruby_providers/base.rb, line 78
def gem_binary
  dir, base = ::File.split(ruby_binary)
  # If this ruby is called something weird, bail out.
  raise NotImplementedError unless base.start_with?('ruby')
  # Allow for names like "ruby2.0" -> "gem2.0".
  ::File.join(dir, base.sub(/^ruby/, 'gem'))
end
ruby_binary() click to toggle source

The path to the `ruby` binary.

@abstract @return [String]

# File lib/poise_ruby/ruby_providers/base.rb, line 62
def ruby_binary
  raise NotImplementedError
end
ruby_environment() click to toggle source

Output property for environment variables.

@return [Hash<String, String>]

# File lib/poise_ruby/ruby_providers/base.rb, line 69
def ruby_environment
  # No environment variables needed. Rejoice.
  {}
end

Private Instance Methods

install_bundler() click to toggle source

Install Bundler in to the Ruby runtime.

@return [void]

# File lib/poise_ruby/ruby_providers/base.rb, line 105
def install_bundler
  # Captured because #options conflicts with Chef::Resource::Package#options.
  bundler_version = options[:bundler_version]
  return unless bundler_version
  ruby_gem 'bundler' do
    action :upgrade if bundler_version == true
    parent_ruby new_resource
    version bundler_version if bundler_version.is_a?(String)
  end
end
install_ruby() click to toggle source

Install the Ruby runtime. Must be implemented by subclass.

@abstract @return [void]

# File lib/poise_ruby/ruby_providers/base.rb, line 92
def install_ruby
end
uninstall_ruby() click to toggle source

Uninstall the Ruby runtime. Must be implemented by subclass.

@abstract @return [void]

# File lib/poise_ruby/ruby_providers/base.rb, line 99
def uninstall_ruby
end