Sha256: c5154d630099b34ef019aca0cb005fc0cf288dc19f6498ca484ce1eac0c9991d

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

module Brewmaster
  class RubyCollection
    def initialize(rubies)
      @rubies = rubies
    end

    def install_missing
      missing.each {|v| install_version(v)}
    end

    def missing
      (@rubies - self.class.installed).select {|v| available?(v)}
    end

    def available?(version)
      self.class.available_versions.include?(version)
    end

    def install_version(v)
      `ruby-build #{v} ~/.rubies/#{v}`
    end

    def self.installed
      `ls ~/.rubies/`.split
    end

    def self.available_versions
      `ruby-build --definitions`.split
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brewmaster-0.0.2 lib/brewmaster/ruby_collection.rb
brewmaster-0.0.1 lib/brewmaster/ruby_collection.rb