Class: BitbucketMigration::WorkDir

Inherits:
Object
  • Object
show all
Defined in:
lib/bitbucket_migration/git_workdir.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWorkDir

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

#pathObject (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