rubygems-update 3.0.0 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/CODE_OF_CONDUCT.md +10 -8
  4. data/CONTRIBUTING.md +7 -0
  5. data/History.txt +95 -0
  6. data/README.md +6 -0
  7. data/Rakefile +27 -3
  8. data/bundler/CHANGELOG.md +11 -0
  9. data/bundler/lib/bundler/build_metadata.rb +2 -2
  10. data/bundler/lib/bundler/rubygems_gem_installer.rb +7 -0
  11. data/bundler/lib/bundler/source/metadata.rb +2 -3
  12. data/bundler/lib/bundler/version.rb +1 -1
  13. data/bundler/man/bundle.ronn +3 -0
  14. data/lib/rubygems/command_manager.rb +12 -4
  15. data/lib/rubygems/commands/build_command.rb +28 -13
  16. data/lib/rubygems/commands/owner_command.rb +6 -1
  17. data/lib/rubygems/commands/setup_command.rb +5 -5
  18. data/lib/rubygems/dependency_list.rb +1 -1
  19. data/lib/rubygems/gemcutter_utilities.rb +5 -2
  20. data/lib/rubygems/install_update_options.rb +1 -1
  21. data/lib/rubygems/installer.rb +29 -10
  22. data/lib/rubygems/package/old.rb +1 -1
  23. data/lib/rubygems/package.rb +12 -2
  24. data/lib/rubygems/rdoc.rb +2 -2
  25. data/lib/rubygems/request_set/gem_dependency_api.rb +8 -5
  26. data/lib/rubygems/requirement.rb +16 -5
  27. data/lib/rubygems/specification.rb +8 -9
  28. data/lib/rubygems/test_case.rb +15 -8
  29. data/lib/rubygems/uninstaller.rb +1 -1
  30. data/lib/rubygems/user_interaction.rb +4 -1
  31. data/lib/rubygems/util.rb +1 -1
  32. data/lib/rubygems.rb +3 -2
  33. data/rubygems-update.gemspec +1 -1
  34. data/test/rubygems/ca_cert.pem +74 -65
  35. data/test/rubygems/client.pem +103 -45
  36. data/test/rubygems/ssl_cert.pem +78 -17
  37. data/test/rubygems/ssl_key.pem +25 -13
  38. data/test/rubygems/test_bundled_ca.rb +1 -1
  39. data/test/rubygems/test_gem.rb +15 -10
  40. data/test/rubygems/test_gem_bundler_version_finder.rb +4 -0
  41. data/test/rubygems/test_gem_command_manager.rb +10 -0
  42. data/test/rubygems/test_gem_commands_build_command.rb +1 -0
  43. data/test/rubygems/test_gem_ext_cmake_builder.rb +1 -1
  44. data/test/rubygems/test_gem_indexer.rb +7 -0
  45. data/test/rubygems/test_gem_installer.rb +113 -3
  46. data/test/rubygems/test_gem_package.rb +37 -0
  47. data/test/rubygems/test_gem_package_tar_writer.rb +3 -0
  48. data/test/rubygems/test_gem_rdoc.rb +1 -135
  49. data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +60 -27
  50. data/test/rubygems/test_gem_requirement.rb +6 -0
  51. data/test/rubygems/test_gem_security_policy.rb +1 -1
  52. data/test/rubygems/test_gem_specification.rb +3 -0
  53. data/test/rubygems/test_gem_stream_ui.rb +2 -2
  54. data/test/rubygems/test_gem_text.rb +5 -0
  55. data/test/rubygems/test_gem_uninstaller.rb +21 -2
  56. data/test/rubygems/test_gem_util.rb +17 -0
  57. data/util/ci +6 -1
  58. data/util/create_encrypted_key.rb +4 -4
  59. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ea50377cd0dc10d97b35b8cb30469ec43cee296cdc017ec49ef7b8869128d8c
