Class: Semverify::CommandLine Private
- Inherits:
-
Thor
- Object
- Thor
- Semverify::CommandLine
- Defined in:
- lib/semverify/command_line.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The semverify cli
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
private
Tell Thor to exit with a non-zero status code if a command fails.
Instance Method Summary collapse
-
#current
private
Show the current gem version.
-
#file
private
Show the gem's version file.
-
#next_major(version = nil)
private
Increment the gem version's major part.
-
#next_minor(version = nil)
private
Increment the gem version's minor part.
-
#next_patch(version = nil)
private
Increment the gem version's patch part.
-
#next_pre(version = nil)
private
Increment the gem version's pre-release part.
-
#next_release(version = nil)
private
Increment the gem's pre-release version to a release version.
-
#validate(version)
private
Validate that the give version is a valid IncrementableSemver version.
Class Method Details
.exit_on_failure? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Tell Thor to exit with a non-zero status code if a command fails
19 |
# File 'lib/semverify/command_line.rb', line 19 def self.exit_on_failure? = true |
Instance Method Details
#current
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Show the current gem version
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/semverify/command_line.rb', line 35 def current version_file = Semverify::VersionFileFactory.find if version_file.nil? warn 'version file not found or is not valid' unless [:quiet] exit 1 end puts version_file.version unless [:quiet] end |
#file
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Show the gem's version file
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/semverify/command_line.rb', line 60 def file version_file = Semverify::VersionFileFactory.find if version_file.nil? warn 'version file not found or is not valid' unless [:quiet] exit 1 end puts version_file.path unless [:quiet] end |
#next_major(version = nil)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Increment the gem version's major part
126 127 128 |
# File 'lib/semverify/command_line.rb', line 126 def next_major(version = nil) increment_core_version(:next_major, version) end |
#next_minor(version = nil)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Increment the gem version's minor part
185 186 187 |
# File 'lib/semverify/command_line.rb', line 185 def next_minor(version = nil) increment_core_version(:next_minor, version) end |
#next_patch(version = nil)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Increment the gem version's patch part
244 245 246 |
# File 'lib/semverify/command_line.rb', line 244 def next_patch(version = nil) increment_core_version(:next_patch, version) end |
#next_pre(version = nil)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Increment the gem version's pre-release part
309 310 311 312 313 314 315 316 317 |
# File 'lib/semverify/command_line.rb', line 309 def next_pre(version = nil) args = {} args[:pre_type] = [:'pre-type'] if [:'pre-type'] args[:build_metadata] = [:build] if [:build] new_version = increment_version(:next_pre, args, version) puts new_version unless [:quiet] end |
#next_release(version = nil)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Increment the gem's pre-release version to a release version
352 353 354 355 356 357 358 359 |
# File 'lib/semverify/command_line.rb', line 352 def next_release(version = nil) args = {} args[:build_metadata] = [:build] if [:build] new_version = increment_version(:next_release, args, version) puts new_version unless [:quiet] end |
#validate(version)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Validate that the give version is a valid IncrementableSemver version
377 378 379 380 381 382 383 384 |
# File 'lib/semverify/command_line.rb', line 377 def validate(version) Semverify::IncrementableSemver.new(version) rescue Semverify::Error => e warn e. unless [:quiet] exit 1 else puts version unless [:quiet] end |