class Worktree::Command::Open
Public Class Methods
new(branch, project_dir:)
click to toggle source
# File lib/worktree/command/open.rb, line 8 def initialize(branch, project_dir:) @branch = branch @project_dir = File.expand_path project_dir || Project.resolve(branch).root @worktree = "#{@project_dir}/#{@branch}" end
Public Instance Methods
do!()
click to toggle source
# File lib/worktree/command/open.rb, line 14 def do! raise "Worktree #{@worktree} not found exists!" unless Dir.exist?(@worktree) raise 'No master repo found!' unless Dir.exist?("#{@project_dir}/master/.git") Launcher.new( project_dir: @project_dir, branch: @branch ).launch! end