Class: RubyConfig::RuntimeBase
- Inherits:
-
Object
- Object
- RubyConfig::RuntimeBase
- Defined in:
- lib/ruby_config/runtime_base.rb
Direct Known Subclasses
RubyConfig::Runtimes::JRubyRuntime, RubyConfig::Runtimes::LeopardRuntime, RubyConfig::Runtimes::Ruby186Runtime, RubyConfig::Runtimes::Ruby187Runtime, RubyConfig::Runtimes::Ruby19Runtime, RubyConfig::Runtimes::RubyEnterpriseEditionRuntime
Instance Attribute Summary collapse
-
#install_path ⇒ Object
readonly
Returns the value of attribute install_path.
-
#tmp_path ⇒ Object
readonly
Returns the value of attribute tmp_path.
Instance Method Summary collapse
-
#additional_library_path ⇒ Object
aka site_ruby.
- #already_installed? ⇒ Boolean
-
#archive_download_url ⇒ Object
download url of ruby runtime.
-
#archive_file_name ⇒ Object
name of ruby runtime archive.
- #archive_path ⇒ Object
- #create_directory_structure ⇒ Object
- #default_library_path ⇒ Object
- #delete ⇒ Object
- #description ⇒ Object
- #do_install ⇒ Object
- #gem_bin_path ⇒ Object
- #gem_executable_path ⇒ Object
- #gem_home_path ⇒ Object
-
#handle ⇒ Object
technical name used to select runtime.
-
#initialize(install_path, tmp_path) ⇒ RuntimeBase
constructor
A new instance of RuntimeBase.
-
#install ⇒ Object
called after the archive was successfully downloaded to tmp/archive_file_name directory you might want to: * extract archive * configure && make && make install.
- #irb_executable_path ⇒ Object
-
#major_version ⇒ Object
example: 1.8 or 1.9.
-
#post_install ⇒ Object
called after: * runtime.install * switch to newly installed runtime * rubygems installation.
- #prepare_install ⇒ Object
- #ruby_bin_path ⇒ Object
- #ruby_executable_path ⇒ Object
-
#ruby_home_path ⇒ Object
hash (key: alias name, value: alias bash script) def bash_alias;{};end.
- #rubygems_installed? ⇒ Boolean
-
#runtime_specific_gems ⇒ Object
optional Array of gem names of type string.
- #to_s ⇒ Object
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_path ⇒ Object (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_path ⇒ Object (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_path ⇒ Object
aka site_ruby
99 100 101 |
# File 'lib/ruby_config/runtime_base.rb', line 99 def additional_library_path File.join(ruby_home_path, 'lib', 'ruby', 'site_ruby', major_version) end |
#already_installed? ⇒ Boolean
111 112 113 |
# File 'lib/ruby_config/runtime_base.rb', line 111 def already_installed? Pathname.new(File.join(ruby_bin_path, 'ruby')).exist? end |
#archive_download_url ⇒ Object
download url of ruby runtime
42 43 44 |
# File 'lib/ruby_config/runtime_base.rb', line 42 def archive_download_url raise "Not implemented yet!" end |
#archive_file_name ⇒ Object
name of ruby runtime archive
37 38 39 |
# File 'lib/ruby_config/runtime_base.rb', line 37 def archive_file_name raise "Not implemented yet!" end |
#archive_path ⇒ Object
125 126 127 |
# File 'lib/ruby_config/runtime_base.rb', line 125 def archive_path File.join(@tmp_path, archive_file_name) end |
#create_directory_structure ⇒ Object
119 120 121 122 123 |
# File 'lib/ruby_config/runtime_base.rb', line 119 def create_directory_structure [@install_path, @tmp_path, ruby_home_path, ruby_bin_path, gem_home_path].each do |path| FileUtils.mkdir_p(path) end end |
#default_library_path ⇒ Object
103 104 105 |
# File 'lib/ruby_config/runtime_base.rb', line 103 def default_library_path File.join(ruby_home_path, 'lib', 'ruby', major_version) end |
#delete ⇒ Object
115 116 117 |
# File 'lib/ruby_config/runtime_base.rb', line 115 def delete FileUtils.remove_entry_secure(@install_path) end |
#description ⇒ Object
51 52 53 |
# File 'lib/ruby_config/runtime_base.rb', line 51 def description raise "Not implemented yet!" end |
#do_install ⇒ Object
12 13 14 15 |
# File 'lib/ruby_config/runtime_base.rb', line 12 def do_install prepare_install install end |
#gem_bin_path ⇒ Object
81 82 83 |
# File 'lib/ruby_config/runtime_base.rb', line 81 def gem_bin_path File.join(gem_home_path, 'bin') end |
#gem_executable_path ⇒ Object
89 90 91 92 |
# File 'lib/ruby_config/runtime_base.rb', line 89 def gem_executable_path puts "entering RuntimeBase::gem_executable_path.." File.join(ruby_bin_path, 'gem') end |
#gem_home_path ⇒ Object
77 78 79 |
# File 'lib/ruby_config/runtime_base.rb', line 77 def gem_home_path File.join(@install_path, 'gem') end |
#handle ⇒ Object
technical name used to select runtime
47 48 49 |
# File 'lib/ruby_config/runtime_base.rb', line 47 def handle raise "Not implemented yet!" end |
#install ⇒ Object
called after the archive was successfully downloaded to tmp/archive_file_name directory you might want to:
-
extract archive
-
configure && make && make install
21 22 23 |
# File 'lib/ruby_config/runtime_base.rb', line 21 def install raise "Not implemented yet!" end |
#irb_executable_path ⇒ Object
94 95 96 |
# File 'lib/ruby_config/runtime_base.rb', line 94 def irb_executable_path File.join(ruby_bin_path, 'irb') end |
#major_version ⇒ Object
example: 1.8 or 1.9
62 63 64 |
# File 'lib/ruby_config/runtime_base.rb', line 62 def major_version '1.8' end |
#post_install ⇒ Object
called after:
-
runtime.install
-
switch to newly installed runtime
-
rubygems installation
you might want to:
-
install additional rubygems
-
set symlinks
33 34 |
# File 'lib/ruby_config/runtime_base.rb', line 33 def post_install end |
#prepare_install ⇒ Object
129 130 131 132 |
# File 'lib/ruby_config/runtime_base.rb', line 129 def prepare_install create_directory_structure download_archive unless archive_exists? end |
#ruby_bin_path ⇒ Object
73 74 75 |
# File 'lib/ruby_config/runtime_base.rb', line 73 def ruby_bin_path File.join(ruby_home_path, 'bin') end |
#ruby_executable_path ⇒ Object
85 86 87 |
# File 'lib/ruby_config/runtime_base.rb', line 85 def ruby_executable_path File.join(ruby_bin_path, 'ruby') end |
#ruby_home_path ⇒ Object
hash (key: alias name, value: alias bash script) def bash_alias;{};end
69 70 71 |
# File 'lib/ruby_config/runtime_base.rb', line 69 def ruby_home_path File.join(@install_path, 'ruby') end |
#rubygems_installed? ⇒ Boolean
134 135 136 |
# File 'lib/ruby_config/runtime_base.rb', line 134 def rubygems_installed? File.exists?(gem_executable_path) end |
#runtime_specific_gems ⇒ Object
optional Array of gem names of type string
57 58 59 |
# File 'lib/ruby_config/runtime_base.rb', line 57 def runtime_specific_gems [] end |
#to_s ⇒ Object
107 108 109 |
# File 'lib/ruby_config/runtime_base.rb', line 107 def to_s "#{description} [#{handle}]" end |