fdietz-ruby-config 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.8.0
@@ -18,7 +18,7 @@ module RubyConfig
18
18
  def install(runtime)
19
19
  runtime.do_install
20
20
 
21
- # TOOD: only cleanup runtime-specific files
21
+ # TODO: only cleanup runtime-specific files
22
22
  cleanup_tmp_dir
23
23
  end
24
24
 
@@ -27,10 +27,19 @@ module RubyConfig
27
27
 
28
28
  runtime.post_install
29
29
 
30
- # install thyself
31
- @rubygems.gem_install(RUBY_CONFIG_GEM_NAME)
30
+ # TODO: check gem installation
31
+ begin
32
+ # install thyself
33
+ @rubygems.gem_install(RUBY_CONFIG_GEM_NAME, runtime)
34
+ rescue Exception => e
35
+ puts "Error when trying to install fdietz-ruby-config gem: #{e.message}"
36
+ end
32
37
 
33
- runtime.runtime_specific_gems.each { |gem| @rubygems.gem_install(gem) }
38
+ begin
39
+ runtime.runtime_specific_gems.each { |gem| @rubygems.gem_install(gem, runtime) }
40
+ rescue Exception => e
41
+ puts "Error when trying to install #{runtime.runtime_specific_gems.join(',')} gems: #{e.message}"
42
+ end
34
43
  end
35
44
 
36
45
  def runtime_install_path
@@ -186,33 +186,21 @@ module RubyConfig
186
186
  end
187
187
 
188
188
  def print_use_results(runtime)
189
- puts "env:"
190
- puts " RUBY_HOME=#{runtime.ruby_home_path}"
191
- puts " GEM_HOME=#{runtime.gem_home_path}"
192
-
193
- # unless runtime.bash_alias.empty?
194
- # puts "\nalias:"
195
- # print_alias(runtime.bash_alias)
196
- # end
189
+ puts "gem env:"
190
+ display_gem_env(runtime)
197
191
 
198
192
  puts "\nruby -v:"
199
- display_system_ruby_version
193
+ display_ruby_version(runtime)
200
194
  end
201
-
202
- # def print_alias(hash)
203
- # hash.each do |key, value|
204
- # puts " alias #{key}=\"#{value}\""
205
- # end
206
- # end
207
-
208
- def display_ruby_version(runtime)
209
- puts "Running: #{runtime}"
195
+
196
+ def display_gem_env(runtime)
197
+ system("#{runtime.gem_executable_path} env")
210
198
  end
211
199
 
212
- def display_system_ruby_version
213
- system "ruby -v"
200
+ def display_ruby_version(runtime)
201
+ system("#{runtime.ruby_executable_path} -v")
214
202
  end
215
-
203
+
216
204
  def abort(message)
217
205
  puts message
218
206
  exit
@@ -29,7 +29,7 @@ module RubyConfig
29
29
  end
30
30
  str
31
31
  end
32
-
32
+
33
33
  private
34
34
 
35
35
  def content_for_new_script
@@ -19,9 +19,8 @@ module RubyConfig
19
19
  ruby_gems_setup(archive_path, runtime.ruby_executable_path, runtime.additional_library_path)
20
20
  end
21
21
 
22
- def gem_install(gem_technical_name)
23
- gem_executable_path = File.join(@ruby_config_path, 'gem')
24
- system "GEM_HOME=#{gem_executable_path} gem install -q --no-ri --no-rdoc #{gem_technical_name}"
22
+ def gem_install(gem_technical_name, runtime)
23
+ system "#{runtime.gem_executable_path} install -q --no-ri --no-rdoc #{gem_technical_name}"
25
24
  end
26
25
 
27
26
  private
@@ -29,8 +28,10 @@ module RubyConfig
29
28
  # system("ruby setup.rb --prefix=#{additional_library_path}")
30
29
  def ruby_gems_setup(path, ruby_executable_path, additional_library_path)
31
30
  FileUtils.cd(path)
32
- puts "ruby executable path: #{ruby_executable_path}"
33
- system("#{ruby_executable_path} setup.rb --prefix=#{additional_library_path}")
31
+ # puts "ruby executable path: #{ruby_executable_path}"
32
+ # system("#{ruby_executable_path} setup.rb --prefix=#{additional_library_path}")
33
+ # system("#{ruby_executable_path} setup.rb")
34
+ system("setup.rb")
34
35
  end
35
36
 
36
37
  def extract_tar_gz(tgz_archive_path, destination_path)
@@ -78,14 +78,23 @@ module RubyConfig
78
78
  File.join(@install_path, 'gem')
79
79
  end
80
80
 
81
+ def gem_bin_path
82
+ File.join(gem_home_path, 'bin')
83
+ end
84
+
81
85
  def ruby_executable_path
82
86
  File.join(ruby_bin_path, 'ruby')
83
87
  end
84
88
 
85
89
  def gem_executable_path
90
+ puts "entering RuntimeBase::gem_executable_path.."
86
91
  File.join(ruby_bin_path, 'gem')
87
92
  end
88
93
 
