Class: MovePathogenFile

Inherits:
Object
  • Object
show all
Defined in:
lib/vpm/tasks/move_pathogen_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_dir) ⇒ MovePathogenFile

Returns a new instance of MovePathogenFile.



2
3
4
5
# File 'lib/vpm/tasks/move_pathogen_file.rb', line 2

def initialize(base_dir)
  @source_file = File.join(base_dir, "pathogen", "autoload", "pathogen.vim")
  @destination = File.join(VPM.vim_dir_path, "autoload", "pathogen.vim")
end

Instance Method Details

#performObject



7
8
9
10
11
# File 'lib/vpm/tasks/move_pathogen_file.rb', line 7

def perform
  @file_already_exists = File.exists? @destination
  return true if @file_already_exists
  FileUtils.mv(@source_file, @destination)
end

#undoObject



13
14
15
16
# File 'lib/vpm/tasks/move_pathogen_file.rb', line 13

def undo
  return if @file_already_exists
  FileUtils.rm @destination
end