Class: Gitl::Sync
- Inherits:
-
SubCommand
- Object
- CLAide::Command
- Command
- SubCommand
- Gitl::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, options, #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 Gitl::SubCommand
Instance Method Details
#run_in_workspace ⇒ 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 |
# File 'lib/commands/sync.rb', line 14 def run_in_workspace remote = 'origin' workspace_config = self.workspace_config info "current work branch '#{workspace_config.workspace_branch}', remote branch '#{workspace_config.remote_branch}'." self.gitl_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.fetch(remote, :p => true, :t => true) g.pull("origin", workspace_config.workspace_branch) g.pull("origin", workspace_config.remote_branch) puts else error "please run 'gitl init' first." break end end end |