94
+ def irb_executable_path
95
+ File.join(ruby_bin_path, 'irb')
96
+ end
97
+
89
98
  # aka site_ruby
90
99
  def additional_library_path
91
100
  File.join(ruby_home_path, 'lib', 'ruby', 'site_ruby', major_version)
@@ -25,7 +25,11 @@ module RubyConfig
25
25
  def archive_download_url
26
26
  JRUBY_DOWNLOAD_URL
27
27
  end
28
-
28
+
29
+ def gem_home_path
30
+ File.join(ruby_home_path, 'lib', 'ruby', 'site_ruby', major_version)
31
+ end
32
+
29
33
  # only required for nailgun support
30
34
  # def bash_alias
31
35
  # {'ruby_ng', 'jruby --ng',
@@ -37,6 +37,11 @@ module RubyConfig
37
37
  RubyConfig::Runtimes::RubyFromSourceHelper.compile(File.join(@tmp_path, ARCHIVE_PATH), ruby_home_path)
38
38
  end
39
39
 
40
+ # def gem_executable_path
41
+ # puts "entering Ruby186Runtime::gem_executable_path.."
42
+ # File.join(additional_library_path, 'bin', 'gem')
43
+ # end
44
+
40
45
  end
41
46
 
42
47
  end
@@ -33,6 +33,10 @@ module RubyConfig
33
33
  def archive_download_url
34
34
  RubyConfig::Runtimes::RubyFromSourceHelper.download_url(MAJOR_VERSION, MINOR_VERSION, PATCH_LEVEL)
35
35
  end
36
+
37
+ def gem_executable_path
38
+ File.join(ruby_bin_path, 'gem')
39
+ end
36
40
 
37
41
  def install
38
42
  extract_tar_gz(File.join(@tmp_path, archive_file_name), @tmp_path)
@@ -28,16 +28,19 @@ module RubyConfig
28
28
  RUBY_ENTERPRISE_EDITION_DOWNLOAD_URL
29
29
  end
30
30
 
31
+ # def gem_home_path
32
+ # File.join(ruby_home_path, 'lib', 'ruby', 'site_ruby', major_version)
33
+ # end
34
+
31
35
  def install
32
36
  extract_tar_gz(File.join(@tmp_path, archive_file_name), @tmp_path)
33
37
 
34
38
  ree_installer
35
39
  end
40
+
36
41
 
37
42
  private
38
43
  def ree_installer
39
- puts "path= #{File.join(@tmp_path, RUBY_ENTERPRISE_EDITION_DIR)}"
40
- puts File.exists?(File.join(@tmp_path, RUBY_ENTERPRISE_EDITION_DIR))
41
44
  FileUtils.cd(File.join(@tmp_path, RUBY_ENTERPRISE_EDITION_DIR))
42
45
  system("./installer -a #{@install_path}/ruby --dont-install-useful-gems")
43
46
  end
@@ -17,9 +17,20 @@ module RubyConfig
17
17
  def set_symlinks_to_runtime(runtime)
18
18
  delete_existing_symlinks
19
19
  create_symlinks(runtime)
20
+ set_environment(runtime)
20
21
  end
21
22
 
22
23
  private
24
+
25
+ # will only apply for current ruby-config process
26
+ # after ruby-config exits bash profile will take over again
27
+ def set_environment(runtime)
28
+ ENV['RUBY_HOME'] = runtime.ruby_home_path
29
+ ENV['GEM_HOME'] = runtime.gem_home_path
30
+ #ENV['GEM_PATH'] = runtime.gem_home_path
31
+ ENV['PATH'] = "#{runtime.ruby_bin_path}:#{runtime.gem_bin_path}:#{ENV['PATH']}"
32
+ end
33
+
23
34
  def ruby_path
24
35
  File.join(@ruby_config_path, "ruby")
25
36
  end
@@ -35,7 +46,7 @@ module RubyConfig
35
46
 
36
47
  def delete_existing_symlinks
37
48
  [ruby_path, gem_path].each do |path|
38
- File.delete(path) if File.exist?(path)
49
+ FileUtils.remove_entry_secure(path) if File.exist?(path)
39
50
  end
40
51
  end
41
52
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fdietz-ruby-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frederik Dietz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-05 00:00:00 -07:00
12
+ date: 2009-09-27 00:00:00 -07:00
13
13
  default_executable: ruby-config
14
14
  dependencies: []
15
15
 
@@ -45,6 +45,7 @@ files:
45
45
  - lib/ruby_config/switcher.rb
46
46
  has_rdoc: true
47
47
  homepage: http://github.com/fdietz/ruby-config
48
+ licenses:
48
49
  post_install_message:
49
50
  rdoc_options:
50
51
  - --charset=UTF-8
@@ -65,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
66
  requirements: []
66
67
 
67
68
  rubyforge_project:
68
- rubygems_version: 1.2.0
69
+ rubygems_version: 1.3.5
69
70
  signing_key:
70
71
  specification_version: 2
71
72
  summary: Install and Switch between various Ruby Runtimes easily