4
- data.tar.gz: 0e21b6e7dc4bc5fdc11beaa64077b8c3e3f429d3c9b39ecc25354dda2beff52c
3
+ metadata.gz: 3dcbed60214cfd0ed97ed7fce1d0c9e9a1298a823a26fcd2b75326d711ff299d
4
+ data.tar.gz: 6dd6fabe834fd5fc81dfa7bb55f874a6d182123a8d0e396fe7dd57cacee5e379
5
5
  SHA512:
6
- metadata.gz: 66d9e042e9559a895006fc702ad47a6cadfd2525c7bdab0635dbb14ee84e426e44f65380c6c3984a0e71aeaf6fa6d962e1d7391949aeacd2a087401080f71b2f
7
- data.tar.gz: 6c803e3b8b719d8df12fda6857654680ecfa6719c35f66559380daaf2c0141ab3f15ea737e285a06389d4d2fe1ae5edc6e5f0c1f22c5c8e7904100df7238ff5f
6
+ metadata.gz: ef072a34d1765edd4f67b83a19efbc691e2f4c4dac6c8fda9004dbb2a771f550aa7b8a61dd301a477310f9e3987c642c8c49e8d417abd1e4bffbe7dd1a485499
7
+ data.tar.gz: e30274bbce496312bcb34f45cce2d7f7c2f6916095f67de538ccb9429b197f402d75c9c3090472dea3d2481760632466c20c513890f3d924e671ff4df77b0982
data/.rubocop.yml CHANGED
@@ -3,6 +3,7 @@ AllCops:
3
3
  Exclude:
4
4
  - 'bundler/**/*'
5
5
  - 'lib/rubygems/resolver/molinillo/**/*'
6
+ - 'pkg/**/*'
6
7
  TargetRubyVersion: 2.3
7
8
 
8
9
  Layout/AccessModifierIndentation:
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Contributor Code of Conduct
2
2
 
3
- ### Our Pledge
3
+ ## Our Pledge
4
4
 
5
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
6
 
7
- ### Our Standards
7
+ ## Our Standards
8
8
 
9
9
  Examples of behavior that contributes to creating a positive environment include:
10
10
 
@@ -22,22 +22,24 @@ Examples of unacceptable behavior by participants include:
22
22
  * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
23
  * Other conduct which could reasonably be considered inappropriate in a professional setting
24
24
 
25
- ### Our Responsibilities
25
+ ## Our Responsibilities
26
26
 
27
27
  Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
28
 
29
29
  Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
30
 
31
- ### Scope
31
+ ## Scope
32
32
 
33
33
  This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
34
 
35
- ### Enforcement
35
+ ## Enforcement
36
36
 
37
37
  Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the [project team](MAINTAINERS.txt). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
38
 
39
39
  Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
40
 
41
- ### Attribution
41
+ ## Attribution
42
42
 
43
- This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4.
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
44
+
45
+ [homepage]: https://www.contributor-covenant.org
data/CONTRIBUTING.md CHANGED
@@ -37,6 +37,13 @@ To run commands like `gem install` from the repo:
37
37
 
38
38
  $ ruby -Ilib bin/gem install
39
39
 
40
+ To run bundler test:
41
+
42
+ $ cd bundler
43
+ $ git submodule update --init --recursive
44
+ $ bin/rake spec:deps
45
+ $ bin/rspec spec
46
+
40
47
  ## Issues
41
48
 
42
49
  RubyGems uses labels to track all issues and pull requests. In order to
