Class: BitbucketMigration::WorkDir
- Inherits:
-
Object
- Object
- BitbucketMigration::WorkDir
- Defined in:
- lib/bitbucket_migration/git_workdir.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#clean! ⇒ Object
(also: #clean)
Cleanup method to force removal of temporary directory with all its contents.
-
#initialize ⇒ WorkDir
constructor
Used to create temporary directory to store source git repository.
Constructor Details
#initialize ⇒ WorkDir
Used to create temporary directory to store source git repository
8 9 10 11 12 13 14 15 16 |
# File 'lib/bitbucket_migration/git_workdir.rb', line 8 def initialize dir = Dir.mktmpdir if Dir.exists?(dir) @path = dir else raise RuntimeError.new("Unable to create temporary directory") end end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/bitbucket_migration/git_workdir.rb', line 5 def path @path end |
Instance Method Details
#clean! ⇒ Object Also known as: clean
Cleanup method to force removal of temporary directory with all its contents
20 21 22 23 |
# File 'lib/bitbucket_migration/git_workdir.rb', line 20 def clean! FileUtils.remove_entry_secure @path @path = nil end |