From 0629e695e3130f875641542ad2593b19b56703ef Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 10 Jan 2020 20:18:31 +0900 Subject: Added `--platform` option to `build` command --- lib/rubygems/commands/build_command.rb | 5 +++++ lib/rubygems/specification.rb | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'lib/rubygems') 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 -- cgit v1.2.3