class RakeDependencies::Tasks::Extract
Public Instance Methods
define()
click to toggle source
# File lib/rake_dependencies/tasks/extract.rb, line 38 def define desc "Extract #{dependency} archive" task name do parameters = { version: version, platform: platform, os_id: os_id, ext: ext } distribution_file_name = Template.new(file_name_template) .with_parameters(parameters) .render distribution_file_directory = File.join(path, distribution_directory) distribution_file_path = File.join( distribution_file_directory, distribution_file_name) extraction_path = File.join(path, binary_directory) options = {} if strip_path_template options[:strip_path] = Template.new(strip_path_template) .with_parameters(parameters) .render end if target_name_template options[:rename_to] = Template.new(target_name_template) .with_parameters(parameters) .render end extractor = extractor_for_extension.new( distribution_file_path, extraction_path, options) extractor.extract end end
process_arguments(args)
click to toggle source
Calls superclass method
RakeDependencies::TaskLib#process_arguments
# File lib/rake_dependencies/tasks/extract.rb, line 33 def process_arguments args super(args) self.name = args[0] if args[0] end
Private Instance Methods
ext()
click to toggle source
# File lib/rake_dependencies/tasks/extract.rb, line 96 def ext case resolved_type when :tar_gz then '.tar.gz' when :tgz then '.tgz' when :zip then '.zip' when :uncompressed then '' else raise "Unknown type: #{type}" end end
extractor_for_extension()
click to toggle source
# File lib/rake_dependencies/tasks/extract.rb, line 80 def extractor_for_extension extractors[resolved_type] end
os_id()
click to toggle source
# File lib/rake_dependencies/tasks/extract.rb, line 84 def os_id os_ids[platform] end
platform()
click to toggle source
# File lib/rake_dependencies/tasks/extract.rb, line 88 def platform RUBY_PLATFORM =~ /darwin/ ? :mac : :linux end
resolved_type()
click to toggle source
# File lib/rake_dependencies/tasks/extract.rb, line 92 def resolved_type type.is_a?(Hash) ? type[platform].to_sym : type.to_sym end