Class: Bumpversion::Bumpversion

Inherits:
Object
  • Object
show all
Defined in:
lib/bumpversion.rb

Instance Method Summary collapse

Constructor Details

#initialize(arguments = nil) ⇒ Bumpversion

Returns a new instance of Bumpversion.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/bumpversion.rb', line 13

def initialize(arguments = nil)
  PrettyOutput.start("Bump your project ... ☺ ")
  @options = {}

  PrettyOutput.begin("Parsing Options Start")
  parser = Parser.new @options, arguments
  @options = parser.parse
  PrettyOutput.sucess("Done!")

  PrettyOutput.begin("Parsing File Start")
  parser_file = ParseFile.new @options
  @options = parser_file.parse
  PrettyOutput.sucess("Done!")

  PrettyOutput.begin("Bump String")
  bump_string = BumpString.new @options
  @options = bump_string.bump
  PrettyOutput.sucess("Done!")

  @git = GitOperation.new @options
end

Instance Method Details

#runObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/bumpversion.rb', line 35

def run
  PrettyOutput.begin("Reading Files")
  reader = Reader.new @options
  PrettyOutput.sucess("Done!")

  PrettyOutput.begin("Writing Files")
  writer = Writer.new @options, reader
  writer.write!
  PrettyOutput.sucess("Done!")

  PrettyOutput.begin("Pre Commit Hooks")
  Hook.pre_commit_hook @options
  PrettyOutput.sucess("Done!")

  if @options[:git_commit] || @options[:git_tag] || @options[:git_push]
    PrettyOutput.begin("Git Operations")
    @git.do!
    PrettyOutput.sucess("Done!")
  end

  PrettyOutput.begin("Pos Commit Hooks")
  Hook.pos_commit_hook @options
  PrettyOutput.sucess("Done!")

  PrettyOutput.finish("Your project was Bumped with sucess! #{@options[:current_version]}#{@options[:new_version]}")
end