rubygems-update 3.2.22 → 3.2.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52d933727e75e688a2283b38dfbecc0997bd5ad8ae07735153c8c93fb868d1c2
4
- data.tar.gz: 932932f5c5ef970bbd45d918985cccab896094ab07b20e75665270a92a8f72fd
3
+ metadata.gz: 34d592c07f3fc05d6a1201bb1cd26e0ace4cbced2f6030cdc552a8f8fc2a384f
4
+ data.tar.gz: 4cc3ad43ce2aad0c4787622f521b1d10fac300dc68b17926067f26b69c64f558
5
5
  SHA512:
6
- metadata.gz: c362d63f528942ce0ef7fbc2f70bd48c640eff9a2237a223cd6e1fc1144760b0727dd45bf71655e2d67791dc4f4220dfae3a7ff936079cd6ebd12e800ef43312
7
- data.tar.gz: 5ceeb69663855c94864fad8a2ff609d1bd9307c946dcac81227eb6d537986faf326925118ab4c8692b435b15f8b05e63d3d859beb485a150e8069bb4e232f2c2
6
+ metadata.gz: 1e8ae581d0b154dc77f54c9235c186034a374f456d3f226157c6a9852389c047449cfb7d8959258fceef79ce6f6695d0aa2ad4c003c0cd4968f3fffa81c60c6a
7
+ data.tar.gz: fe0aa438ee051a2f4e66c309f3d5945d53deba4ddf63a2118ad68a859591c17a2b30dd9f88d76be84b99c167b34627da43c49ee3eca929ced2926a6ed6a8000a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 3.2.23 / 2021-07-09
2
+
3
+ ## Enhancements:
4
+
5
+ * Rewind IO source to allow working with contents in memory. Pull request
6
+ #4729 by drcapulet
7
+
1
8
  # 3.2.22 / 2021-07-06
2
9
 
3
10
  ## Enhancements:
data/Manifest.txt CHANGED
@@ -7,7 +7,6 @@ MIT.txt
7
7
  Manifest.txt
8
8
  POLICIES.md
9
9
  README.md
10
- Rakefile
11
10
  UPGRADING.md
12
11
  bin/gem