data/History.txt CHANGED
@@ -1,5 +1,100 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 3.0.4 / 2019-06-14
4
+
5
+ Minor enhancements:
6
+
7
+ * Add support for TruffleRuby #2612 by Benoit Daloze
8
+ * Serve a more descriptive error when --no-ri or --no-rdoc are used #2572
9
+ by Grey Baker
10
+ * Improve test compatibility with CMake 2.8. Pull request #2590 by Vít
11
+ Ondruch.
12
+ * Restore gem build behavior and introduce the "-C" flag to gem build.
13
+ Pull request #2596 by Luis Sagastume.
14
+ * Enabled block call with util_set_arch. Pull request #2603 by SHIBATA
15
+ Hiroshi.
16
+ * Avoid rdoc hook when it's failed to load rdoc library. Pull request
17
+ #2604 by SHIBATA Hiroshi.
18
+ * Drop tests for legacy RDoc. Pull request #2608 by Nobuyoshi Nakada.
19
+ * Update TODO comment. Pull request #2658 by Luis Sagastume.
20
+ * Skip malicious extension test with mswin platform. Pull request #2670 by
21
+ SHIBATA Hiroshi.
22
+ * Check deprecated methods on release. Pull request #2673 by David
23
+ Rodríguez.
24
+ * Add steps to run bundler tests. Pull request #2680 by Aditya Prakash.
25
+ * Skip temporary "No such host is known" error. Pull request #2684 by
26
+ Takashi Kokubun.
27
+ * Replaced aws-sdk-s3 instead of s3cmd. Pull request #2688 by SHIBATA
28
+ Hiroshi.
29
+ * Allow uninstall from symlinked GEM_HOME. Pull request #2720 by David
30
+ Rodríguez.
31
+ * Use current checkout in CI to uninstall RVM related gems. Pull request
32
+ #2729 by David Rodríguez.
33
+ * Update Contributor Covenant v1.4.1. Pull request #2751 by SHIBATA
34
+ Hiroshi.
35
+ * Added supported versions of Ruby. Pull request #2756 by SHIBATA Hiroshi.
36
+ * Fix shadowing outer local variable warning. Pull request #2763 by Luis
37
+ Sagastume.
38
+ * Update the certificate files to make the test pass on Debian 10. Pull
39
+ request #2777 by Yusuke Endoh.
40
+ * Backport ruby core changes. Pull request #2778 by SHIBATA Hiroshi.
41
+
42
+ Bug fixes:
43
+
44
+ * Test_gem.rb - intermittent failure fix. Pull request #2613 by MSP-Greg.
45
+ * Fix sporadic CI failures. Pull request #2617 by David Rodríguez.
46
+ * Fix flaky bundler version finder tests. Pull request #2624 by David
47
+ Rodríguez.
48
+ * Fix gem indexer tests leaking utility gems. Pull request #2625 by David
49
+ Rodríguez.
50
+ * Clean up default spec dir too. Pull request #2639 by David Rodríguez.
51
+ * Fix 2.6.1 build against vendored bundler. Pull request #2645 by David
52
+ Rodríguez.
53
+ * Fix comment typo. Pull request #2664 by Luis Sagastume.
54
+ * Fix comment of Gem::Specification#required_ruby_version=. Pull request
55
+ #2732 by Alex Junger.
56
+ * Fix TODOs. Pull request #2748 by David Rodríguez.
57
+
58
+ === 3.0.3 / 2019-03-05
59
+
60
+ Security fixes:
61
+
62
+ * Fixed following vulnerabilities:
63
+ * CVE-2019-8320: Delete directory using symlink when decompressing tar
64
+ * CVE-2019-8321: Escape sequence injection vulnerability in `verbose`
65
+ * CVE-2019-8322: Escape sequence injection vulnerability in `gem owner`
66
+ * CVE-2019-8323: Escape sequence injection vulnerability in API response handling
67
+ * CVE-2019-8324: Installing a malicious gem may lead to arbitrary code execution
68
+ * CVE-2019-8325: Escape sequence injection vulnerability in errors
69
+
70
+ === 3.0.2 / 2019-01-01
71
+
72
+ Minor enhancements:
73
+
74
+ * Use Bundler-1.17.3. Pull request #2556 by SHIBATA Hiroshi.
75
+ * Fix document flag description. Pull request #2555 by Luis Sagastume.
76
+
77
+ Bug fixes:
78
+
79
+ * Fix tests when ruby --program-suffix is used without rubygems
80
+ --format-executable. Pull request #2549 by Jeremy Evans.
81
+ * Fix Gem::Requirement equality comparison when ~> operator is used. Pull
82
+ request #2554 by Grey Baker.
83
+ * Unset SOURCE_DATE_EPOCH in the test cases. Pull request #2558 by Sorah
84
+ Fukumori.
85
+ * Restore SOURCE_DATE_EPOCH. Pull request #2560 by SHIBATA Hiroshi.
86
+
87
+ === 3.0.1 / 2018-12-23
88
+
89
+ Bug fixes:
90
+
91
+ * Ensure globbed files paths are expanded. Pull request #2536 by Tony Ta.
92
+ * Dup the Dir.home string before passing it on. Pull request #2545 by
93
+ Charles Oliver Nutter.
94
+ * Added permissions to installed files for non-owners. Pull request #2546
95
+ by SHIBATA Hiroshi.
96
+ * Restore release task without hoe. Pull request #2547 by SHIBATA Hiroshi.
97
+
3
98
  === 3.0.0 / 2018-12-19
