Class: RakeRoll::Roller

Inherits:
Object
  • Object
show all
Includes:
GitCommands
Defined in:
lib/rake_roll/roller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GitCommands

#get_current_branch, #git_add, #git_commit, #git_log, #git_push_branch, #git_push_tags, #git_tag

Constructor Details

#initializeRoller

Returns a new instance of Roller.



9
10
11
12
13
# File 'lib/rake_roll/roller.rb', line 9

def initialize
  @current_version = current_version
  @current_branch = current_branch
  @new_version = nil
end

Instance Attribute Details

#current_branchObject (readonly)

Returns the value of attribute current_branch.



6
7
8
# File 'lib/rake_roll/roller.rb', line 6

def current_branch
  @current_branch
end

#current_versionObject (readonly)

Returns the value of attribute current_version.



6
7
8
# File 'lib/rake_roll/roller.rb', line 6

def current_version
  @current_version
end

#new_versionObject

Returns the value of attribute new_version.



7
8
9
# File 'lib/rake_roll/roller.rb', line 7

def new_version
  @new_version
end

Instance Method Details

#log_to_sObject



32
33
34
35
36
37
38
# File 'lib/rake_roll/roller.rb', line 32

def log_to_s
  puts "----------------------"
  puts "CHANGELOG"
  puts parsed_git_log
  puts "WARNING: no new CHANGELOG commits added" if parsed_git_log.empty?
  puts "----------------------"
end

#parsed_git_log(tag = nil) ⇒ Object



52
53
54
55
56
# File 'lib/rake_roll/roller.rb', line 52

def parsed_git_log(tag=nil)
  tag ||= current_branch
  log_type = "#{current_version}..#{tag} --pretty=format:'%s'"
  git_log(log_type).split("\n").select{|line| line[0] == "*"}
end


40
41
42
43
44
# File 'lib/rake_roll/roller.rb', line 40

def print_run_for_real_text(type)
  log_to_s
  puts "=> rake roll:#{type} PUSH=true (to run for real)"
  puts "----------------------"
end


46
47
48
49
50
# File 'lib/rake_roll/roller.rb', line 46

def print_versions
  puts ""
  puts "----------------------"
  puts "Updating tag from #{current_version} to #{new_version}"
end

#pushObject



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/rake_roll/roller.rb', line 58

def push
  puts "Rake Rolling..."
  puts "WARNING: no new CHANGELOG commits added" if parsed_git_log.empty?
  update_version_file
  update_changelog
  git_commit("Updating Version to #{new_version}")
  git_tag(new_version)
  git_push_branch(@current_branch)
  git_push_tags
  puts RakeRoll::Never.new.line
end