Sha256: d70800b2c3018abafb142761401c883aaed446bc0bca1e4a82b9abc75e9a96a2

Contents?: true

Size: 644 Bytes

Versions: 4

Compression:

Stored size: 644 Bytes

Contents

require 'ruby/builder/revision'

module Ruby
  module Builder
    class << Rbenv = Module.new
      # @param [String] version
      def installed?(version)
        File.directory?(directory(version))
      end

      # @param [String] version
      def directory(version)
        File.join(rbenv_root, 'versions', version)
      end

      private

      def rbenv_root
        return @rbenv_root if defined?(@rbenv_root)

        @rbenv_root = IO.popen(['rbenv', 'root'], &:read).rstrip
        unless $?.success?
          abort "Failed to execute (exit status: #{$?}): rbenv root"
        end
        @rbenv_root
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-builder-0.1.3 lib/ruby/builder/rbenv.rb
ruby-builder-0.1.2 lib/ruby/builder/rbenv.rb
ruby-builder-0.1.1 lib/ruby/builder/rbenv.rb
ruby-builder-0.1.0 lib/ruby/builder/rbenv.rb