class PoiseRuby::RubyProviders::System

Public Class Methods

default_inversion_options(node, resource) click to toggle source
# File lib/poise_ruby/ruby_providers/system.rb, line 50
def self.default_inversion_options(node, resource)
  super.merge({
    # Install a separate rubygems package? Only needed for 1.8.
    rubygems_package: node['platform_family'] == 'rhel' && node['platform_version'].start_with?('6'),
  })
end

Public Instance Methods

ruby_binary() click to toggle source

Output value for the Python binary we are installing. Seems to match package name on all platforms I've checked.

# File lib/poise_ruby/ruby_providers/system.rb, line 59
def ruby_binary
  ::File.join('', 'usr', 'bin', system_package_name)
end

Private Instance Methods

install_ruby() click to toggle source
# File lib/poise_ruby/ruby_providers/system.rb, line 65
def install_ruby
  install_system_packages
  install_rubygems_package if options['rubygems_package']
end
install_rubygems_package() click to toggle source

Install the configured rubygems package.

# File lib/poise_ruby/ruby_providers/system.rb, line 83
def install_rubygems_package
  package (options['rubygems_package'].is_a?(String) ? options['rubygems_package'] : 'rubygems')
end
system_dev_package_overrides() click to toggle source

Ubuntu has no ruby1.9.3-dev package.

Calls superclass method
# File lib/poise_ruby/ruby_providers/system.rb, line 75
def system_dev_package_overrides
  super.tap do |overrides|
    # WTF Ubuntu, seriously.
    overrides['ruby1.9.3'] = 'ruby1.9.1-dev' if node.platform_family?('debian')
  end
end
system_package_candidates(version) click to toggle source
# File lib/poise_ruby/ruby_providers/system.rb, line 87
def system_package_candidates(version)
  [].tap do |names|
    # Might as well try it.
    names << "ruby#{version}" if version && !['', '1', '2'].include?(version)
    # On debian, 1.9.1 and 1.9.3 have special packages.
    if match = version.match(/^(\d+\.\d+\.\d+)/)
      names << "ruby#{match[1]}"
    end
    # Normal debian package like ruby2.0.
    if match = version.match(/^(\d+\.\d+)/)
      names << "ruby#{match[1]}"
    end
    # Aliases for ruby1 and ruby2
    if version == '2' || version == ''
      # 2.3 is on there for future proofing. Well, at least giving me a
      # buffer zone.
      names.concat(%w{ruby2.3 ruby2.2 ruby2.1 ruby2.0})
    end
    if version == '1' || version == ''
      names.concat(%w{ruby1.9.3 ruby1.9 ruby1.8})
    end
    # For RHEL and friends.
    names << 'ruby'
    names.uniq!
  end
end
uninstall_ruby() click to toggle source
# File lib/poise_ruby/ruby_providers/system.rb, line 70
def uninstall_ruby
  uninstall_system_packages
end