rubygems-update 3.2.0 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{History.txt → CHANGELOG.md} +482 -457
- data/Manifest.txt +31 -27
- data/POLICIES.md +4 -3
- data/Rakefile +23 -18
- data/bundler/CHANGELOG.md +67 -20
- data/bundler/bundler.gemspec +1 -1
- data/bundler/lib/bundler.rb +8 -2
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +3 -6
- data/bundler/lib/bundler/cli/gem.rb +2 -0
- data/bundler/lib/bundler/cli/install.rb +14 -5
- data/bundler/lib/bundler/cli/outdated.rb +2 -2
- data/bundler/lib/bundler/cli/update.rb +1 -1
- data/bundler/lib/bundler/compact_index_client/cache.rb +5 -13
- data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +0 -8
- data/bundler/lib/bundler/definition.rb +24 -21
- data/bundler/lib/bundler/dependency.rb +3 -1
- data/bundler/lib/bundler/gem_helper.rb +3 -3
- data/bundler/lib/bundler/gem_helpers.rb +30 -24
- data/bundler/lib/bundler/lazy_specification.rb +16 -3
- data/bundler/{man → lib/bundler/man}/bundle-add.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-cache.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-check.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-clean.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-config.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-exec.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-gem.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-info.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-init.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-inject.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-install.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-list.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-lock.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-open.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-platform.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-remove.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-show.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-update.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle-viz.1 +0 -0
- data/bundler/{man → lib/bundler/man}/bundle.1 +0 -0
- data/bundler/{man → lib/bundler/man}/gemfile.5 +0 -0
- data/bundler/{man → lib/bundler/man}/index.txt +0 -0
- data/bundler/lib/bundler/resolver.rb +29 -27
- data/bundler/lib/bundler/resolver/spec_group.rb +19 -25
- data/bundler/lib/bundler/rubygems_integration.rb +0 -6
- data/bundler/lib/bundler/source/git.rb +18 -16
- data/bundler/lib/bundler/source/git/git_proxy.rb +54 -49
- data/bundler/lib/bundler/source/path/installer.rb +2 -0
- data/bundler/lib/bundler/source/rubygems.rb +10 -1
- data/bundler/lib/bundler/spec_set.rb +5 -8
- data/bundler/lib/bundler/stub_specification.rb +0 -2
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +8 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +1 -1
- data/lib/rubygems/commands/owner_command.rb +0 -1
- data/lib/rubygems/commands/push_command.rb +0 -1
- data/lib/rubygems/commands/setup_command.rb +16 -62
- data/lib/rubygems/commands/yank_command.rb +0 -1
- data/lib/rubygems/dependency_installer.rb +1 -0
- data/lib/rubygems/ext/builder.rb +3 -3
- data/lib/rubygems/ext/cmake_builder.rb +1 -2
- data/lib/rubygems/ext/configure_builder.rb +1 -2
- data/lib/rubygems/ext/rake_builder.rb +1 -1
- data/lib/rubygems/gemcutter_utilities.rb +22 -17
- data/lib/rubygems/installer.rb +0 -23
- data/lib/rubygems/remote_fetcher.rb +4 -2
- data/lib/rubygems/request_set.rb +2 -13
- data/lib/rubygems/resolver.rb +6 -1
- data/lib/rubygems/resolver/api_set.rb +29 -20
- data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
- data/lib/rubygems/resolver/api_specification.rb +4 -3
- data/lib/rubygems/resolver/best_set.rb +2 -2
- data/lib/rubygems/resolver/index_specification.rb +18 -0
- data/lib/rubygems/resolver/installer_set.rb +57 -7
- data/lib/rubygems/resolver/spec_specification.rb +14 -0
- data/lib/rubygems/resolver/specification.rb +12 -0
- data/lib/rubygems/server.rb +6 -1
- data/lib/rubygems/source.rb +11 -6
- data/lib/rubygems/specification.rb +18 -14
- data/lib/rubygems/test_case.rb +17 -4
- data/lib/rubygems/test_utilities.rb +6 -5
- data/rubygems-update.gemspec +2 -2
- data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
- data/test/rubygems/test_gem_commands_install_command.rb +131 -0
- data/test/rubygems/test_gem_commands_push_command.rb +41 -2
- data/test/rubygems/test_gem_commands_setup_command.rb +21 -37
- data/test/rubygems/test_gem_dependency_installer.rb +27 -47
- data/test/rubygems/test_gem_ext_builder.rb +6 -6
- data/test/rubygems/test_gem_ext_cmake_builder.rb +2 -4
- data/test/rubygems/test_gem_ext_configure_builder.rb +2 -2
- data/test/rubygems/test_gem_ext_rake_builder.rb +25 -0
- data/test/rubygems/test_gem_installer.rb +6 -60
- data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
- data/test/rubygems/test_gem_resolver_api_set.rb +54 -51
- data/test/rubygems/test_gem_resolver_api_specification.rb +3 -3
- data/test/rubygems/test_gem_resolver_best_set.rb +26 -3
- data/test/rubygems/test_gem_source.rb +2 -2
- data/test/rubygems/test_gem_source_subpath_problem.rb +2 -2
- data/test/rubygems/test_gem_specification.rb +9 -3
- data/test/test_changelog_generator.rb +17 -0
- metadata +38 -58
@@ -182,6 +182,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
182
182
|
@@default_value[k].nil?
|
183
183
|
end
|
184
184
|
|
185
|
+
@@stubs = nil
|
185
186
|
@@stubs_by_name = {}
|
186
187
|
|
187
188
|
# Sentinel object to represent "not found" stubs
|
@@ -800,10 +801,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
800
801
|
def self.stubs
|
801
802
|
@@stubs ||= begin
|
802
803
|
pattern = "*.gemspec"
|
803
|
-
stubs =
|
804
|
-
stubs = stubs.uniq {|stub| stub.full_name }
|
804
|
+
stubs = stubs_for_pattern(pattern, false)
|
805
805
|
|
806
|
-
_resort!(stubs)
|
807
806
|
@@stubs_by_name = stubs.select {|s| Gem::Platform.match_spec? s }.group_by(&:name)
|
808
807
|
stubs
|
809
808
|
end
|
@@ -820,26 +819,31 @@ class Gem::Specification < Gem::BasicSpecification
|
|
820
819
|
end
|
821
820
|
end
|
822
821
|
|
823
|
-
EMPTY = [].freeze # :nodoc:
|
824
|
-
|
825
822
|
##
|
826
823
|
# Returns a Gem::StubSpecification for installed gem named +name+
|
827
824
|
# only returns stubs that match Gem.platforms
|
828
825
|
|
829
826
|
def self.stubs_for(name)
|
830
|
-
if @@
|
831
|
-
@@stubs_by_name[name]
|
827
|
+
if @@stubs
|
828
|
+
@@stubs_by_name[name] || []
|
832
829
|
else
|
833
|
-
|
834
|
-
stubs = installed_stubs(dirs, pattern).select {|s| Gem::Platform.match_spec? s } + default_stubs(pattern)
|
835
|
-
stubs = stubs.uniq {|stub| stub.full_name }.group_by(&:name)
|
836
|
-
stubs.each_value {|v| _resort!(v) }
|
837
|
-
|
838
|
-
@@stubs_by_name.merge! stubs
|
839
|
-
@@stubs_by_name[name] ||= EMPTY
|
830
|
+
@@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec")
|
840
831
|
end
|
841
832
|
end
|
842
833
|
|
834
|
+
##
|
835
|
+
# Finds stub specifications matching a pattern from the standard locations,
|
836
|
+
# optionally filtering out specs not matching the current platform
|
837
|
+
#
|
838
|
+
def self.stubs_for_pattern(pattern, match_platform = true) # :nodoc:
|
839
|
+
installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
|
840
|
+
installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
|
841
|
+
stubs = installed_stubs + default_stubs(pattern)
|
842
|
+
stubs = stubs.uniq {|stub| stub.full_name }
|
843
|
+
_resort!(stubs)
|
844
|
+
stubs
|
845
|
+
end
|
846
|
+
|
843
847
|
def self._resort!(specs) # :nodoc:
|
844
848
|
specs.sort! do |a, b|
|
845
849
|
names = a.name <=> b.name
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -26,7 +26,20 @@ begin
|
|
26
26
|
rescue LoadError
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
if File.exist?(bundler_gemspec)
|
30
|
+
require_relative '../../bundler/lib/bundler'
|
31
|
+
else
|
32
|
+
require 'bundler'
|
33
|
+
end
|
34
|
+
|
35
|
+
# Enable server plugin needed for bisection
|
36
|
+
if ENV["RG_BISECT_SERVER_PLUGIN"]
|
37
|
+
require ENV["RG_BISECT_SERVER_PLUGIN"]
|
38
|
+
|
39
|
+
Minitest.extensions << "server"
|
40
|
+
end
|
41
|
+
|
42
|
+
ENV["MT_NO_PLUGINS"] = "true"
|
30
43
|
|
31
44
|
require 'minitest/autorun'
|
32
45
|
|
@@ -250,16 +263,16 @@ class Gem::TestCase < Minitest::Test
|
|
250
263
|
def assert_contains_make_command(target, output, msg = nil)
|
251
264
|
if output.match(/\n/)
|
252
265
|
msg = message(msg) do
|
253
|
-
|
266
|
+
"Expected output containing make command \"%s\", but was \n\nBEGIN_OF_OUTPUT\n%sEND_OF_OUTPUT" % [
|
254
267
|
('%s %s' % [make_command, target]).rstrip,
|
255
|
-
output
|
268
|
+
output,
|
256
269
|
]
|
257
270
|
end
|
258
271
|
else
|
259
272
|
msg = message(msg) do
|
260
273
|
'Expected make command "%s": %s' % [
|
261
274
|
('%s %s' % [make_command, target]).rstrip,
|
262
|
-
output
|
275
|
+
output,
|
263
276
|
]
|
264
277
|
end
|
265
278
|
end
|
@@ -38,7 +38,7 @@ class Gem::FakeFetcher
|
|
38
38
|
@paths = []
|
39
39
|
end
|
40
40
|
|
41
|
-
def find_data(path
|
41
|
+
def find_data(path)
|
42
42
|
return Gem.read_binary path.path if URI === path and 'file' == path.scheme
|
43
43
|
|
44
44
|
if URI === path and "URI::#{path.scheme.upcase}" != path.class.name
|
@@ -54,10 +54,11 @@ class Gem::FakeFetcher
|
|
54
54
|
raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
|
55
55
|
end
|
56
56
|
|
57
|
-
data
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
if @data[path].kind_of?(Array) && @data[path].first.kind_of?(Array)
|
58
|
+
@data[path].shift
|
59
|
+
else
|
60
|
+
@data[path]
|
61
|
+
end
|
61
62
|
end
|
62
63
|
|
63
64
|
def fetch_path(path, mtime = nil, head = false)
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.2.
|
5
|
+
s.version = "3.2.5"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.require_paths = ["hide_lib_for_update"]
|
22
22
|
s.rdoc_options = ["--main", "README.md", "--title=RubyGems Update Documentation"]
|
23
23
|
s.extra_rdoc_files = [
|
24
|
-
"
|
24
|
+
"CHANGELOG.md", "LICENSE.txt", "MAINTAINERS.txt",
|
25
25
|
"MIT.txt", "Manifest.txt", "README.md",
|
26
26
|
"UPGRADING.md", "POLICIES.md", "CODE_OF_CONDUCT.md",
|
27
27
|
"CONTRIBUTING.md", "bundler/CHANGELOG.md",
|
Binary file
|
@@ -504,6 +504,137 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
504
504
|
assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
|
505
505
|
end
|
506
506
|
|
507
|
+
def test_execute_required_ruby_version
|
508
|
+
next_ruby = Gem.ruby_version.segments.map.with_index{|n, i| i == 1 ? n + 1 : n }.join(".")
|
509
|
+
|
510
|
+
local = Gem::Platform.local
|
511
|
+
spec_fetcher do |fetcher|
|
512
|
+
fetcher.download 'a', 2
|
513
|
+
fetcher.download 'a', 2 do |s|
|
514
|
+
s.required_ruby_version = "< #{RUBY_VERSION}.a"
|
515
|
+
s.platform = local
|
516
|
+
end
|
517
|
+
fetcher.download 'a', 3 do |s|
|
518
|
+
s.required_ruby_version = ">= #{next_ruby}"
|
519
|
+
end
|
520
|
+
fetcher.download 'a', 3 do |s|
|
521
|
+
s.required_ruby_version = ">= #{next_ruby}"
|
522
|
+
s.platform = local
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
@cmd.options[:args] = %w[a]
|
527
|
+
|
528
|
+
use_ui @ui do
|
529
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
530
|
+
@cmd.execute
|
531
|
+
end
|
532
|
+
end
|
533
|
+
|
534
|
+
assert_equal %w[a-2], @cmd.installed_specs.map {|spec| spec.full_name }
|
535
|
+
end
|
536
|
+
|
537
|
+
def test_execute_required_ruby_version_upper_bound
|
538
|
+
local = Gem::Platform.local
|
539
|
+
spec_fetcher do |fetcher|
|
540
|
+
fetcher.gem 'a', 2.0
|
541
|
+
fetcher.gem 'a', 2.0 do |s|
|
542
|
+
s.required_ruby_version = "< #{RUBY_VERSION}.a"
|
543
|
+
s.platform = local
|
544
|
+
end
|
545
|
+
end
|
546
|
+
|
547
|
+
@cmd.options[:args] = %w[a]
|
548
|
+
|
549
|
+
use_ui @ui do
|
550
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
551
|
+
@cmd.execute
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
assert_equal %w[a-2.0], @cmd.installed_specs.map {|spec| spec.full_name }
|
556
|
+
end
|
557
|
+
|
558
|
+
def test_execute_required_ruby_version_specific_not_met
|
559
|
+
spec_fetcher do |fetcher|
|
560
|
+
fetcher.gem 'a', '1.0' do |s|
|
561
|
+
s.required_ruby_version = '= 1.4.6'
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
@cmd.options[:args] = %w[a]
|
566
|
+
|
567
|
+
use_ui @ui do
|
568
|
+
assert_raises Gem::MockGemUi::TermError do
|
569
|
+
@cmd.execute
|
570
|
+
end
|
571
|
+
end
|
572
|
+
|
573
|
+
errs = @ui.error.split("\n")
|
574
|
+
assert_equal "ERROR: Error installing a:", errs.shift
|
575
|
+
assert_equal "\ta-1.0 requires Ruby version = 1.4.6. The current ruby version is #{Gem.ruby_version}.", errs.shift
|
576
|
+
end
|
577
|
+
|
578
|
+
def test_execute_required_ruby_version_specific_prerelease_met
|
579
|
+
spec_fetcher do |fetcher|
|
580
|
+
fetcher.gem 'a', '1.0' do |s|
|
581
|
+
s.required_ruby_version = '>= 1.4.6.preview2'
|
582
|
+
end
|
583
|
+
end
|
584
|
+
|
585
|
+
@cmd.options[:args] = %w[a]
|
586
|
+
|
587
|
+
use_ui @ui do
|
588
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
589
|
+
@cmd.execute
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
assert_equal %w[a-1.0], @cmd.installed_specs.map {|spec| spec.full_name }
|
594
|
+
end
|
595
|
+
|
596
|
+
def test_execute_required_ruby_version_specific_prerelease_not_met
|
597
|
+
next_ruby_pre = Gem.ruby_version.segments.map.with_index{|n, i| i == 1 ? n + 1 : n }.join(".") + ".a"
|
598
|
+
|
599
|
+
spec_fetcher do |fetcher|
|
600
|
+
fetcher.gem 'a', '1.0' do |s|
|
601
|
+
s.required_ruby_version = "> #{next_ruby_pre}"
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
@cmd.options[:args] = %w[a]
|
606
|
+
|
607
|
+
use_ui @ui do
|
608
|
+
assert_raises Gem::MockGemUi::TermError do
|
609
|
+
@cmd.execute
|
610
|
+
end
|
611
|
+
end
|
612
|
+
|
613
|
+
errs = @ui.error.split("\n")
|
614
|
+
assert_equal "ERROR: Error installing a:", errs.shift
|
615
|
+
assert_equal "\ta-1.0 requires Ruby version > #{next_ruby_pre}. The current ruby version is #{Gem.ruby_version}.", errs.shift
|
616
|
+
end
|
617
|
+
|
618
|
+
def test_execute_required_rubygems_version_wrong
|
619
|
+
spec_fetcher do |fetcher|
|
620
|
+
fetcher.gem 'a', '1.0' do |s|
|
621
|
+
s.required_rubygems_version = '< 0'
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
@cmd.options[:args] = %w[a]
|
626
|
+
|
627
|
+
use_ui @ui do
|
628
|
+
assert_raises Gem::MockGemUi::TermError do
|
629
|
+
@cmd.execute
|
630
|
+
end
|
631
|
+
end
|
632
|
+
|
633
|
+
errs = @ui.error.split("\n")
|
634
|
+
assert_equal "ERROR: Error installing a:", errs.shift
|
635
|
+
assert_equal "\ta-1.0 requires RubyGems version < 0. The current RubyGems version is #{Gem.rubygems_version}. Try 'gem update --system' to update RubyGems itself.", errs.shift
|
636
|
+
end
|
637
|
+
|
507
638
|
def test_execute_rdoc
|
508
639
|
specs = spec_fetcher do |fetcher|
|
509
640
|
fetcher.gem 'a', 2
|
@@ -404,11 +404,13 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
404
404
|
assert_equal '111111', @fetcher.last_request['OTP']
|
405
405
|
end
|
406
406
|
|
407
|
-
def
|
407
|
+
def test_sending_gem_unathorized_api_key_with_mfa_enabled
|
408
|
+
response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
|
408
409
|
response_forbidden = "The API key doesn't have access"
|
409
410
|
response_success = 'Successfully registered gem: freewill (1.0.0)'
|
410
411
|
|
411
412
|
@fetcher.data["#{@host}/api/v1/gems"] = [
|
413
|
+
[response_mfa_enabled, 401, 'Unauthorized'],
|
412
414
|
[response_forbidden, 403, 'Forbidden'],
|
413
415
|
[response_success, 200, "OK"],
|
414
416
|
]
|
@@ -417,17 +419,54 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
417
419
|
@cmd.instance_variable_set :@host, @host
|
418
420
|
@cmd.instance_variable_set :@scope, :push_rubygem
|
419
421
|
|
420
|
-
@ui = Gem::MockGemUi.new "
|
422
|
+
@ui = Gem::MockGemUi.new "11111\nsome@mail.com\npass\n"
|
421
423
|
use_ui @ui do
|
422
424
|
@cmd.send_gem(@path)
|
423
425
|
end
|
424
426
|
|
427
|
+
mfa_notice = "You have enabled multi-factor authentication. Please enter OTP code."
|
425
428
|
access_notice = "The existing key doesn't have access of push_rubygem on https://rubygems.example. Please sign in to update access."
|
429
|
+
assert_match mfa_notice, @ui.output
|
426
430
|
assert_match access_notice, @ui.output
|
427
431
|
assert_match "Email:", @ui.output
|
428
432
|
assert_match "Password:", @ui.output
|
429
433
|
assert_match "Added push_rubygem scope to the existing API key", @ui.output
|
430
434
|
assert_match response_success, @ui.output
|
435
|
+
assert_equal '11111', @fetcher.last_request['OTP']
|
436
|
+
end
|
437
|
+
|
438
|
+
def test_sending_gem_with_no_local_creds
|
439
|
+
Gem.configuration.rubygems_api_key = nil
|
440
|
+
|
441
|
+
response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
|
442
|
+
response_success = 'Successfully registered gem: freewill (1.0.0)'
|
443
|
+
|
444
|
+
@fetcher.data["#{@host}/api/v1/gems"] = [
|
445
|
+
[response_success, 200, "OK"],
|
446
|
+
]
|
447
|
+
|
448
|
+
@fetcher.data["#{@host}/api/v1/api_key"] = [
|
449
|
+
[response_mfa_enabled, 401, 'Unauthorized'],
|
450
|
+
["", 200, "OK"],
|
451
|
+
]
|
452
|
+
|
453
|
+
@cmd.instance_variable_set :@scope, :push_rubygem
|
454
|
+
@cmd.options[:args] = [@path]
|
455
|
+
@cmd.options[:host] = @host
|
456
|
+
|
457
|
+
@ui = Gem::MockGemUi.new "some@mail.com\npass\n11111\n"
|
458
|
+
use_ui @ui do
|
459
|
+
@cmd.execute
|
460
|
+
end
|
461
|
+
|
462
|
+
mfa_notice = "You have enabled multi-factor authentication. Please enter OTP code."
|
463
|
+
assert_match mfa_notice, @ui.output
|
464
|
+
assert_match "Enter your https://rubygems.example credentials.", @ui.output
|
465
|
+
assert_match "Email:", @ui.output
|
466
|
+
assert_match "Password:", @ui.output
|
467
|
+
assert_match "Signed in with API key:", @ui.output
|
468
|
+
assert_match response_success, @ui.output
|
469
|
+
assert_equal '11111', @fetcher.last_request['OTP']
|
431
470
|
end
|
432
471
|
|
433
472
|
private
|
@@ -24,14 +24,15 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
24
24
|
lib/rubygems/test_case.rb
|
25
25
|
lib/rubygems/ssl_certs/rubygems.org/foo.pem
|
26
26
|
bundler/exe/bundle
|
27
|
+
bundler/exe/bundler
|
27
28
|
bundler/lib/bundler.rb
|
28
29
|
bundler/lib/bundler/b.rb
|
30
|
+
bundler/bin/bundler/man/bundle-b.1
|
29
31
|
bundler/lib/bundler/man/bundle-b.1.ronn
|
32
|
+
bundler/lib/bundler/man/gemfile.5
|
30
33
|
bundler/lib/bundler/man/gemfile.5.ronn
|
31
34
|
bundler/lib/bundler/templates/.circleci/config.yml
|
32
35
|
bundler/lib/bundler/templates/.travis.yml
|
33
|
-
bundler/man/bundle-b.1
|
34
|
-
bundler/man/gemfile.5
|
35
36
|
]
|
36
37
|
|
37
38
|
create_dummy_files(filelist)
|
@@ -41,7 +42,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
41
42
|
gemspec.name = "bundler"
|
42
43
|
gemspec.version = BUNDLER_VERS
|
43
44
|
gemspec.bindir = "exe"
|
44
|
-
gemspec.executables = ["bundle"]
|
45
|
+
gemspec.executables = ["bundle", "bundler"]
|
45
46
|
|
46
47
|
File.open 'bundler/bundler.gemspec', 'w' do |io|
|
47
48
|
io.puts gemspec.to_ruby
|
@@ -135,6 +136,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
135
136
|
exec_line = out.shift until exec_line == "RubyGems installed the following executables:"
|
136
137
|
assert_equal "\t#{default_gem_bin_path}", out.shift
|
137
138
|
assert_equal "\t#{default_bundle_bin_path}", out.shift
|
139
|
+
assert_equal "\t#{default_bundler_bin_path}", out.shift
|
138
140
|
end
|
139
141
|
|
140
142
|
def test_env_shebang_flag
|
@@ -152,6 +154,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
152
154
|
bin_env = win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " "
|
153
155
|
assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_gem_bin_path)
|
154
156
|
assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_bundle_bin_path)
|
157
|
+
assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_bundler_bin_path)
|
155
158
|
assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(gem_bin_path)
|
156
159
|
end
|
157
160
|
|
@@ -160,16 +163,6 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
160
163
|
@cmd.files_in('lib').sort
|
161
164
|
end
|
162
165
|
|
163
|
-
def test_bundler_man1_files_in
|
164
|
-
assert_equal %w[bundle-b.1],
|
165
|
-
@cmd.bundler_man1_files_in('bundler/man').sort
|
166
|
-
end
|
167
|
-
|
168
|
-
def test_bundler_man5_files_in
|
169
|
-
assert_equal %w[gemfile.5],
|
170
|
-
@cmd.bundler_man5_files_in('bundler/man').sort
|
171
|
-
end
|
172
|
-
|
173
166
|
def test_install_lib
|
174
167
|
@cmd.extend FileUtils
|
175
168
|
|
@@ -187,19 +180,6 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
187
180
|
end
|
188
181
|
end
|
189
182
|
|
190
|
-
def test_install_man
|
191
|
-
@cmd.extend FileUtils
|
192
|
-
|
193
|
-
Dir.mktmpdir 'man' do |dir|
|
194
|
-
@cmd.install_man dir
|
195
|
-
|
196
|
-
assert_path_exists File.join("#{dir}/man1", 'bundle-b.1')
|
197
|
-
refute_path_exists File.join("#{dir}/man1", 'bundle-b.1.ronn')
|
198
|
-
assert_path_exists File.join("#{dir}/man5", 'gemfile.5')
|
199
|
-
refute_path_exists File.join("#{dir}/man5", 'gemfile.5.ronn')
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
183
|
def test_install_default_bundler_gem
|
204
184
|
@cmd.extend FileUtils
|
205
185
|
|
@@ -308,8 +288,8 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
308
288
|
gemfile_5_ronn = File.join man, 'man5', 'gemfile.5.ronn'
|
309
289
|
gemfile_5_txt = File.join man, 'man5', 'gemfile.5.txt'
|
310
290
|
|
311
|
-
files_that_go = [bundle_b_1_txt, bundle_b_1_ronn, gemfile_5_txt, gemfile_5_ronn]
|
312
|
-
files_that_stay = [ruby_1
|
291
|
+
files_that_go = [bundle_b_1, bundle_b_1_txt, bundle_b_1_ronn, gemfile_5, gemfile_5_txt, gemfile_5_ronn]
|
292
|
+
files_that_stay = [ruby_1]
|
313
293
|
|
314
294
|
create_dummy_files(files_that_go + files_that_stay)
|
315
295
|
|
@@ -326,22 +306,22 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
326
306
|
|
327
307
|
@cmd.options[:previous_version] = Gem::Version.new '2.0.2'
|
328
308
|
|
329
|
-
File.open '
|
309
|
+
File.open 'CHANGELOG.md', 'w' do |io|
|
330
310
|
io.puts <<-HISTORY_TXT
|
331
|
-
|
311
|
+
# #{Gem::VERSION} / 2013-03-26
|
332
312
|
|
333
|
-
|
313
|
+
## Bug fixes:
|
334
314
|
* Fixed release note display for LANG=C when installing rubygems
|
335
315
|
* π is tasty
|
336
316
|
|
337
|
-
|
317
|
+
# 2.0.2 / 2013-03-06
|
338
318
|
|
339
|
-
|
319
|
+
## Bug fixes:
|
340
320
|
* Other bugs fixed
|
341
321
|
|
342
|
-
|
322
|
+
# 2.0.1 / 2013-03-05
|
343
323
|
|
344
|
-
|
324
|
+
## Bug fixes:
|
345
325
|
* Yet more bugs fixed
|
346
326
|
HISTORY_TXT
|
347
327
|
end
|
@@ -351,9 +331,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
351
331
|
end
|
352
332
|
|
353
333
|
expected = <<-EXPECTED
|
354
|
-
|
334
|
+
# #{Gem::VERSION} / 2013-03-26
|
355
335
|
|
356
|
-
|
336
|
+
## Bug fixes:
|
357
337
|
* Fixed release note display for LANG=C when installing rubygems
|
358
338
|
* π is tasty
|
359
339
|
|
@@ -410,4 +390,8 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
410
390
|
def default_bundle_bin_path
|
411
391
|
File.join @install_dir, 'bin', 'bundle'
|
412
392
|
end
|
393
|
+
|
394
|
+
def default_bundler_bin_path
|
395
|
+
File.join @install_dir, 'bin', 'bundler'
|
396
|
+
end
|
413
397
|
end unless Gem.java_platform?
|