Class: Texico::CLI::Command::Release
- Defined in:
- lib/texico/cli/command/release.rb
Constant Summary collapse
- GIT_DIR =
File.('.git').freeze
Constants inherited from Build
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Build
Methods inherited from Base
inherited, #initialize, #load_config, match, priority, select
Constructor Details
This class inherits a constructor from Texico::CLI::Command::Base
Class Method Details
.match?(command) ⇒ Boolean
49 50 51 |
# File 'lib/texico/cli/command/release.rb', line 49 def match?(command) command == 'release' end |
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/texico/cli/command/release.rb', line 7 def run unless File.exist? GIT_DIR prompt.error "#{ICON} You don't seem to be using git." exit end unless label = Git.('.') = .length count = case when 0 then 'no releases' when 1 then 'one release' else "#{} releases" end prompt.say "#{ICON} This project currently has #{count}\n", color: :bold if > 0 prompt.say .map { |t| "* #{t}" }.join("\n") end exit end success = super # Build the project unless success prompt.error "#{ICON} I will only tag the release when it builds " \ "without errors." exit end Git.tag '.', label, "Releasing #{label}" end |