Class: Gb::Sync
- Inherits:
-
SubCommand
- Object
- CLAide::Command
- Command
- SubCommand
- Gb::Sync
- Defined in:
- lib/commands/sync.rb
Instance Attribute Summary
Attributes inherited from SubCommand
Instance Method Summary collapse
Methods inherited from SubCommand
#check_uncommit, #initialize, #run, #save_workspace_config, #validate!, #workspace_config
Methods inherited from Command
#error, handle_exception, #info, report_error, run
Constructor Details
This class inherits a constructor from Gb::SubCommand
Instance Method Details
#run_in_config ⇒ Object
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/commands/sync.rb', line 14 def run_in_config remote = 'origin' workspace_config = self.workspace_config info "current work branch '#{workspace_config.work_branch}', remote branch '#{workspace_config.remote_branch}'." self.gb_config.projects.each do |project| project_path = File.(project.name, './') if File.exist?(project_path) info "sync project '#{project.name}'..." g = Git.open(project_path) # if workspace_config.workspace_branch != g.current_branch # error "current branch is not work branch(#{workspace_config.workspace_branch})." # exit(1) # end g.checkout(workspace_config.work_branch) g.fetch(remote, :p => true, :t => true) g.pull("origin", workspace_config.work_branch) g.pull("origin", workspace_config.remote_branch) puts else error "please run 'gb init first." break end end end |