summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands')
-rw-r--r--lib/rubygems/commands/build_command.rb8
-rw-r--r--lib/rubygems/commands/fetch_command.rb13
-rw-r--r--lib/rubygems/commands/pristine_command.rb6
-rw-r--r--lib/rubygems/commands/setup_command.rb19
-rw-r--r--lib/rubygems/commands/specification_command.rb26
5 files changed, 13 insertions, 59 deletions
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index 36a6fe48f2..572a5c36ec 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -4,11 +4,7 @@ require 'rubygems/builder'
class Gem::Commands::BuildCommand < Gem::Command
def initialize
- super 'build', 'Build a gem from a gemspec'
-
- add_option '--force', 'skip validation of the spec' do |value, options|
- options[:force] = true
- end
+ super('build', 'Build a gem from a gemspec')
end
def arguments # :nodoc:
@@ -26,7 +22,7 @@ class Gem::Commands::BuildCommand < Gem::Command
spec = load_gemspec gemspec
if spec then
- Gem::Builder.new(spec).build options[:force]
+ Gem::Builder.new(spec).build
else
alert_error "Error loading gemspec. Aborting."
terminate_interaction 1
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb
index e7c9cc9525..666d83e730 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -13,7 +13,6 @@ class Gem::Commands::FetchCommand < Gem::Command
add_bulk_threshold_option
add_proxy_option
add_source_option
- add_clear_sources_option
add_version_option
add_platform_option
@@ -59,16 +58,8 @@ class Gem::Commands::FetchCommand < Gem::Command
next
end
- file = "#{spec.full_name}.gem"
- remote_path = URI.parse(source_uri) + "gems/#{file}"
-
- fetch = Gem::RemoteFetcher.fetcher
-
- gem = fetch.fetch_path remote_path.to_s
-
- File.open file, "wb" do |f|
- f.write gem
- end
+ path = Gem::RemoteFetcher.fetcher.download spec, source_uri
+ FileUtils.mv path, File.basename(spec.cache_file)
say "Downloaded #{spec.full_name}"
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 83e6cc7a67..272a4dd18e 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -94,14 +94,10 @@ extensions.
end
# TODO use installer options
- install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS['install']
- installer_env_shebang = install_defaults.to_s['--env-shebang']
-
installer = Gem::Installer.new(gem,
:wrappers => true,
:force => true,
- :install_dir => spec.base_dir,
- :env_shebang => installer_env_shebang)
+ :install_dir => spec.base_dir)
installer.install
say "Restored #{spec.full_name}"
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 0c957393d9..52a3b88fe3 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -252,19 +252,9 @@ TEXT
end
def make_destination_dirs(install_destdir)
- lib_dir, bin_dir = Gem.default_rubygems_dirs
+ lib_dir = nil
+ bin_dir = nil
- unless lib_dir
- lib_dir, bin_dir = generate_default_dirs(install_destdir)
- end
-
- mkdir_p lib_dir
- mkdir_p bin_dir
-
- return lib_dir, bin_dir
- end
-
- def generate_default_dirs(install_destdir)
prefix = options[:prefix]
site_or_vendor = options[:site_or_vendor]
@@ -293,7 +283,10 @@ TEXT
bin_dir = File.join install_destdir, bin_dir.gsub(/^[a-zA-Z]:/, '')
end
- [lib_dir, bin_dir]
+ mkdir_p lib_dir
+ mkdir_p bin_dir
+
+ return lib_dir, bin_dir
end
def remove_old_bin_files(bin_dir)
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index 566a9cc66e..921fd519e9 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -62,25 +62,7 @@ FIELD name of gemspec field to show
"Please specify a gem name or file on the command line"
end
- case options[:version]
- when String
- req = Gem::Requirement.parse options[:version]
- when Gem::Requirement
- req = options[:version]
- else
- raise Gem::CommandLineError, "Unsupported version type: #{options[:version]}"
- end
-
- if !req.none? and options[:all]
- alert_error "Specify --all or -v, not both"
- terminate_interaction 1
- end
-
- if options[:all]
- dep = Gem::Dependency.new gem
- else
- dep = Gem::Dependency.new gem, options[:version]
- end
+ dep = Gem::Dependency.new gem, options[:version]
field = get_one_optional_argument
@@ -98,11 +80,7 @@ FIELD name of gemspec field to show
end
if remote? then
- found = Gem::SpecFetcher.fetcher.fetch dep, true
-
- if dep.prerelease? or options[:prerelease]
- found += Gem::SpecFetcher.fetcher.fetch dep, false, true, true
- end
+ found = Gem::SpecFetcher.fetcher.fetch dep
specs.push(*found.map { |spec,| spec })
end