Class: SandBox

Inherits:
Object
  • Object
show all
Defined in:
lib/pangea/sandbox.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, base_dir: %(~/.pangea/sandbox), rubies: []) ⇒ SandBox

Returns a new instance of SandBox.



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/pangea/sandbox.rb', line 23

def initialize(
  name:,
  base_dir: %(~/.pangea/sandbox),
  rubies: []
)
  @base_dir = base_dir
  @name     = name
  @rubies   = rubies

  @rubies_dir = File.join(@base_dir, @name, %(rubies))

  @ruby_build_cmd = %(ruby-build)
end

Instance Method Details

#clean_sandboxObject



44
45
46
# File 'lib/pangea/sandbox.rb', line 44

def clean_sandbox
  system %(rm -rf #{base_dir})
end

#prepare_sandboxObject



37
38
39
40
41
42
# File 'lib/pangea/sandbox.rb', line 37

def prepare_sandbox
  ensure_base_dir_exists
  ensure_rubies_directories_exist
  check_ruby_build_installed
  ensure_rubies_installed
end