Sha256: 5b112899e118c5c5a04e322315e9c28bbfe681f15410804e9704ef496dbd1b3b

Contents?: true

Size: 1.64 KB

Versions: 12

Compression:

Stored size: 1.64 KB

Contents

require 'chef_fs/knife'
require 'chef_fs/command_line'

class Chef
  class Knife
    remove_const(:Download) if const_defined?(:Download) && Download.name == 'Chef::Knife::Download' # override Chef's version
    class Download < ::ChefFS::Knife
      ChefFS = ::ChefFS
      banner "knife download PATTERNS"

      common_options

      option :recurse,
        :long => '--[no-]recurse',
        :boolean => true,
        :default => true,
        :description => "List directories recursively."

      option :purge,
        :long => '--[no-]purge',
        :boolean => true,
        :default => false,
        :description => "Delete matching local files and directories that do not exist remotely."

      option :force,
        :long => '--[no-]force',
        :boolean => true,
        :default => false,
        :description => "Force upload of files even if they match (quicker and harmless, but doesn't print out what it changed)"

      option :dry_run,
        :long => '--dry-run',
        :short => '-n',
        :boolean => true,
        :default => false,
        :description => "Don't take action, only print what would happen"

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
knife-essentials-1.0.0.beta1 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.8 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.7 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.6 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.5 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.4 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.3 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.2 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.1 lib/chef/knife/download_essentials.rb
knife-essentials-0.9.0 lib/chef/knife/download_essentials.rb
knife-essentials-0.8.6 lib/chef/knife/download_essentials.rb
knife-essentials-0.8.5 lib/chef/knife/download_essentials.rb