Method: Pkg::Retrieve.default_wget_command

Defined in:
lib/packaging/retrieve.rb

.default_wget_command(local_target, url, additional_options = {}) ⇒ Object

–no-parent = Only descend when recursing, never ascend –no-host-directories = Discard http://#Config.builds_server when saving to disk –level=0 = infinitely recurse, no limit –cut-dirs 3 = will cut off #Config.project, #Config.ref, and the first directory in #remote_target from the url when saving to disk –directory-prefix = where to save to disk (defaults to ./) –reject = Reject all hits that match the supplied regex



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/packaging/retrieve.rb', line 11

def default_wget_command(local_target, url, additional_options = {})
  default_options = {
    'quiet' => true,
    'recursive' => true,
    'no-parent' => true,
    'no-host-directories' => true,
    'level' => 0,
    'cut-dirs' => 3,
    'directory-prefix' => local_target,
    'reject' => "'index*'",
  }
  options = default_options.merge(additional_options)
  wget = Pkg::Util::Tool.check_tool('wget')
  wget_command = wget
  options.each do |option, value|
    next unless value
    if value.is_a?(TrueClass)
      wget_command << " --#{option}"
    else
      wget_command << " --#{option}=#{value}"
    end
  end
  wget_command << " #{url}"
  return wget_command
end