summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-06 13:40:39 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-06 13:40:39 -0800
commitf509b90e060c5d1d44534cdf0dff3fa3f31e3ffb (patch)
treeb44b8c5f830e5fd8d5720cea39aba0caa41d3f30
parent391d5a59a86d15deb00c540a7536cbd2f80007ea (diff)
downloadruby-f509b90e060c5d1d44534cdf0dff3fa3f31e3ffb.tar.gz
ruby-f509b90e060c5d1d44534cdf0dff3fa3f31e3ffb.tar.bz2
ruby-f509b90e060c5d1d44534cdf0dff3fa3f31e3ffb.zip
buildroot
-rw-r--r--lib/rubygems/dependency_installer.rb2
-rw-r--r--lib/rubygems/install_update_options.rb6
-rw-r--r--lib/rubygems/installer.rb9
3 files changed, 17 insertions, 0 deletions
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index 6303e8e..71ad393 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -69,6 +69,7 @@ class Gem::DependencyInstaller
@installed_gems = []
@install_dir = options[:install_dir] || Gem.dir
+ @build_root = options[:build_root]
@cache_dir = options[:cache_dir] || @install_dir
# Set with any errors that SpecFetcher finds while search through
@@ -290,6 +291,7 @@ class Gem::DependencyInstaller
:format_executable => @format_executable,
:ignore_dependencies => @ignore_dependencies,
:install_dir => @install_dir,
+ :build_root => @build_root,
:security_policy => @security_policy,
:user_install => @user_install,
:wrappers => @wrappers
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index 3ee6432..53e867c 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -44,6 +44,12 @@ module Gem::InstallUpdateOptions
options[:bin_dir] = File.expand_path(value)
end
+ add_option(:"Install/Update", '--build-root DIR',
+ 'Temporary installation root. Useful for building',
+ 'packages. Do not use this when installing remote gems.') do |value, options|
+ options[:build_root] = File.expand_path(value)
+ end
+
add_option(:"Install/Update", '-d', '--[no-]rdoc',
'Generate RDoc documentation for the gem on',
'install') do |value, options|
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 31fb120..24b9555 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -427,9 +427,18 @@ class Gem::Installer
@wrappers = options[:wrappers]
@bin_dir = options[:bin_dir]
@development = options[:development]
+ @build_root = options[:build_root]
raise "NOTE: Installer option :source_index is dead" if
options[:source_index]
+
+ unless @build_root.nil?
+ require 'pathname'
+ @build_root = Pathname.new(@build_root).expand_path
+ @bin_dir = File.join(@build_root, options[:bin_dir] || Gem.bindir(@gem_home))
+ @gem_home = File.join(@build_root,@gem_home)
+ alert_warning "You build with buildroot.\n Build root: #{@build_root}\n Bin dir: #{@bin_dir}\n Gem home: #{@gem_home}"
+ end
end
def check_that_user_bin_dir_is_in_path