Class: RakeRoll::Roller
- Inherits:
-
Object
- Object
- RakeRoll::Roller
- Includes:
- GitCommands
- Defined in:
- lib/rake_roll/roller.rb
Instance Attribute Summary collapse
-
#current_branch ⇒ Object
readonly
Returns the value of attribute current_branch.
-
#current_version ⇒ Object
readonly
Returns the value of attribute current_version.
-
#new_version ⇒ Object
Returns the value of attribute new_version.
Instance Method Summary collapse
-
#initialize ⇒ Roller
constructor
A new instance of Roller.
- #log_to_s ⇒ Object
- #parsed_git_log(tag = nil) ⇒ Object
- #print_run_for_real_text(type) ⇒ Object
- #print_versions ⇒ Object
- #push ⇒ Object
Methods included from GitCommands
#get_current_branch, #git_add, #git_commit, #git_log, #git_push_branch, #git_push_tags, #git_tag
Constructor Details
#initialize ⇒ Roller
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_branch ⇒ Object (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_version ⇒ Object (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_version ⇒ Object
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_s ⇒ Object
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
57 58 59 60 61 |
# File 'lib/rake_roll/roller.rb', line 57 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| include_line?(line)} end |
#print_run_for_real_text(type) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rake_roll/roller.rb', line 40 def print_run_for_real_text(type) log_to_s puts "To run for real:" if type == "bump" puts "$> VERSION=#{new_version} PUSH=true rake roll:#{type}" else puts "$> PUSH=true rake roll:#{type}" end puts "----------------------" end |
#print_versions ⇒ Object
51 52 53 54 55 |
# File 'lib/rake_roll/roller.rb', line 51 def print_versions puts "" puts "----------------------" puts "Updating tag from #{current_version} to #{new_version}" end |
#push ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/rake_roll/roller.rb', line 63 def push puts "Rake Rolling..." puts "WARNING: no new CHANGELOG commits added" if parsed_git_log.empty? update_version_file unless next_version? clean_changelog_next update_changelog git_commit("Updating Version to #{new_version}") git_tag(new_version) unless next_version? git_push_branch(@current_branch) unless next_version? puts RakeRoll::Never.new.line end |