Class: DevFlow::Progress

Inherits:
App
  • Object
show all
Defined in:
lib/dev_flow/commands/progress.rb

Instance Attribute Summary

Attributes inherited from App

#command, #config, #git, #logger, #members, #roadmap, #waiting

Instance Method Summary collapse

Methods inherited from App

#all_member_names, #ask_rebase, #debug, #display_close_waiting, #display_tasks, #error, #hello, #hr, #hrb, #hrbh, #hrh, #i_am_leader?, #i_am_moderator?, #i_am_supervisor?, #i_have_power?, #in_release?, #in_trunk?, #info, #initialize, #leader_name, #load_roadmap, #new_version, #switch_to!, #sync?, #task, #tasks_for_close, #upload_progress!, #user_name, #warn

Constructor Details

This class inherits a constructor from DevFlow::App

Instance Method Details

#process!Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dev_flow/commands/progress.rb', line 4

def process!
  self.hello

  # whether I am working on a proper task branch
  current_task = self.task
  error "Not on a known task branch. Can not continue." unless current_task
  
  self.ask_rebase
  puts hr

  # commit you current branch and push
  progress = ARGV[1]
  progress = progress.to_i if progress
  
  if (progress and progress > 0 and progress < 99)
    warn "draw back complete percentage from #{current_task.progress.to_s.bold} to #{progress.to_s.bold}" if current_task.progress > progress
  else
    if progress
      error "invalid progress. Use percentage between 1 to 98."
    else
      puts "Current progress for task #{current_task.display_name.to_s.bold} is #{current_task.progress.to_s.bold}."
      exit
    end
  end
  
  message = ARGV[2] || "update progress to #{progress}"
  message = "[progress] " + message

  info "commit your progress"
  `git commit -am '#{message}'`
  if sync?
    info "push your progress to remote server"
    `git push #{@config["git_remote"]} #{current_task.branch_name}`
  else
    warn "your change did not pushed to the remote server."
  end
  
  # rewrite progress in ROADMAP file under develop trunk
  upload_progress! current_task, progress
end