Class: Autoversion::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/autoversion/cli.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



12
13
14
15
16
# File 'lib/autoversion/cli.rb', line 12

def initialize(*args)
  super *args
  version_file_contents = CLI::version_file_contents || File.read(File.join(Dir.pwd, "Versionfile"))
  @versioner = Autoversion::Versioner.new version_file_contents, CLI::pwd
end

Class Attribute Details

.pwdObject

Returns the value of attribute pwd.



9
10
11
# File 'lib/autoversion/cli.rb', line 9

def pwd
  @pwd
end

.version_file_contentsObject

Returns the value of attribute version_file_contents.



8
9
10
# File 'lib/autoversion/cli.rb', line 8

def version_file_contents
  @version_file_contents
end

Instance Method Details

#majorObject



40
41
42
# File 'lib/autoversion/cli.rb', line 40

def major
  increment_version :major, options[:simulate], options[:force]
end

#minorObject



33
34
35
# File 'lib/autoversion/cli.rb', line 33

def minor
  increment_version :minor, options[:simulate], options[:force]
end

#patchObject



26
27
28
# File 'lib/autoversion/cli.rb', line 26

def patch
  increment_version :patch, options[:simulate], options[:force]
end

#read_versionObject



19
20
21
# File 'lib/autoversion/cli.rb', line 19

def read_version
  say @versioner.current_version.to_s, :cyan
end

#specialObject



46
47
48
# File 'lib/autoversion/cli.rb', line 46

def special
  create_build_version
end