Class: DevFlow::Complete

Inherits:
App
  • Object
show all
Defined in:
lib/dev_flow/commands/complete.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
# File 'lib/dev_flow/commands/complete.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

  info "Task resource list are #{current_task.resources.join(',')}, you are #{@config["whoami"]}"
  unless current_task.resources.include?(@config["whoami"]) 
    if i_have_power?
      role = 'supervisor' if i_am_supervisor?
      role = 'moderator' if i_am_moderator?
      role = 'leader' if i_am_leader?
      warn "You are complete the task as a #{role}"
    else
      error "You are not in the resource list for that task."
    end      
  end

  error "Can not work offline for complete a task" unless sync?
  self.ask_rebase
  puts hr

  # commit you current branch and push
  progress = 99
  message = ARGV[2] || "complete the branch by set progress to 99."
  message = "[complete] " + message

  info "Commit your progress"
  `git commit -am '#{message}'`
  info "Push your progress to remote server"
  `git push #{@config["git_remote"]} #{current_task.branch_name}`
  
  # rewrite progress in ROADMAP file under develop trunk
  upload_progress! current_task, progress, true
end