class Bumpversion::Bumpversion

Public Class Methods

new(arguments = nil) click to toggle source
# 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

Public Instance Methods

run() click to toggle source
# 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