Class: RubyConfig::RuntimeBase

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_config/runtime_base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(install_path, tmp_path) ⇒ RuntimeBase

Returns a new instance of RuntimeBase.



7
8
9
10
# File 'lib/ruby_config/runtime_base.rb', line 7

def initialize(install_path, tmp_path)
  @install_path = File.join(install_path, handle)
  @tmp_path = tmp_path
end

Instance Attribute Details

#install_pathObject (readonly)

Returns the value of attribute install_path.



5
6
7
# File 'lib/ruby_config/runtime_base.rb', line 5

def install_path
  @install_path
end

#tmp_pathObject (readonly)

Returns the value of attribute tmp_path.



5
6
7
# File 'lib/ruby_config/runtime_base.rb', line 5

def tmp_path
  @tmp_path
end

Instance Method Details

#additional_library_pathObject

aka site_ruby



88
89
90
# File 'lib/ruby_config/runtime_base.rb', line 88

def additional_library_path
  File.join(ruby_home_path, 'lib', 'ruby', 'site_ruby', major_version)
end

#already_installed?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/ruby_config/runtime_base.rb', line 100

def already_installed?
   Pathname.new(File.join(ruby_bin_path, 'ruby')).exist?
end

#archive_download_urlObject

download url of ruby runtime



46
47
48
# File 'lib/ruby_config/runtime_base.rb', line 46

def archive_download_url
  raise "Not implemented yet!"
end

#archive_file_nameObject

name of ruby runtime archive



41
42
43
# File 'lib/ruby_config/runtime_base.rb', line 41

def archive_file_name
  raise "Not implemented yet!"
end

#bash_aliasObject

hash (key: alias name, value: alias bash script)



65
# File 'lib/ruby_config/runtime_base.rb', line 65

def bash_alias;{};end

#default_library_pathObject



92
93
94
# File 'lib/ruby_config/runtime_base.rb', line 92

def default_library_path
  File.join(ruby_home_path, 'lib', 'ruby', major_version)
end

#deleteObject



104
105
106
# File 'lib/ruby_config/runtime_base.rb', line 104

def delete
  FileUtils.remove_entry_secure(@install_path)
end

#descriptionObject



55
56
57
# File 'lib/ruby_config/runtime_base.rb', line 55

def description
  raise "Not implemented yet!"
end

#do_installObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/ruby_config/runtime_base.rb', line 12

def do_install
  create_directory_structure
  
  download_file_unless_exists(archive_file_name, archive_download_url)
  
  # runtime specific installation part
  install
      
  cleanup_tmp_dir
end

#do_post_installObject



27
28
29
30
31
32
33
34
# File 'lib/ruby_config/runtime_base.rb', line 27

def do_post_install
  post_install
  
  install_rubygems unless File.exists?(gem_executable_path)
  
  # install thyselve
  #install_gem('ruby-config')
end

#gem_executable_pathObject



83
84
85
# File 'lib/ruby_config/runtime_base.rb', line 83

def gem_executable_path
  File.join(ruby_bin_path, 'gem')
end

#gem_home_pathObject



75
76
77
# File 'lib/ruby_config/runtime_base.rb', line 75

def gem_home_path
  File.join(@install_path, 'gem')
end

#handleObject

technical name used to select runtime



51
52
53
# File 'lib/ruby_config/runtime_base.rb', line 51

def handle
  raise "Not implemented yet!"
end

#installObject



23
24
25
# File 'lib/ruby_config/runtime_base.rb', line 23

def install
  raise "Not implemented yet!"
end

#major_versionObject

example: 1.8 or 1.9



60
61
62
# File 'lib/ruby_config/runtime_base.rb', line 60

def major_version
  '1.8'
end

#post_installObject

called after install and runtime is enabled



37
38
# File 'lib/ruby_config/runtime_base.rb', line 37

def post_install
end

#ruby_bin_pathObject



71
72
73
# File 'lib/ruby_config/runtime_base.rb', line 71

def ruby_bin_path
  File.join(ruby_home_path, 'bin')
end

#ruby_executable_pathObject



79
80
81
# File 'lib/ruby_config/runtime_base.rb', line 79

def ruby_executable_path
  File.join(ruby_bin_path, 'ruby')
end

#ruby_home_pathObject



67
68
69
# File 'lib/ruby_config/runtime_base.rb', line 67

def ruby_home_path
  File.join(@install_path, 'ruby')
end

#to_sObject



96
97
98
# File 'lib/ruby_config/runtime_base.rb', line 96

def to_s
  "#{description} [#{handle}]"
end