Class: GemKit::Release::CLI
- Inherits:
-
Thor
- Object
- Thor
- GemKit::Release::CLI
- Defined in:
- lib/gem_kit/release/cli.rb
Overview
The command line behind gem kit, on Thor.
Thor gives us the parts a hand-rolled parser always ends up needing
badly: per-command help built from the desc/method_option
declarations, a subcommand listing, and — the reason for choosing it over
a plain option parser — Thor::Group and Thor::Actions, the same generator
machinery Rails' rails generate is built on. gem kit setup is a
generator, so it gets create/identical/conflict reporting and the
overwrite prompt without writing any of it.
gem kit the listing
gem kit help bump that command's options
Each command here is a thin front for a plain object under CLI::; the work itself is in Gate, VersionFile, Changelog and Deprecate.
Constant Summary collapse
- WORKFLOW =
The order the commands go in — printed above the command listing so nobody has to guess when to commit or when to write the changelog. The question the process is easy to get wrong on is exactly the one this answers: the changelog is written after the bump, then the two are committed together, and only then does release run.
<<~TXT Release, in order: 1. bin/test # green suite 2. gem kit bump [SEGMENT] # move the version, relock the Gemfile 3. gem kit changelog --write # AI CLI drafts this version's entry 4. gem kit changelog [VERSION] # lint the entry, confirm ready to release 5. git commit -am "Release ..." # bump + lockfile + entry, one commit 6. gem kit release # gate, build, push, tag (also pushes the tag) 7. git push # publish the release commit TXT
Class Method Summary collapse
-
.banner(command, _namespace = nil, _subcommand = false) ⇒ Object
gem kitwith no arguments lists the commands rather than erroring. -
.exit_on_failure? ⇒ Boolean
Thor asks; without it every invocation warns.
-
.help(shell, subcommand = false) ⇒ Object
Prepend the workflow to the top-level
gem kithelp.
Instance Method Summary collapse
- #bump(segment = "patch") ⇒ Object
- #changelog(version = nil) ⇒ Object
- #deprecations(version = nil) ⇒ Object
- #release ⇒ Object
- #tag ⇒ Object
Class Method Details
.banner(command, _namespace = nil, _subcommand = false) ⇒ Object
gem kit with no arguments lists the commands rather than erroring.
65 66 67 |
# File 'lib/gem_kit/release/cli.rb', line 65 def self.(command, _namespace = nil, _subcommand = false) "gem kit #{command.usage}" end |
.exit_on_failure? ⇒ Boolean
Thor asks; without it every invocation warns.
62 |
# File 'lib/gem_kit/release/cli.rb', line 62 def self.exit_on_failure? = true |
.help(shell, subcommand = false) ⇒ Object
Prepend the workflow to the top-level gem kit help. gem kit help <command> sets subcommand=true and lands here too; that page already
has its own long_desc, so leave it alone.
72 73 74 75 76 |
# File 'lib/gem_kit/release/cli.rb', line 72 def self.help(shell, subcommand = false) shell.say(WORKFLOW) unless subcommand shell.say unless subcommand super end |
Instance Method Details
#bump(segment = "patch") ⇒ Object
98 99 100 |
# File 'lib/gem_kit/release/cli.rb', line 98 def bump(segment = "patch") Commands::Bump.new().call(segment) end |
#changelog(version = nil) ⇒ Object
117 118 119 |
# File 'lib/gem_kit/release/cli.rb', line 117 def changelog(version = nil) Commands::Changelog.new().call(version) end |
#deprecations(version = nil) ⇒ Object
130 131 132 |
# File 'lib/gem_kit/release/cli.rb', line 130 def deprecations(version = nil) Commands::Deprecations.new().call(version) end |