Module: PangeaRubyBuild

Includes:
PangeaBase
Defined in:
lib/pangea/modules.rb

Constant Summary collapse

BIN =
%(ruby-build).freeze
RUBY_BUILD_DIR =
File.join(
  BASE_DIR,
  %(rbenv)
)

Constants included from PangeaBase

PangeaBase::BASE_DIR

Class Method Summary collapse

Class Method Details

.bundle_install(mpath, gemset_path) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/pangea/modules.rb', line 76

def bundle_install(mpath, gemset_path)
  @bundlebin = File.join(gemset_path, %(bin), %(bundle))
  bundlehint = File.join(gemset_path, %(bundle_hint))
  unless File.exist?(bundlehint)
    cmd = [
      # %(cd #{mpath} &&),
      %(BUNDLE_GEMFILE=#{File.join(mpath, %(Gemfile))}), @bundlebin,
      %(install)
    ].join(%( ))
    system cmd
    system [%(touch), bundlehint].join(%( ))
  end
end

.gem_install(gem, ruby_version, gem_version, gemset_path) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/pangea/modules.rb', line 68

def gem_install(gem, ruby_version, gem_version, gemset_path)
  gem_path = File.join(gemset_path, %(lib), %(ruby), %(gems), ruby_version.to_s, %(gems), %(#{gem}-#{gem_version}))
  unless Dir.exist?(gem_path)
    gembin = File.join(gemset_path, %(bin), %(gem))
    system [gembin, %(install), gem.to_s.strip, %(-v), gem_version.to_s].join(%( ))
  end
end

.ruby_build(version, path) ⇒ Object



63
64
65
66
# File 'lib/pangea/modules.rb', line 63

def ruby_build(version, path)
  system %(mkdir -p #{PangeaRbenv.versions_dir}) unless Dir.exist?(PangeaRbenv.versions_dir)
  system [BIN, version.to_s, path.to_s].join(%( )) if ruby_build_installed? && !Dir.exist?(File.join(path.to_s))
end

.ruby_build_installed?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/pangea/modules.rb', line 59

def ruby_build_installed?
  `which rbenv`.strip != ''
end