Port Homebrew::DevCmd::BumpRevision
This commit is contained in:
parent
d873881c47
commit
1097496a06
@ -1,15 +1,14 @@
|
|||||||
# typed: true
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "abstract_command"
|
||||||
require "formula"
|
require "formula"
|
||||||
require "cli/parser"
|
require "cli/parser"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module DevCmd
|
||||||
|
class BumpRevision < AbstractCommand
|
||||||
sig { returns(CLI::Parser) }
|
cmd_args do
|
||||||
def bump_revision_args
|
|
||||||
Homebrew::CLI::Parser.new do
|
|
||||||
description <<~EOS
|
description <<~EOS
|
||||||
Create a commit to increment the revision of <formula>. If no revision is
|
Create a commit to increment the revision of <formula>. If no revision is
|
||||||
present, "revision 1" will be added.
|
present, "revision 1" will be added.
|
||||||
@ -27,11 +26,9 @@ module Homebrew
|
|||||||
|
|
||||||
named_args :formula, min: 1, without_api: true
|
named_args :formula, min: 1, without_api: true
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def bump_revision
|
|
||||||
args = bump_revision_args.parse
|
|
||||||
|
|
||||||
|
sig { override.void }
|
||||||
|
def run
|
||||||
# As this command is simplifying user-run commands then let's just use a
|
# As this command is simplifying user-run commands then let's just use a
|
||||||
# user path, too.
|
# user path, too.
|
||||||
ENV["PATH"] = PATH.new(ORIGINAL_PATHS).to_s
|
ENV["PATH"] = PATH.new(ORIGINAL_PATHS).to_s
|
||||||
@ -76,3 +73,5 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "cmd/shared_examples/args_parse"
|
require "cmd/shared_examples/args_parse"
|
||||||
|
require "dev-cmd/bump-revision"
|
||||||
|
|
||||||
RSpec.describe "brew bump-revision" do
|
RSpec.describe Homebrew::DevCmd::BumpRevision do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments", argv: ["foo"]
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user