Class: GitBundle::Commands::Generate

Inherits:
Object
  • Object
show all
Includes:
GitBundle::Console
Defined in:
lib/git_bundle/commands/generate.rb

Constant Summary

Constants included from GitBundle::Console

GitBundle::Console::COLORS

Instance Method Summary collapse

Methods included from GitBundle::Console

#clear_line, #parallel, #puts_attention, #puts_diverged_repos, #puts_error, #puts_heading, #puts_prompt, #puts_repo_heading, #puts_repo_heading_switch, #puts_stay_on_line, #puts_wait_line

Constructor Details

#initialize(project, args) ⇒ Generate

Returns a new instance of Generate.



6
7
8
9
# File 'lib/git_bundle/commands/generate.rb', line 6

def initialize(project, args)
  @project = project
  @args = args
end

Instance Method Details

#invokeObject



11
12
13
14
15
# File 'lib/git_bundle/commands/generate.rb', line 11

def invoke
  @project.load_dependant_repositories
  @project.dependant_repositories.each { |repo| @project.branch_config.current[repo.name] = remote_branch_reference(repo) }
  @project.branch_config.save
end

#remote_branch_reference(repository) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/git_bundle/commands/generate.rb', line 17

def remote_branch_reference(repository)
  if repository.remote
    "#{repository.remote}/#{repository.branch}"
  else
    repository.branch
  end
end