Class: RakeDependencies::Extractors::UncompressedExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_dependencies/extractors.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path, extract_path, options = {}) ⇒ UncompressedExtractor

Returns a new instance of UncompressedExtractor.



74
75
76
77
78
# File 'lib/rake_dependencies/extractors.rb', line 74

def initialize(file_path, extract_path, options = {})
  @file_path = file_path
  @extract_path = extract_path
  @options = options
end

Instance Method Details

#extractObject



80
81
82
83
84
85
86
87
88
# File 'lib/rake_dependencies/extractors.rb', line 80

def extract
  target_name = @options[:rename_to] || File.basename(@file_path)
  source = @file_path
  destination = File.join(@extract_path, target_name)

  FileUtils.mkdir_p(@extract_path)
  FileUtils.cp(source, destination)
  FileUtils.chmod(0755, destination)
end