13
12
  bin/update_rubygems
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 2.2.23 (July 9, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Fix `bundle install` on truffleruby selecting incorrect variant for `sorbet-static` gem [#4625](https://github.com/rubygems/rubygems/pull/4625)
6
+ - Spare meaningless warning on read-only bundle invocations [#4724](https://github.com/rubygems/rubygems/pull/4724)
7
+
8
+ ## Bug fixes:
9
+
10
+ - Fix incorrect warning about duplicated gems in the Gemfile [#4732](https://github.com/rubygems/rubygems/pull/4732)
11
+ - Fix `bundle plugin install foo` crashing [#4734](https://github.com/rubygems/rubygems/pull/4734)
12
+
1
13
  # 2.2.22 (July 6, 2021)
2
14
 
3
15
  ## Enhancements:
@@ -236,8 +236,9 @@ module Bundler
236
236
  end
237
237
 
238
238
  if warning
239
- user_home = tmp_home_path(warning)
240
- Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
239
+ Bundler.ui.warn "#{warning}\n"
240
+ user_home = tmp_home_path
241
+ Bundler.ui.warn "Bundler will use `#{user_home}' as your home directory temporarily.\n"
241
242
  user_home
242
243
  else
243
244
  Pathname.new(home)
@@ -684,15 +685,13 @@ EOF
684
685
  Bundler.rubygems.clear_paths
685
686
  end
686
687
 
687
- def tmp_home_path(warning)
688
+ def tmp_home_path
688
689
  Kernel.send(:require, "tmpdir")
689
690
  SharedHelpers.filesystem_access(Dir.tmpdir) do
690
691
  path = Bundler.tmp
691
692
  at_exit { Bundler.rm_rf(path) }
692
693
  path
693
694
  end
694
- rescue RuntimeError => e
695
- raise e.exception("#{warning}\nBundler also failed to create a temporary home directory':\n#{e}")
696
695
  end
697
696
 
698
697
  # @param env [Hash]
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2021-07-06".freeze
8
- @git_commit_sha = "0bdd3e8e71".freeze
7
+ @built_at = "2021-07-09".freeze
8
+ @git_commit_sha = "e863a3905d".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -102,28 +102,26 @@ module Bundler
102
102
  # if there's already a dependency with this name we try to prefer one
103
103
  if current = @dependencies.find {|d| d.name == dep.name }
104
104
  deleted_dep = @dependencies.delete(current) if current.type == :development
105
+ return if deleted_dep
105
106
 
106
107
  if current.requirement != dep.requirement
107
- unless deleted_dep
108
- return if dep.type == :development
108
+ return if dep.type == :development
109
109
 
110
- update_prompt = ""
110
+ update_prompt = ""
111
111
 
112
- if File.basename(@gemfile) == Injector::INJECTED_GEMS
113
- if dep.requirements_list.include?(">= 0") && !current.requirements_list.include?(">= 0")
114
- update_prompt = ". Gem already added"
115
- else
116
- update_prompt = ". If you want to update the gem version, run `bundle update #{current.name}`"
112
+ if File.basename(@gemfile) == Injector::INJECTED_GEMS
113
+ if dep.requirements_list.include?(">= 0") && !current.requirements_list.include?(">= 0")
114
+ update_prompt = ". Gem already added"
115
+ else
116
+ update_prompt = ". If you want to update the gem version, run `bundle update #{current.name}`"
117
117
 
118
- update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current.requirements_list.include?(">= 0")
119
- end
118
+ update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current.requirements_list.include?(">= 0")
120
119
  end
121
-
122
- raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
123
- "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
124
- "#{update_prompt}"
125
120
  end
126
121
 
122
+ raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
123
+ "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
124
+ "#{update_prompt}"
127
125
  else
128
126
  Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
129
127
  "You should probably keep only one of them.\n" \
@@ -132,12 +130,10 @@ module Bundler
132
130
  end
133
131
 
134
132
  if current.source != dep.source
135
- unless deleted_dep
136
- return if dep.type == :development
137
- raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
138
- "You specified that #{dep.name} (#{dep.requirement}) should come from " \
139
- "#{current.source || "an unspecified source"} and #{dep.source}\n"
140
- end
133
+ return if dep.type == :development
134
+ raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
135
+ "You specified that #{dep.name} (#{dep.requirement}) should come from " \
136
+ "#{current.source || "an unspecified source"} and #{dep.source}\n"
141
137
  end
142
138
  end
143
139
 
@@ -195,11 +195,7 @@ module Bundler
195
195
  if base # allow all platforms when searching from a lockfile
196
196
  dependency.matches_spec?(spec)
197
197
  else
198
- if Gem::Platform.respond_to? :match_spec?
199
- dependency.matches_spec?(spec) && Gem::Platform.match_spec?(spec)
200
- else
201
- dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform)
202
- end
198
+ dependency.matches_spec?(spec) && Gem::Platform.match_spec?(spec)
203
199
  end
204
200
  end
205
201
 
@@ -77,7 +77,7 @@ module Bundler
77
77
  source_list = SourceList.new
78
78
 
79
79
  source_list.add_git_source(git_source_options) if git_source_options
80
- source_list.add_global_rubygems_remote(rubygems_source) if rubygems_source
80
+ Array(rubygems_source).each {|remote| source_list.add_global_rubygems_remote(remote) } if rubygems_source
81
81
 
82
82
  deps = names.map {|name| Dependency.new name, version }
83
83
 
@@ -174,20 +174,36 @@ module Gem
174
174
  end
175
175
  end
176
176
 
177
+ require "rubygems/platform"
178
+
177
179
  class Platform
178
180
  JAVA = Gem::Platform.new("java") unless defined?(JAVA)
179
181
  MSWIN = Gem::Platform.new("mswin32") unless defined?(MSWIN)
180
182
  MSWIN64 = Gem::Platform.new("mswin64") unless defined?(MSWIN64)
181
183
  MINGW = Gem::Platform.new("x86-mingw32") unless defined?(MINGW)
182
184
  X64_MINGW = Gem::Platform.new("x64-mingw32") unless defined?(X64_MINGW)
185
+ end
183
186
 
184
- undef_method :hash if method_defined? :hash
185
- def hash
186
- @cpu.hash ^ @os.hash ^ @version.hash
187
- end
187
+ Platform.singleton_class.module_eval do
188
+ unless Platform.singleton_methods.include?(:match_spec?)
189
+ def match_spec?(spec)
190
+ match_gem?(spec.platform, spec.name)
191
+ end
188
192
 
189
- undef_method :eql? if method_defined? :eql?
190
- alias_method :eql?, :==
193
+ def match_gem?(platform, gem_name)
194
+ match_platforms?(platform, Gem.platforms)
195
+ end
196
+
197
+ private
198
+
199
+ def match_platforms?(platform, platforms)
200
+ platforms.any? do |local_platform|
201
+ platform.nil? ||
202
+ local_platform == platform ||
203
+ (local_platform != Gem::Platform::RUBY && local_platform =~ platform)
204
+ end
205
+ end
206
+ end
191
207
  end
192
208
 
193
209
  require "rubygems/util"
@@ -428,12 +428,8 @@ module Bundler
428
428
  def global_config_file
429
429
  if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
430
430
  Pathname.new(ENV["BUNDLE_CONFIG"])
431
- else
432
- begin
433
- Bundler.user_bundle_path("config")
434
- rescue PermissionError, GenericSystemCallError
435
- nil
436
- end
431
+ elsif Bundler.rubygems.user_home && !Bundler.rubygems.user_home.empty?
432
+ Pathname.new(Bundler.rubygems.user_home).join(".bundle/config")
437
433
  end
438
434
  end
439
435
 
@@ -195,7 +195,7 @@ module Bundler
195
195
  def spec_for_dependency(dep, match_current_platform)
196
196
  specs_for_platforms = lookup[dep.name]
197
197
  if match_current_platform
198
- GemHelpers.select_best_platform_match(specs_for_platforms, Bundler.local_platform)
198
+ GemHelpers.select_best_platform_match(specs_for_platforms.select{|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
199
199
  else
200
200
  GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
201
201
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.2.22".freeze
4
+ VERSION = "2.2.23".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = "3.2.22".freeze
11
+ VERSION = "3.2.23".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -32,10 +32,14 @@ class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all
32
32
 
33
33
  def with_read_io
34
34
  yield io
35
+ ensure
36
+ io.rewind
35
37
  end
36
38
 
37
39
  def with_write_io
38
40
  yield io
41
+ ensure
42
+ io.rewind
39
43
  end
40
44
 
41
45
  def path
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.2.22"
5
+ s.version = "3.2.23"
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
 
@@ -48,7 +48,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
48
48
  io.puts gemspec.to_ruby
49
49
  end
50
50
 
51
- open(File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec"), 'w') do |io|
51
+ File.open(File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec"), 'w') do |io|
52
52
  gemspec.version = "1.15.4"
53
53
  io.puts gemspec.to_ruby
54
54
  end
@@ -730,7 +730,7 @@ gem 'other', version
730
730
  installer.generate_bin
731
731
 
732
732
  default_shebang = Gem.ruby
733
- shebang_line = open("#{@gemhome}/bin/executable") {|f| f.readlines.first }
733
+ shebang_line = File.open("#{@gemhome}/bin/executable") {|f| f.readlines.first }
734
734
  assert_match(/\A#!/, shebang_line)
735
735
  assert_match(/#{default_shebang}/, shebang_line)
736
736
  end
@@ -937,7 +937,7 @@ class TestGemPackage < Gem::Package::TarTestCase
937
937
  build = Gem::Package.new @gem
938
938
  build.spec = @spec
939
939
  build.setup_signer
940
- open @gem, 'wb' do |gem_io|
940
+ File.open @gem, 'wb' do |gem_io|
941
941
  Gem::Package::TarWriter.new gem_io do |gem|
942
942
  build.add_metadata gem
943
943
  build.add_contents gem
@@ -1145,6 +1145,13 @@ class TestGemPackage < Gem::Package::TarTestCase
1145
1145
  end
1146
1146
  end
1147
1147
 
1148
+ def test_contents_from_io
1149
+ io = StringIO.new Gem.read_binary @gem
1150
+ package = Gem::Package.new io
1151
+
1152
+ assert_equal %w[lib/code.rb], package.contents
1153
+ end
1154
+
1148
1155
  def util_tar
1149
1156
  tar_io = StringIO.new
1150
1157
 
@@ -365,7 +365,7 @@ class TestGemServer < Gem::TestCase
365
365
  specs_dir = File.join dir, 'specifications'
366
366
  FileUtils.mkdir_p specs_dir
367
367
 
368
- open File.join(specs_dir, spec.spec_name), 'w' do |io|
368
+ File.open File.join(specs_dir, spec.spec_name), 'w' do |io|
369
369
  io.write spec.to_ruby
370
370
  end
371
371
 
@@ -420,7 +420,7 @@ class TestGemServer < Gem::TestCase
420
420
  specs_dir = File.join dir, 'specifications'
421
421
  FileUtils.mkdir_p specs_dir
422
422
 
423
- open File.join(specs_dir, spec.spec_name), 'w' do |io|
423
+ File.open File.join(specs_dir, spec.spec_name), 'w' do |io|
424
424
  io.write spec.to_ruby
425
425
  end
426
426
 
@@ -475,7 +475,7 @@ class TestGemServer < Gem::TestCase
475
475
  specs_dir = File.join dir, 'specifications'
476
476
  FileUtils.mkdir_p specs_dir
477
477
 
478
- open File.join(specs_dir, spec.spec_name), 'w' do |io|
478
+ File.open File.join(specs_dir, spec.spec_name), 'w' do |io|
479
479
  io.write spec.to_ruby
480
480
  end
481
481
 
@@ -502,7 +502,7 @@ class TestGemServer < Gem::TestCase
502
502
  specs_dir = File.join dir, 'specifications'
503
503
  FileUtils.mkdir_p specs_dir
504
504
 
505
- open File.join(specs_dir, spec.spec_name), 'w' do |io|
505
+ File.open File.join(specs_dir, spec.spec_name), 'w' do |io|
506
506
  io.write spec.to_ruby
507
507
  end
508
508
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.22
4
+ version: 3.2.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2021-07-06 00:00:00.000000000 Z
19
+ date: 2021-07-09 00:00:00.000000000 Z
20
20
  dependencies: []
21
21
  description: |-
22
22
  A package (also known as a library) contains a set of functionality
@@ -63,7 +63,6 @@ files:
63
63
  - Manifest.txt
64
64
  - POLICIES.md
65
65
  - README.md
66
- - Rakefile
67
66
  - UPGRADING.md
68
67
  - bin/gem
69
68
  - bin/update_rubygems
@@ -772,7 +771,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
772
771
  - !ruby/object:Gem::Version
773
772
  version: '0'
774
773
  requirements: []
775
- rubygems_version: 3.2.22
774
+ rubygems_version: 3.2.23
776
775
  signing_key:
777
776
  specification_version: 4
778
777
  summary: RubyGems is a package management framework for Ruby.
data/Rakefile DELETED
@@ -1,401 +0,0 @@
1
- RakeFileUtils.verbose_flag = false
2
-
3
- require 'rubygems'
4
- require 'rubygems/package_task'
5
- require "rake/testtask"
6
- require 'psych'
7
-
8
- desc "Setup Rubygems dev environment"
9
- task :setup do
10
- sh "ruby", "-I", "lib", "bundler/spec/support/bundle.rb", "install", "--gemfile=dev_gems.rb"
11
- end
12
-
13
- desc "Update Rubygems dev environment"
14
- task :update do |_, args|
15
- sh "ruby", "-I", "lib", "bundler/spec/support/bundle.rb", "update", *args, "--gemfile=dev_gems.rb"
16
- end
17
-
18
- desc "Update the locked bundler version in dev environment"
19
- task :update_locked_bundler do |_, args|
20
- sh "ruby", "bundler/spec/support/bundle.rb", "update", "--bundler", "--gemfile=dev_gems.rb"
21
- sh "ruby", "bundler/spec/support/bundle.rb", "update", "--bundler", "--gemfile=bundler/tool/bundler/test_gems.rb"
22
- sh "ruby", "bundler/spec/support/bundle.rb", "update", "--bundler", "--gemfile=bundler/tool/bundler/rubocop_gems.rb"
23
- sh "ruby", "bundler/spec/support/bundle.rb", "update", "--bundler", "--gemfile=bundler/tool/bundler/rubocop23_gems.rb"
24
- end
25
-
26
- desc "Setup git hooks"
27
- task :git_hooks do
28
- sh "git config core.hooksPath .githooks"
29
- end
30
-
31
- Rake::TestTask.new do |t|
32
- t.ruby_opts = %w[-w]
33
- t.ruby_opts << '-rdevkit' if RbConfig::CONFIG['host_os'].include?('mingw')
34
-
35
- t.libs << "test"
36
- t.libs << "bundler/lib"
37
-
38
- t.test_files = FileList['test/**/test_*.rb']
39
- end
40
-
41
- task :default => :test
42
-
43
- spec = Gem::Specification.load('rubygems-update.gemspec')
44
- v = spec.version
45
-
46
- require 'rdoc/task'
47
-
48
- RDoc::Task.new :rdoc => 'docs', :clobber_rdoc => 'clobber_docs' do |doc|
49
- doc.main = 'README.md'
50
- doc.title = "RubyGems #{v} API Documentation"
51
-
52
- rdoc_files = Rake::FileList.new %w[lib bundler/lib]
53
- rdoc_files.add %w[CHANGELOG.md LICENSE.txt MIT.txt CODE_OF_CONDUCT.md CONTRIBUTING.md
54
- MAINTAINERS.txt Manifest.txt POLICIES.md README.md UPGRADING.md bundler/CHANGELOG.md
55
- bundler/doc/contributing/README.md bundler/LICENSE.md bundler/README.md
56
- hide_lib_for_update/note.txt].map(&:freeze)
57
-
58
- doc.rdoc_files = rdoc_files
59
-
60
- doc.rdoc_dir = 'doc'
61
- end
62
-
63
- load "util/automatiek.rake"
64
-
65
- # We currently ship Molinillo master branch as of
66
- # https://github.com/CocoaPods/Molinillo/commit/7cc27a355e861bdf593e2cde7bf1bca3daae4303
67
- Automatiek::RakeTask.new("molinillo") do |lib|
68
- lib.version = "master"
69
- lib.download = { :github => "https://github.com/CocoaPods/Molinillo" }
70
- lib.namespace = "Molinillo"
71
- lib.prefix = "Gem::Resolver"
72
- lib.vendor_lib = "lib/rubygems/resolver/molinillo"
73
- end
74
-
75
- namespace :rubocop do
76
- desc "Run rubocop for RubyGems. Pass positional arguments, e.g. -a, as Rake arguments."
77
- task(:rubygems) do |_, args|
78
- sh "util/rubocop", *args
79
- end
80
-
81
- desc "Run rubocop for Bundler. Pass positional arguments, e.g. -a, as Rake arguments."
82
- task(:bundler) do |_, args|
83
- sh "bundler/bin/rubocop", *args
84
- end
85
- end
86
-
87
- task rubocop: %w[rubocop:rubygems rubocop:bundler]
88
-
89
- # --------------------------------------------------------------------
90
- # Creating a release
91
-
92
- task :prerelease => %w[clobber test bundler:build_metadata check_deprecations]
93
- task :postrelease => %w[bundler:build_metadata:clean upload guides:publish blog:publish]
94
-
95
- desc "Check for deprecated methods with expired deprecation horizon"
96
- task :check_deprecations do
97
- if v.segments[1] == 0 && v.segments[2] == 0
98
- sh("util/rubocop -r ./util/cops/deprecations --only Rubygems/Deprecations")
99
- else
100
- puts "Skipping deprecation checks since not releasing a major version."
101
- end
102
- end
103
-
104
- desc "Prepare stable branch"
105
- task :prepare_stable_branch, [:version] do |_t, opts|
106
- require_relative "util/release"
107
-
108
- Release.new(opts[:version] || v.to_s).prepare!
109
- end
110
-
111
- desc "Install rubygems to local system"
112
- task :install => [:clear_package, :package] do
113
- sh "ruby -Ilib bin/gem install --no-document pkg/rubygems-update-#{v}.gem --backtrace && update_rubygems --no-document --backtrace"
114
- end
115
-
116
- desc "Clears previously built package"
117
- task :clear_package do
118
- rm_rf "pkg"
119
- end
120
-
121
- desc "Generates the changelog for a specific target version"
122
- task :generate_changelog, [:version] do |_t, opts|
123
- require_relative "util/release"
124
-
125
- Release.for_rubygems(opts[:version]).cut_changelog!
126
- end
127
-
128
- desc "Release rubygems-#{v}"
129
- task :release => :prerelease do
130
- Rake::Task["package"].invoke
131
- sh "gem push pkg/rubygems-update-#{v}.gem"
132
- Rake::Task["postrelease"].invoke
133
- end
134
-
135
- Gem::PackageTask.new(spec) {}
136
-
137
- Rake::Task["package"].enhance ["pkg/rubygems-#{v}.tgz", "pkg/rubygems-#{v}.zip"]
138
-
139
- file "pkg/rubygems-#{v}" => "pkg/rubygems-update-#{v}" do |t|
140
- require 'find'
141
-
142
- dest_root = File.expand_path t.name
143
-
144
- cd t.source do
145
- Find.find '.' do |file|
146
- dest = File.expand_path file, dest_root
147
-
148
- if File.directory? file
149
- mkdir_p dest
150
- else
151
- rm_f dest
152
- safe_ln file, dest
153
- end
154
- end
155
- end
156
- end
157
-
158
- file "pkg/rubygems-#{v}.zip" => "pkg/rubygems-#{v}" do
159
- cd 'pkg' do
160
- if Gem.win_platform?
161
- sh "7z a rubygems-#{v}.zip rubygems-#{v}"
162
- else
163
- sh "zip -q -r rubygems-#{v}.zip rubygems-#{v}"
164
- end
165
- end
166
- end
167
-
168
- file "pkg/rubygems-#{v}.tgz" => "pkg/rubygems-#{v}" do
169
- cd 'pkg' do
170
- if Gem.win_platform? && RUBY_VERSION < '2.4'
171
- sh "7z a -ttar rubygems-#{v}.tar rubygems-#{v}"
172
- sh "7z a -tgzip rubygems-#{v}.tgz rubygems-#{v}.tar"
173
- else
174
- sh "tar -czf rubygems-#{v}.tgz --owner=rubygems:0 --group=rubygems:0 rubygems-#{v}"
175
- end
176
- end
177
- end
178
-
179
- desc "Upload the release to Github releases"
180
- task :upload_to_github do
181
- require_relative "util/release"
182
-
183
- Release.for_rubygems(v).create_for_github!
184
- end
185
-
186
- desc "Upload release to S3"
187
- task :upload_to_s3 do
188
- require "aws-sdk-s3"
189
-
190
- s3 = Aws::S3::Resource.new(region:'us-west-2')
191
- %w[zip tgz].each do |ext|
192
- obj = s3.bucket('oregon.production.s3.rubygems.org').object("rubygems/rubygems-#{v}.#{ext}")
193
- obj.upload_file("pkg/rubygems-#{v}.#{ext}", acl: 'public-read')
194
- end
195
- end
196
-
197
- desc "Upload release to rubygems.org"
198
- task :upload => %w[upload_to_github upload_to_s3]
199
-
200
- directory '../guides.rubygems.org' do
201
- sh 'git', 'clone',
202
- 'git@github.com:rubygems/guides.git',
203
- '../guides.rubygems.org'
204
- end
205
-
206
- namespace 'guides' do
207
- task 'pull' => %w[../guides.rubygems.org] do
208
- chdir '../guides.rubygems.org' do
209
- sh 'git', 'pull'
210
- end
211
- end
212
-
213
- task 'update' => %w[../guides.rubygems.org] do
214
- lib_dir = File.join Dir.pwd, 'lib'
215
-
216
- chdir '../guides.rubygems.org' do
217
- ruby '-I', lib_dir, '-S', 'rake', 'command_guide'
218
- ruby '-I', lib_dir, '-S', 'rake', 'spec_guide'
219
- end
220
- end
221
-
222
- task 'commit' => %w[../guides.rubygems.org] do
223
- chdir '../guides.rubygems.org' do
224
- begin
225
- sh 'git', 'diff', '--quiet'
226
- rescue
227
- sh 'git', 'commit', 'command-reference.md', 'specification-reference.md',
228
- '-m', "Rebuild for RubyGems #{v}"
229
- end
230
- end
231
- end
232
-
233
- task 'push' => %w[../guides.rubygems.org] do
234
- chdir '../guides.rubygems.org' do
235
- sh 'git', 'push'
236
- end
237
- end
238
-
239
- desc 'Updates and publishes the guides for the just-released RubyGems'
240
- task 'publish'
241
-
242
- task 'publish' => %w[
243
- guides:pull
244
- guides:update
245
- guides:commit
246
- guides:push
247
- ]
248
- end
249
-
250
- directory '../blog.rubygems.org' do
251
- sh 'git', 'clone',
252
- 'git@github.com:rubygems/rubygems.github.io.git',
253
- '../blog.rubygems.org'
254
- end
255
-
256
- namespace 'blog' do
257
- date = Time.now.strftime '%Y-%m-%d'
258
- post_page = "_posts/#{date}-#{v}-released.md"
259
- checksums = ''
260
-
261
- task 'checksums' => 'package' do
262
- require 'digest'
263
- Dir['pkg/*{tgz,zip,gem}'].map do |file|
264
- digest = Digest::SHA256.new
265
-
266
- open file, 'rb' do |io|
267
- while chunk = io.read(65536) do
268
- digest.update chunk
269
- end
270
- end
271
-
272
- checksums << "* #{File.basename(file)} \n"
273
- checksums << " #{digest.hexdigest}\n"
274
- end
275
- end
276
-
277
- task 'pull' => %w[../blog.rubygems.org] do
278
- chdir '../blog.rubygems.org' do
279
- sh 'git', 'pull'
280
- end
281
- end
282
-
283
- path = File.join '../blog.rubygems.org', post_page
284
-
285
- task 'update' => [path]
286
-
287
- file path => 'checksums' do
288
- name = `git config --get user.name`.strip
289
- email = `git config --get user.email`.strip
290
-
291
- require_relative "util/changelog"
292
- history = Changelog.for_rubygems(v.to_s)
293
-
294
- require 'tempfile'
295
-
296
- Tempfile.open 'blog_post' do |io|
297
- io.write <<-ANNOUNCEMENT
298
- ---
299
- title: #{v} Released
300
- layout: post
301
- author: #{name}
302
- author_email: #{email}
303
- ---
304
-
305
- RubyGems #{v} includes #{history.change_types_for_blog}.
306
-
307
- To update to the latest RubyGems you can run:
308
-
309
- gem update --system
310
-
311
- To install RubyGems by hand see the [Download RubyGems][download] page.
312
-
313
- #{history.release_notes_for_blog.join("\n")}
314
-
315
- SHA256 Checksums:
316
-
317
- #{checksums}
318
-
319
- [download]: https://rubygems.org/pages/download
320
-
321
- ANNOUNCEMENT
322
-
323
- io.flush
324
-
325
- sh(ENV['EDITOR'] || 'vim', io.path)
326
-
327
- FileUtils.cp io.path, path
328
- end
329
- end
330
-
331
- task 'commit' => %w[../blog.rubygems.org] do
332
- chdir '../blog.rubygems.org' do
333
- sh 'git', 'add', post_page
334
- sh 'git', 'commit', post_page,
335
- '-m', "Added #{v} release announcement"
336
- end
337
- end
338
-
339
- task 'push' => %w[../blog.rubygems.org] do
340
- chdir '../blog.rubygems.org' do
341
- sh 'git', 'push'
342
- end
343
- end
344
-
345
- desc 'Updates and publishes the blog for the just-released RubyGems'
346
- task 'publish' => %w[
347
- blog:pull
348
- blog:update
349
- blog:commit
350
- blog:push
351
- ]
352
- end
353
-
354
- # Misc Tasks ---------------------------------------------------------
355
-
356
- module Rubygems
357
- class ProjectFiles
358
- def self.all
359
- files = []
360
- exclude = %r{\A(?:\.|dev_gems|bundler/(?!lib|exe|[^/]+\.md|bundler.gemspec)|util/)}
361
- tracked_files = `git ls-files`.split("\n")
362
-
363
- tracked_files.each do |path|
364
- next unless File.file?(path)
365
- next if path =~ exclude
366
- files << path
367
- end
368
-
369
- files.sort
370
- end
371
- end
372
- end
373
-
374
- desc "Update the manifest to reflect what's on disk"
375
- task :update_manifest do
376
- File.open('Manifest.txt', 'w') {|f| f.puts(Rubygems::ProjectFiles.all) }
377
- end
378
-
379
- desc "Check the manifest is up to date"
380
- task :check_manifest do
381
- if File.read("Manifest.txt").split != Rubygems::ProjectFiles.all
382
- abort "Manifest is out of date. Run `rake update_manifest` to sync it"
383
- end
384
- end
385
-
386
- desc "Update License list from SPDX.org"
387
- task :update_licenses do
388
- load "util/generate_spdx_license_list.rb"
389
- end
390
-
391
- namespace :bundler do
392
- task :build_metadata do
393
- chdir('bundler') { sh "rake build_metadata" }
394
- end
395
-
396
- namespace :build_metadata do
397
- task :clean do
398
- chdir('bundler') { sh "rake build_metadata:clean" }
399
- end
400
- end
401
- end