Class: SmartBox::Modes::GitWorktreeMode
- Inherits:
-
Object
- Object
- SmartBox::Modes::GitWorktreeMode
- Defined in:
- lib/smart_box/modes/git_worktree_mode.rb
Instance Attribute Summary collapse
-
#branch_name ⇒ Object
readonly
Returns the value of attribute branch_name.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
-
#workspace_path ⇒ Object
readonly
Returns the value of attribute workspace_path.
Instance Method Summary collapse
-
#initialize(source_path:, workspace_path:, box_id:) ⇒ GitWorktreeMode
constructor
A new instance of GitWorktreeMode.
-
#setup ⇒ Object
— entry points —.
- #teardown ⇒ Object
Constructor Details
#initialize(source_path:, workspace_path:, box_id:) ⇒ GitWorktreeMode
Returns a new instance of GitWorktreeMode.
8 9 10 11 12 13 |
# File 'lib/smart_box/modes/git_worktree_mode.rb', line 8 def initialize(source_path:, workspace_path:, box_id:) @source_path = File.(source_path) @workspace_path = File.(workspace_path) @box_id = box_id @branch_name = "smart-box/#{box_id}" end |
Instance Attribute Details
#branch_name ⇒ Object (readonly)
Returns the value of attribute branch_name.
6 7 8 |
# File 'lib/smart_box/modes/git_worktree_mode.rb', line 6 def branch_name @branch_name end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
6 7 8 |
# File 'lib/smart_box/modes/git_worktree_mode.rb', line 6 def source_path @source_path end |
#workspace_path ⇒ Object (readonly)
Returns the value of attribute workspace_path.
6 7 8 |
# File 'lib/smart_box/modes/git_worktree_mode.rb', line 6 def workspace_path @workspace_path end |
Instance Method Details
#setup ⇒ Object
— entry points —
17 18 19 20 21 22 |
# File 'lib/smart_box/modes/git_worktree_mode.rb', line 17 def setup validate_source! ensure_branch! create_worktree! init_checkpoint! end |
#teardown ⇒ Object
24 25 26 |
# File 'lib/smart_box/modes/git_worktree_mode.rb', line 24 def teardown remove_worktree! if worktree_exists? end |