Class: VersionBoss::Gem::CommandLine Private

Inherits:
Thor
  • Object
show all
Defined in:
lib/version_boss/gem/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 version_boss cli

Examples:

require 'version_boss'

VersionBoss::CommandLine.start(ARGV)

Class Method Summary collapse

Instance Method Summary collapse

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



20
# File 'lib/version_boss/gem/command_line.rb', line 20

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



36
37
38
39
40
41
42
43
44
45
# File 'lib/version_boss/gem/command_line.rb', line 36

def current
  version_file = VersionBoss::Gem::VersionFileFactory.find

  if version_file.nil?
    warn 'version file not found or is not valid' unless options[:quiet]
    exit 1
  end

  puts version_file.version unless options[: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



61
62
63
64
65
66
67
68
69
70
# File 'lib/version_boss/gem/command_line.rb', line 61

def file
  version_file = VersionBoss::Gem::VersionFileFactory.find

  if version_file.nil?
    warn 'version file not found or is not valid' unless options[:quiet]
    exit 1
  end

  puts version_file.path unless options[: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



121
122
123
# File 'lib/version_boss/gem/command_line.rb', line 121

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



174
175
176
# File 'lib/version_boss/gem/command_line.rb', line 174

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



227
228
229
# File 'lib/version_boss/gem/command_line.rb', line 227

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



286
287
288
289
290
291
292
293
# File 'lib/version_boss/gem/command_line.rb', line 286

def next_pre(version = nil)
  args = {}
  args[:pre_type] = options[:'pre-type'] if options[:'pre-type']

  new_version = increment_version(:next_pre, args, version)

  puts new_version unless options[: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



322
323
324
325
326
327
# File 'lib/version_boss/gem/command_line.rb', line 322

def next_release(version = nil)
  args = {}
  new_version = increment_version(:next_release, args, version)

  puts new_version unless options[: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



345
346
347
348
349
350
351
352
# File 'lib/version_boss/gem/command_line.rb', line 345

def validate(version)
  VersionBoss::Gem::IncrementableVersion.new(version)
rescue VersionBoss::Error => e
  warn e.message unless options[:quiet]
  exit 1
else
  puts version unless options[:quiet]
end