summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/commands/build_command.rb41
-rw-r--r--lib/rubygems/commands/push_command.rb2
-rw-r--r--lib/rubygems/gemcutter_utilities.rb4
-rw-r--r--lib/rubygems/rdoc.rb4
-rw-r--r--lib/rubygems/request.rb1
-rw-r--r--lib/rubygems/resolver.rb2
-rw-r--r--lib/rubygems/specification.rb3
-rw-r--r--lib/rubygems/test_case.rb2
-rw-r--r--lib/rubygems/validator.rb27
-rw-r--r--test/rubygems/test_gem.rb5
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb15
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb2
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb2
-rw-r--r--test/rubygems/test_gem_request.rb11
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb51
-rw-r--r--test/rubygems/test_gem_specification.rb4
18 files changed, 103 insertions, 76 deletions
@@ -9,7 +9,7 @@
require 'rbconfig'
module Gem
- VERSION = "3.0.2".freeze
end
# Must be first since it unloads the prelude from 1.9.2
@@ -18,6 +18,10 @@ class Gem::Commands::BuildCommand < Gem::Command
add_option '-o', '--output FILE', 'output gem with the given filename' do |value, options|
options[:output] = value
end
end
def arguments # :nodoc:
@@ -60,25 +64,36 @@ Gems can be saved to a specified filename with the output option:
end
if File.exist? gemspec
- Dir.chdir(File.dirname(gemspec)) do
- spec = Gem::Specification.load File.basename(gemspec)
-
- if spec
- Gem::Package.build(
- spec,
- options[:force],
- options[:strict],
- options[:output]
- )
- else
- alert_error "Error loading gemspec. Aborting."
- terminate_interaction 1
end
end
else
alert_error "Gemspec file not found: #{gemspec}"
terminate_interaction 1
end
end
end
@@ -15,6 +15,8 @@ https://rubygems.org) and adds it to the index.
The gem can be removed from the index and deleted from the server using the yank
command. For further discussion see the help for the yank command.
EOF
end
@@ -38,7 +38,9 @@ module Gem::GemcutterUtilities
# The API key from the command options or from the user's configuration.
def api_key
- if options[:key]
verify_api_key options[:key]
elsif Gem.configuration.api_keys.key?(host)
Gem.configuration.api_keys[host]
@@ -18,7 +18,7 @@ begin
module Gem
RDoc = ::RDoc::RubygemsHook
end
rescue LoadError
end
-
-Gem.done_installing(&Gem::RDoc.method(:generation_hook))
@@ -168,6 +168,7 @@ class Gem::Request
no_env_proxy = env_proxy.nil? || env_proxy.empty?
return get_proxy_from_env 'http' if no_env_proxy and _scheme != 'http'
return :no_proxy if no_env_proxy
@@ -231,8 +231,6 @@ class Gem::Resolver
raise exc
end
- sources = []
-
groups = Hash.new { |hash, key| hash[key] = [] }
# create groups & sources in the same loop
@@ -1285,7 +1285,7 @@ class Gem::Specification < Gem::BasicSpecification
unresolved = unresolved_deps
unless unresolved.empty?
w = "W" + "ARN"
- warn "#{w}: Unresolved or ambigious specs during Gem::Specification.reset:"
unresolved.values.each do |dep|
warn " #{dep}"
@@ -2254,6 +2254,7 @@ class Gem::Specification < Gem::BasicSpecification
attributes.each do |attr_name|
current_value = self.send attr_name
if current_value != default_value(attr_name) or
self.class.required_attribute? attr_name
@@ -1057,6 +1057,8 @@ Also, a list:
Gem.instance_variable_set :@platforms, nil
Gem::Platform.instance_variable_set :@local, nil
platform
end
@@ -19,29 +19,6 @@ class Gem::Validator
require 'find'
end
- ##
- # Given a gem file's contents, validates against its own MD5 checksum
- # gem_data:: [String] Contents of the gem file
-
- def verify_gem(gem_data)
- # TODO remove me? The code here only validate an MD5SUM that was
- # in some old formatted gems, but hasn't been for a long time.
- end
-
- ##
- # Given the path to a gem file, validates against its own MD5 checksum
- #
- # gem_path:: [String] Path to gem file
-
- def verify_gem_file(gem_path)
- File.open gem_path, Gem.binary_mode do |file|
- gem_data = file.read
- verify_gem gem_data
- end
- rescue Errno::ENOENT, Errno::EINVAL
- raise Gem::VerificationError, "missing gem file #{gem_path}"
- end
-
private
def find_files_for_gem(gem_directory)
@@ -105,7 +82,9 @@ class Gem::Validator
end
begin
- verify_gem_file(gem_path)
good, gone, unreadable = nil, nil, nil, nil
@@ -156,7 +156,7 @@ class TestGem < Gem::TestCase
end
def assert_self_install_permissions
- mask = /mingw|mswin/ =~ RUBY_PLATFORM ? 0700 : 0777
options = {
:dir_mode => 0500,
:prog_mode => 0510,
@@ -198,6 +198,9 @@ class TestGem < Gem::TestCase
'gems/foo-1/bin/foo.cmd' => prog_mode,
'gems/foo-1/data/foo.txt' => data_mode,
}
result = {}
Dir.chdir @gemhome do
expected.each_key do |n|
@@ -207,6 +207,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
gs.write @gem.to_ruby
end
@cmd.options[:args] = [gemspec_file]
use_ui @ui do
@@ -199,6 +199,21 @@ class TestGemCommandsPushCommand < Gem::TestCase
send_battery
end
def test_sending_gem_to_allowed_push_host_with_basic_credentials
@sanitized_host = "http://privategemserver.example"
@host = "http://user:[email protected]"
@@ -10,7 +10,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
if File.exist?(bundler_gemspec)
BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1]
else
- BUNDLER_VERS = "1.16.2".freeze
end
def setup
@@ -25,7 +25,7 @@ class TestGemExtCmakeBuilder < Gem::TestCase
File.open File.join(@ext, 'CMakeLists.txt'), 'w' do |cmakelists|
cmakelists.write <<-eo_cmake
cmake_minimum_required(VERSION 2.6)
-project(self_build LANGUAGES NONE)
install (FILES test.txt DESTINATION bin)
eo_cmake
end
@@ -79,6 +79,17 @@ class TestGemRequest < Gem::TestCase
assert_equal URI(@proxy_uri), proxy
end
def test_configure_connection_for_https
connection = Net::HTTP.new 'localhost', 443
@@ -652,20 +652,23 @@ end
end
def test_platform_mswin
- util_set_arch 'i686-darwin8.10.1' do
- @gda.platform :mswin do
- @gda.gem 'a'
end
- assert_empty @set.dependencies
- end
-
- util_set_arch 'x86-mswin32-60' do
- @gda.platform :mswin do
- @gda.gem 'a'
end
-
- refute_empty @set.dependencies
end
end
@@ -708,26 +711,20 @@ end
end
def test_platforms
- util_set_arch 'i686-darwin8.10.1' do
- @gda.platforms :ruby do
- @gda.gem 'a'
- end
- assert_equal [dep('a')], @set.dependencies
- @gda.platforms :mswin do
- @gda.gem 'b'
- end
- assert_equal [dep('a')], @set.dependencies
- end
-
- util_set_arch 'x86-mswin32-60' do
- @gda.platforms :mswin do
- @gda.gem 'c'
end
-
- assert_equal [dep('a'), dep('c')], @set.dependencies
end
end
@@ -2936,7 +2936,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
end
expected = <<-EXPECTED
-WARN: Unresolved or ambigious specs during Gem::Specification.reset:
x (= 1)
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
@@ -2964,7 +2964,7 @@ Please report a bug if this causes problems.
end
expected = <<-EXPECTED
-WARN: Unresolved or ambigious specs during Gem::Specification.reset:
x (= 1)
Available/installed versions of this gem:
- 1