Class: SmartBox::Modes::CopyMode
- Inherits:
-
Object
- Object
- SmartBox::Modes::CopyMode
- Defined in:
- lib/smart_box/modes/copy_mode.rb
Overview
copy mode: copies the source project into an isolated workspace directory, then initializes a git repo inside the workspace for checkpoint support.
Constant Summary collapse
- COPY_EXCLUDES =
Directories and files to exclude when copying the source project
%w[ .git .smart_box node_modules vendor/bundle .bundle tmp log ].freeze
- EXCLUDE_DIRS =
%w[ .git .smart_box node_modules tmp log ].freeze
Instance Attribute Summary collapse
-
#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:) ⇒ CopyMode
constructor
A new instance of CopyMode.
-
#setup ⇒ Object
— entry point —.
- #teardown ⇒ Object
Constructor Details
#initialize(source_path:, workspace_path:) ⇒ CopyMode
Returns a new instance of CopyMode.
32 33 34 35 |
# File 'lib/smart_box/modes/copy_mode.rb', line 32 def initialize(source_path:, workspace_path:) @source_path = File.(source_path) @workspace_path = File.(workspace_path) end |
Instance Attribute Details
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
30 31 32 |
# File 'lib/smart_box/modes/copy_mode.rb', line 30 def source_path @source_path end |
#workspace_path ⇒ Object (readonly)
Returns the value of attribute workspace_path.
30 31 32 |
# File 'lib/smart_box/modes/copy_mode.rb', line 30 def workspace_path @workspace_path end |
Instance Method Details
#setup ⇒ Object
— entry point —
39 40 41 42 43 44 |
# File 'lib/smart_box/modes/copy_mode.rb', line 39 def setup validate_source! create_workspace! copy_source! init_git! end |
#teardown ⇒ Object
46 47 48 |
# File 'lib/smart_box/modes/copy_mode.rb', line 46 def teardown FileUtils.rm_rf(@workspace_path) if Dir.exist?(@workspace_path) end |