Module: Worktree

Defined in:
lib/worktree.rb,
lib/worktree/cli.rb,
lib/worktree/error.rb,
lib/worktree/config.rb,
lib/worktree/command.rb,
lib/worktree/project.rb,
lib/worktree/version.rb,
lib/worktree/launcher.rb,
lib/worktree/db_manager.rb,
lib/worktree/command/add.rb,
lib/worktree/command/init.rb,
lib/worktree/command/open.rb,
lib/worktree/command/remove.rb,
lib/worktree/tab_completion.rb,
lib/worktree/command/configure.rb,
lib/worktree/feature/clone_dbs.rb,
lib/worktree/feature/copy_files.rb,
lib/worktree/tab_completion/cli.rb,
lib/worktree/command/check_stale.rb,
lib/worktree/command/cherry_pick.rb,
lib/worktree/command/remove_stale.rb,
lib/worktree/tab_completion/branch_completion.rb,
lib/worktree/tab_completion/worktree_completion.rb,
lib/worktree/tab_completion/project_dir_completion.rb,
lib/worktree/tab_completion/remote_branch_completion.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Command, Config, Feature, TabCompletion Classes: CLI, DbManager, Error, Launcher, Project

Constant Summary collapse

VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.git_for(p_dir) ⇒ Object



28
29
30
# File 'lib/worktree.rb', line 28

def git_for(p_dir)
  Git.open("#{p_dir}/master", log: Worktree.logger)
end

.loggerObject



13
14
15
16
17
18
19
# File 'lib/worktree.rb', line 13

def logger
  return @logger if defined?(@logger)

  @logger = Logger.new(STDOUT)
  @logger.level = Logger::INFO
  @logger
end

.run_command(cmd, options = {}) ⇒ Object



21
22
23
24
25
26
# File 'lib/worktree.rb', line 21

def run_command(cmd, options = {})
  command = TTY::Command.new(output: Worktree.logger)
  command.run cmd, options
rescue TTY::Command::ExitError => e
  raise Error, e.message
end