Class: Chef::Knife::Download

Inherits:
ChefFS::Knife show all
Defined in:
lib/chef/knife/download.rb

Instance Method Summary collapse

Methods inherited from ChefFS::Knife

#chef_fs, #configure_chef, #create_chef_fs, #create_local_fs, deps, #discover_repo_dir, #format_path, inherited, #local_fs, #parallelize, #pattern_arg_from, #pattern_args, #pattern_args_from

Instance Method Details

#runObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/chef/knife/download.rb', line 65

def run
  if name_args.length == 0
    show_usage
    ui.fatal("You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"")
    exit 1
  end

  error = false
  pattern_args.each do |pattern|
    fs_error, _result = Chef::ChefFS::FileSystem.copy_to(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, config, ui, proc { |entry| format_path(entry) })
    if fs_error
      error = true
    end
  end
  if error
    exit 1
  end
end