diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-01-10 20:18:31 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2020-09-28 14:54:22 +0900 |
commit | 0629e695e3130f875641542ad2593b19b56703ef (patch) | |
tree | 9fcab4edb8df8c74c695118838b48ab6a44d7a22 /lib/rubygems | |
parent | 67ae1d441dbc2d944a08b95178f99d2cf67169e1 (diff) |
Added `--platform` option to `build` command
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3599
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/commands/build_command.rb | 5 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index decdca06bb..eaf8573d8f 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -1,11 +1,16 @@ # frozen_string_literal: true require 'rubygems/command' require 'rubygems/package' +require 'rubygems/version_option' class Gem::Commands::BuildCommand < Gem::Command + include Gem::VersionOption + def initialize super 'build', 'Build a gem from a gemspec' + add_platform_option + add_option '--force', 'skip validation of the spec' do |value, options| options[:force] = true end diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 883cad35f9..dc93adb5ab 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1991,6 +1991,10 @@ class Gem::Specification < Gem::BasicSpecification self.name = name if name self.version = version if version + if platform = Gem.platforms.last and platform != Gem::Platform::RUBY and platform != Gem::Platform.local + self.platform = platform + end + yield self if block_given? end |