Class: LogicalConstruct::UnpackTarballTask

Inherits:
TarballTask
  • Object
show all
Defined in:
lib/logical-construct/archive-tasks.rb

Instance Method Summary collapse

Methods inherited from TarballTask

#action_flag, #add_options, #default_configuration, #resolve_configuration, #tar_command, #tar_command_without_directory

Instance Method Details

#commandObject



122
123
124
# File 'lib/logical-construct/archive-tasks.rb', line 122

def command
  (cmd("mkdir", "-p", unpacked_dir.absolute_path) & tar_command("--extract")) #ok
end

#create_target_dependenciesObject



132
133
134
135
136
# File 'lib/logical-construct/archive-tasks.rb', line 132

def create_target_dependencies
  target_files.each do |path|
    ::Rake::FileTask.define_task(path => name)
  end
end

#needed?Boolean

Returns:

  • (Boolean)


138
139
140
141
142
143
144
# File 'lib/logical-construct/archive-tasks.rb', line 138

def needed?
  return true if super
  if File::exists?(archive_path.absolute_path)
    return !(tar_command("--compare")).succeeds?
  end
  return true
end

#target_filesObject



126
127
128
129
130
# File 'lib/logical-construct/archive-tasks.rb', line 126

def target_files
  FileList[tar_command_without_directory("--list", false).run.stdout.split.map do |path|
    unpacked_dir.pathname.join(path).to_s
  end]
end