4
99
 
5
100
  Major enhancements:
data/README.md CHANGED
@@ -25,6 +25,12 @@ Finally, inside your Ruby program, load the Nokogiri gem and start parsing your
25
25
 
26
26
  For more information about how to use RubyGems, see our RubyGems basics guide at [guides.rubygems.org](http://guides.rubygems.org/rubygems-basics/)
27
27
 
28
+ ## Requirements
29
+
30
+ * RubyGems 2.6 supports Ruby 2.4 or lower.
31
+ * RubyGems 2.7 supports Ruby 2.5 or lower.
32
+ * RubyGems 3.0 supports Ruby 2.3 or later.
33
+
28
34
  ## Installation
29
35
 
30
36
  RubyGems is likely already installed in your Ruby environment, you can check by running `gem --version` in your terminal emulator.
data/Rakefile CHANGED
@@ -79,10 +79,24 @@ end
79
79
  # --------------------------------------------------------------------
80
80
  # Creating a release
81
81
 
82
- task :prerelease => %w[clobber test bundler:build_metadata]
83
-
82
+ task :prerelease => %w[clobber test bundler:build_metadata check_deprecations package]
84
83
  task :postrelease => %w[bundler:build_metadata:clean upload guides:publish blog:publish]
85
84
 
85
+ desc "Check for deprecated methods with expired deprecation horizon"
86
+ task :check_deprecations do
87
+ if v.segments[1] == 0 && v.segments[2] == 0
88
+ sh("util/rubocop -r ./util/cops/deprecations --only Rubygems/Deprecations")
89
+ else
90
+ puts "Skipping deprecation checks since not releasing a major version."
91
+ end
92
+ end
93
+
94
+ desc "Release rubygems-#{v}"
95
+ task :release => :prerelease do
96
+ sh "gem push pkg/rubygems-update-#{v}.gem"
97
+ end
98
+ Rake::Task["release"].enhance(["postrelease"])
99
+
86
100
  Gem::PackageTask.new(spec) {}
87
101
 
88
102
  Rake::Task["package"].enhance ["pkg/rubygems-#{v}.tgz", "pkg/rubygems-#{v}.zip"]
@@ -120,7 +134,17 @@ end
120
134
 
121
135
  desc "Upload release to S3"
122
136
  task :upload_to_s3 do
123
- sh "s3cmd put -P pkg/rubygems-#{v}.zip pkg/rubygems-#{v}.tgz s3://oregon.production.s3.rubygems.org/rubygems/"
137
+ begin
138
+ require "aws-sdk-s3"
139
+ rescue LoadError
140
+ abort "Install the aws-sdk-s3 gem to be able to upload gems to rubygems.org."
141
+ end
142
+
143
+ s3 = Aws::S3::Resource.new(region:'us-west-2')
144
+ %w[zip tgz].each do |ext|
145
+ obj = s3.bucket('oregon.production.s3.rubygems.org').object("rubygems/rubygems-#{v}.#{ext}")
146
+ obj.upload_file("pkg/rubygems-#{v}.#{ext}")
147
+ end
124
148
  end
125
149
 
126
150
  desc "Upload release to rubygems.org"
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 1.17.3 (2018-12-27)
2
+
3
+ Bugfixes:
4
+
5
+ - Fix a Bundler error when installing gems on old versions of RubyGems ([#6839](https://github.com/bundler/bundler/issues/6839), @colby-swandale)
6
+ - Fix a rare issue where Bundler was removing itself after a `bundle clean` ([#6829](https://github.com/bundler/bundler/issues/6829), @colby-swandale)
7
+
8
+ Documentation:
9
+
10
+ - Add entry for the `bundle remove` command to the main Bundler manual page
11
+
1
12
  ## 1.17.2 (2018-12-11)
2
13
 
3
14
  - Add compatibility for bundler merge with Ruby 2.6
@@ -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 = "2018-12-19".freeze
8
- @git_commit_sha = "3fc4de72b".freeze
7
+ @built_at = "2019-06-14".freeze
8
+ @git_commit_sha = "d7089abb6".freeze
9
9
  @release = false
10
10
  # end ivars
11
11
 
@@ -10,6 +10,13 @@ module Bundler
10
10
  end
11
11
  end
12
12
 
13
+ attr_reader :options
14
+
15
+ def initialize(gem, options = {})
16
+ @options = {}
17
+ super
18
+ end
19
+
13
20
  def check_executable_overwrite(filename)
14
21
  # Bundler needs to install gems regardless of binstub overwriting
15
22
  end
@@ -19,9 +19,8 @@ module Bundler
19
19
  # can't point to the actual gemspec or else the require paths will be wrong
20
20
  s.loaded_from = File.expand_path("..", __FILE__)
21
21
  end
22
- if loaded_spec = Bundler.rubygems.loaded_specs("bundler")
23
- idx << loaded_spec # this has to come after the fake gemspec, to override it
24
- elsif local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION }
22
+
23
+ if local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION }
25
24
  idx << local_spec
26
25
  end
27
26
 
@@ -7,7 +7,7 @@ module Bundler
7
7
  # We're doing this because we might write tests that deal
8
8
  # with other versions of bundler and we are unsure how to
9
9
  # handle this better.
10
- VERSION = "1.17.2" unless defined?(::Bundler::VERSION)
10
+ VERSION = "1.17.3" unless defined?(::Bundler::VERSION)
11
11
 
12
12
  def self.overwrite_loaded_gem_version
13
13
  begin
@@ -94,6 +94,9 @@ We divide `bundle` subcommands into primary commands and utilities:
94
94
  * [`bundle doctor(1)`](bundle-doctor.1.html):
95
95
  Display warnings about common problems
96
96
 
97
+ * [`bundle remove(1)`](bundle-remove.1.html):
98
+ Removes gems from the Gemfile
99
+
97
100
  ## PLUGINS
98
101
 
99
102
  When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES,
@@ -7,6 +7,7 @@
7
7
 
8
8
  require 'rubygems/command'
9
9
  require 'rubygems/user_interaction'
10
+ require 'rubygems/text'
10
11
 
11
12
  ##
12
13
  # The command manager registers and installs all the individual sub-commands
@@ -32,6 +33,7 @@ require 'rubygems/user_interaction'
32
33
 
33
34
  class Gem::CommandManager
34
35
 
36
+ include Gem::Text
35
37
  include Gem::UserInteraction
36
38
 
37
39
  BUILTIN_COMMANDS = [ # :nodoc:
@@ -145,12 +147,12 @@ class Gem::CommandManager
145
147
  def run(args, build_args=nil)
146
148
  process_args(args, build_args)
147
149
  rescue StandardError, Timeout::Error => ex
148
- alert_error "While executing gem ... (#{ex.class})\n #{ex}"
150
+ alert_error clean_text("While executing gem ... (#{ex.class})\n #{ex}")
149
151
  ui.backtrace ex
150
152
 
151
153
  terminate_interaction(1)
152
154
  rescue Interrupt
153
- alert_error "Interrupted"
155
+ alert_error clean_text("Interrupted")
154
156
  terminate_interaction(1)
155
157
  end
156
158
 
@@ -167,8 +169,14 @@ class Gem::CommandManager
167
169
  when '-v', '--version' then
168
170
  say Gem::VERSION
169
171
  terminate_interaction 0
172
+ when '--no-ri', '--no-rdoc' then
173
+ # This was added to compensate for a deprecation warning not being shown
174
+ # in Rubygems 2.x.x.
175
+ # TODO: Remove when Rubygems 3.1 is released.
176
+ alert_error "Invalid option: #{args.first}. Use --no-document instead."
177
+ terminate_interaction 1
170
178
  when /^-/ then
171
- alert_error "Invalid option: #{args.first}. See 'gem --help'."
179
+ alert_error clean_text("Invalid option: #{args.first}. See 'gem --help'.")
172
180
  terminate_interaction 1
173
181
  else
174
182
  cmd_name = args.shift.downcase
@@ -224,7 +232,7 @@ class Gem::CommandManager
224
232
  rescue Exception => e
225
233
  e = load_error if load_error
226
234
 
227
- alert_error "Loading command: #{command_name} (#{e.class})\n\t#{e}"
235
+ alert_error clean_text("Loading command: #{command_name} (#{e.class})\n\t#{e}")
228
236
  ui.backtrace e
229
237
  end
230
238
  end
@@ -18,6 +18,10 @@ class Gem::Commands::BuildCommand < Gem::Command
18
18
  add_option '-o', '--output FILE', 'output gem with the given filename' do |value, options|
19
19
  options[:output] = value
20
20
  end
21
+
22
+ add_option '-C PATH', '', 'Run as if gem build was started in <PATH> instead of the current working directory.' do |value, options|
23
+ options[:build_path] = value
24
+ end
21
25
  end
22
26
 
23
27
  def arguments # :nodoc:
@@ -60,25 +64,36 @@ Gems can be saved to a specified filename with the output option:
60
64
  end
61
65
 
62
66
  if File.exist? gemspec
63
- Dir.chdir(File.dirname(gemspec)) do
64
- spec = Gem::Specification.load File.basename(gemspec)
65
-
66
- if spec
67
- Gem::Package.build(
68
- spec,
69
- options[:force],
70
- options[:strict],
71
- options[:output]
72
- )
73
- else
74
- alert_error "Error loading gemspec. Aborting."
75
- terminate_interaction 1
67
+ spec = Gem::Specification.load(gemspec)
68
+
69
+ if options[:build_path]
70
+ Dir.chdir(File.dirname(gemspec)) do
71
+ spec = Gem::Specification.load File.basename(gemspec)
72
+ build_package(spec)
76
73
  end
74
+ else
75
+ build_package(spec)
77
76
  end
77
+
78
78
  else
79
79
  alert_error "Gemspec file not found: #{gemspec}"
80
80
  terminate_interaction 1
81
81
  end
82
82
  end
83
83
 
84
+ private
85
+
86
+ def build_package(spec)
87
+ if spec
88
+ Gem::Package.build(
89
+ spec,
90
+ options[:force],
91
+ options[:strict],
92
+ options[:output]
93
+ )
94
+ else
95
+ alert_error "Error loading gemspec. Aborting."
96
+ terminate_interaction 1
97
+ end
98
+ end
84
99
  end
@@ -2,8 +2,11 @@
2
2
  require 'rubygems/command'
3
3
  require 'rubygems/local_remote_options'
4
4
  require 'rubygems/gemcutter_utilities'
5
+ require 'rubygems/text'
5
6
 
6
7
  class Gem::Commands::OwnerCommand < Gem::Command
8
+
9
+ include Gem::Text
7
10
  include Gem::LocalRemoteOptions
8
11
  include Gem::GemcutterUtilities
9
12
 
@@ -60,12 +63,14 @@ permission to.
60
63
  end
61
64
 
62
65
  def show_owners(name)
66
+ Gem.load_yaml
67
+
63
68
  response = rubygems_api_request :get, "api/v1/gems/#{name}/owners.yaml" do |request|
64
69
  request.add_field "Authorization", api_key
65
70
  end
66
71
 
67
72
  with_response response do |resp|
68
- owners = Gem::SafeYAML.load resp.body
73
+ owners = Gem::SafeYAML.load clean_text(resp.body)
69
74
 
70
75
  say "Owners for gem: #{name}"
71
76
  owners.each do |owner|
@@ -312,7 +312,7 @@ By default, this RubyGems will install gem as:
312
312
  dest_file = File.join dest_dir, file
313
313
  dest_dir = File.dirname dest_file
314
314
  unless File.directory? dest_dir
315
- mkdir_p dest_dir, :mode => 0700
315
+ mkdir_p dest_dir, :mode => 0755
316
316
  end
317
317
 
318
318
  install file, dest_file, :mode => options[:data_mode] || 0644
@@ -387,7 +387,7 @@ By default, this RubyGems will install gem as:
387
387
 
388
388
  specs_dir = Gem::Specification.default_specifications_dir
389
389
  specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform?
390
- mkdir_p specs_dir, :mode => 0700
390
+ mkdir_p specs_dir, :mode => 0755
391
391
 
392
392
  # Workaround for non-git environment.
393
393
  gemspec = File.open('bundler/bundler.gemspec', 'rb'){|f| f.read.gsub(/`git ls-files -z`/, "''") }
@@ -422,7 +422,7 @@ By default, this RubyGems will install gem as:
422
422
 
423
423
  bundler_bin_dir = bundler_spec.bin_dir
424
424
  bundler_bin_dir = File.join(options[:destdir], bundler_bin_dir) unless Gem.win_platform?
425
- mkdir_p bundler_bin_dir, :mode => 0700
425
+ mkdir_p bundler_bin_dir, :mode => 0755
426
426
  bundler_spec.executables.each do |e|
427
427
  cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
428
428
  end
@@ -446,8 +446,8 @@ By default, this RubyGems will install gem as:
446
446
  lib_dir, bin_dir = generate_default_dirs(install_destdir)
447
447
  end
448
448
 
449
- mkdir_p lib_dir, :mode => 0700
450
- mkdir_p bin_dir, :mode => 0700
449
+ mkdir_p lib_dir, :mode => 0755
450
+ mkdir_p bin_dir, :mode => 0755
451
451
 
452
452
  return lib_dir, bin_dir
453
453
  end
@@ -134,7 +134,7 @@ class Gem::DependencyList
134
134
  end
135
135
 
136
136
  ##
137
- # Is is ok to remove a gemspec from the dependency list?
137
+ # It is ok to remove a gemspec from the dependency list?
138
138
  #
139
139
  # If removing the gemspec creates breaks a currently ok dependency, then it
140
140
  # is NOT ok to remove the gemspec.
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
  require 'rubygems/remote_fetcher'
3
+ require 'rubygems/text'
3
4
 
4
5
  ##
5
6
  # Utility methods for using the RubyGems API.
6
7
 
7
8
  module Gem::GemcutterUtilities
8
9
 
10
+ include Gem::Text
11
+
9
12
  # TODO: move to Gem::Command
10
13
  OptionParser.accept Symbol do |value|
11
14
  value.to_sym
@@ -162,13 +165,13 @@ module Gem::GemcutterUtilities
162
165
  if block_given?
163
166
  yield response
164
167
  else
165
- say response.body
168
+ say clean_text(response.body)
166
169
  end
167
170
  else
168
171
  message = response.body
169
172
  message = "#{error_prefix}: #{message}" if error_prefix
170
173
 
171
- say message
174
+ say clean_text(message)
172
175
  terminate_interaction 1 # TODO: question this
173
176
  end
174
177
  end
@@ -30,7 +30,7 @@ module Gem::InstallUpdateOptions
30
30
  options[:bin_dir] = File.expand_path(value)
31
31
  end
32
32
 
33
- add_option(:"Install/Update", '--[no-]document [TYPES]', Array,
33
+ add_option(:"Install/Update", '--document [TYPES]', Array,
34
34
  'Generate documentation for installed gems',
35
35
  'List the documentation types you wish to',
36
36
  'generate. For example: rdoc,ri') do |value, options|
@@ -309,7 +309,7 @@ class Gem::Installer
309
309
  FileUtils.rm_rf spec.extension_dir
310
310
 
311
311
  dir_mode = options[:dir_mode]
312
- FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0700
312
+ FileUtils.mkdir_p gem_dir, :mode => dir_mode && 0755
313
313
 
314
314
  if @options[:install_as_default]
315
315
  extract_bin
@@ -481,7 +481,7 @@ class Gem::Installer
481
481
  return if spec.executables.nil? or spec.executables.empty?
482
482
 
483
483
  begin
484
- Dir.mkdir @bin_dir, *[options[:dir_mode] && 0700].compact
484
+ Dir.mkdir @bin_dir, *[options[:dir_mode] && 0755].compact
485
485
  rescue SystemCallError
486
486
  raise unless File.directory? @bin_dir
487
487
  end
@@ -525,7 +525,7 @@ class Gem::Installer
525
525
 
526
526
  FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
527
527
 
528
- File.open bin_script_path, 'wb', 0700 do |file|
528
+ File.open bin_script_path, 'wb', 0755 do |file|
529
529
  file.print app_script_text(filename)
530
530
  file.chmod(options[:prog_mode] || 0755)
531
531
  end
@@ -720,14 +720,31 @@ class Gem::Installer
720
720
  end
721
721
 
722
722
  def verify_gem_home(unpack = false) # :nodoc:
723
- FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0700
723
+ FileUtils.mkdir_p gem_home, :mode => options[:dir_mode] && 0755
724
724
  raise Gem::FilePermissionError, gem_home unless
725
725
  unpack or File.writable?(gem_home)
726
726
  end
727
727
 
728
- def verify_spec_name
729
- return if spec.name =~ Gem::Specification::VALID_NAME_PATTERN
730
- raise Gem::InstallError, "#{spec} has an invalid name"
728
+ def verify_spec
729
+ unless spec.name =~ Gem::Specification::VALID_NAME_PATTERN
730
+ raise Gem::InstallError, "#{spec} has an invalid name"
731
+ end
732
+
733
+ if spec.raw_require_paths.any?{|path| path =~ /\R/ }
734
+ raise Gem::InstallError, "#{spec} has an invalid require_paths"
735
+ end
736
+
737
+ if spec.extensions.any?{|ext| ext =~ /\R/ }
738
+ raise Gem::InstallError, "#{spec} has an invalid extensions"
739
+ end
740
+
741
+ unless spec.specification_version.to_s =~ /\A\d+\z/
742
+ raise Gem::InstallError, "#{spec} has an invalid specification_version"
743
+ end
744
+
745
+ if spec.dependencies.any? {|dep| dep.type =~ /\R/ || dep.name =~ /\R/ }
746
+ raise Gem::InstallError, "#{spec} has an invalid dependencies"
747
+ end
731
748
  end
732
749
 
733
750
  ##
@@ -876,9 +893,11 @@ TEXT
876
893
  def pre_install_checks
877
894
  verify_gem_home options[:unpack]
878
895
 
879
- ensure_loadable_spec
896
+ # The name and require_paths must be verified first, since it could contain
897
+ # ruby code that would be eval'ed in #ensure_loadable_spec
898
+ verify_spec
880
899
 
881
- verify_spec_name
900
+ ensure_loadable_spec
882
901
 
883
902
  if options[:install_as_default]
884
903
  Gem.ensure_default_gem_subdirectories gem_home
@@ -905,7 +924,7 @@ TEXT
905
924
  build_info_dir = File.join gem_home, 'build_info'
906
925
 
907
926
  dir_mode = options[:dir_mode]
908
- FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0700
927
+ FileUtils.mkdir_p build_info_dir, :mode => dir_mode && 0755
909
928
 
910
929
  build_info_file = File.join build_info_dir, "#{spec.full_name}.info"
911
930
 
@@ -78,7 +78,7 @@ class Gem::Package::Old < Gem::Package
78
78
 
79
79
  FileUtils.rm_rf destination
80
80
 
81
- FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0700
81
+ FileUtils.mkdir_p File.dirname(destination), :mode => dir_mode && 0755
82
82
 
83
83
  File.open destination, 'wb', file_mode(entry['mode']) do |out|
84
84
  out.write file_data