Class: BumpGemVersion::CLI
- Inherits:
-
Thor
- Object
- Thor
- BumpGemVersion::CLI
- Defined in:
- lib/bump_gem_version.rb
Overview
All the CLI commands are defined here
Constant Summary collapse
- BUMPS =
%w[major minor patch pre].freeze
- PRERELEASE =
["alpha", "beta", "rc", nil].freeze
- VERSION_REGEX =
/(\d+\.\d+\.\d+(?:-(?:#{PRERELEASE.compact.join("|")}))?)/
Instance Method Summary collapse
- #current ⇒ Object
- #exact(version) ⇒ Object
- #labels(labels = ) ⇒ Object
- #major ⇒ Object
- #minor ⇒ Object
- #patch ⇒ Object
Instance Method Details
#current ⇒ Object
14 |
# File 'lib/bump_gem_version.rb', line 14 def current = puts(current_version[0]) |
#exact(version) ⇒ Object
42 |
# File 'lib/bump_gem_version.rb', line 42 def exact(version) = bump_exact_version(version) |
#labels(labels = ) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bump_gem_version.rb', line 28 def labels(labels = [:default]) bump_type = labels&.split(",")&.find { |label| BUMPS.include?(label) } if bump_type.nil? && !BUMPS.include?([:default]) say_error("Unable to find a valid bump label or default label.", :red) exit 1 end return bump_gem_version(bump_type) unless bump_type.nil? bump_gem_version([:default]) end |
#major ⇒ Object
17 |
# File 'lib/bump_gem_version.rb', line 17 def major = bump_gem_version("major") |
#minor ⇒ Object
20 |
# File 'lib/bump_gem_version.rb', line 20 def minor = bump_gem_version("minor") |
#patch ⇒ Object
23 |
# File 'lib/bump_gem_version.rb', line 23 def patch = bump_gem_version("patch") |