class GitChain::Runner
Attributes
chain[R]
git[R]
storage[R]
Public Class Methods
new(path:)
click to toggle source
# File lib/git_chain/runner.rb, line 4 def initialize(path:) @git = GitHelper.new(path, Git.open(path)) @storage = GitChain::Storage.new(path: path) @chain = GitChain::Chain.new(storage, git) end
Public Instance Methods
add(parent:, old_base: nil)
click to toggle source
# File lib/git_chain/runner.rb, line 37 def add(parent:, old_base: nil) chain.mark_branch_as_dependent( child: git.current_branch, parent: parent, old_base: old_base ) end
call(command, *args)
click to toggle source
# File lib/git_chain/runner.rb, line 10 def call(command, *args) case command when 'show' show(branch: args[0]) when 'list' list() when 'add' add(parent: args[0], old_base: args[1]) when 'rebase' rebase(sub_command: args.first) else raise "Unknown Command: #{command}" end end
list()
click to toggle source
# File lib/git_chain/runner.rb, line 33 def list storage.print end
rebase(sub_command: nil)
click to toggle source
# File lib/git_chain/runner.rb, line 45 def rebase(sub_command: nil) if sub_command == 'all' chain.rebase_all(git.current_branch) else chain.rebase(git.current_branch) end end
show(branch: nil)
click to toggle source
# File lib/git_chain/runner.rb, line 25 def show(branch: nil) if branch storage.print_branch(branch: branch) else storage.print_branch(branch: git.current_branch) end end