Skip to content

Commit fac241d

Browse files
gustavothecoderdeivid-rodriguez
authored andcommitted
deprecate gem build -C flag
1 parent 312fc36 commit fac241d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/rubygems/commands/build_command.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def initialize
2626
add_option "-C PATH", "Run as if gem build was started in <PATH> instead of the current working directory." do |value, options|
2727
options[:build_path] = value
2828
end
29+
deprecate_option "-C",
30+
version: "4.0",
31+
extra_msg: "-C is a global flag now. Use `gem -C PATH build GEMSPEC_FILE [options]` instead"
2932
end
3033

3134
def arguments # :nodoc:

test/rubygems/test_gem_commands_build_command.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ def test_handle_options
4141
assert_includes Gem.platforms, Gem::Platform.local
4242
end
4343

44+
def test_handle_deprecated_options
45+
use_ui @ui do
46+
@cmd.handle_options %w[-C ./test/dir]
47+
end
48+
49+
assert_equal "WARNING: The \"-C\" option has been deprecated and will be removed in Rubygems 4.0. " \
50+
"-C is a global flag now. Use `gem -C PATH build GEMSPEC_FILE [options]` instead\n",
51+
@ui.error
52+
end
53+
4454
def test_options_filename
4555
gemspec_file = File.join(@tempdir, @gem.spec_name)
4656

0 commit comments

Comments
 (0)