class Thor::Actions::Directory
:nodoc:
def execute!
def execute! lookup = Util.escape_globs(source) lookup = config[:recursive] ? File.join(lookup, '**') : lookup lookup = file_level_lookup(lookup) files(lookup).sort.each do |file_source| next if File.directory?(file_source) file_destination = File.join(given_destination, file_source.gsub(source, '.')) file_destination.gsub!('/./', '/') case file_source when /\.empty_directory$/ dirname = File.dirname(file_destination).gsub(/\/\.$/, '') next if dirname == given_destination base.empty_directory(dirname, config) when /\.tt$/ destination = base.template(file_source, file_destination[0..-4], config, &@block) else destination = base.copy_file(file_source, file_destination, config, &@block) end end end
def file_level_lookup(previous_lookup)
def file_level_lookup(previous_lookup) File.join(previous_lookup, '{*,.[a-z]*}') end
def file_level_lookup(previous_lookup)
def file_level_lookup(previous_lookup) File.join(previous_lookup, '*') end
def files(lookup)
def files(lookup) Dir[lookup] end
def files(lookup)
def files(lookup) Dir.glob(lookup, File::FNM_DOTMATCH) end
def initialize(base, source, destination=nil, config={}, &block)
def initialize(base, source, destination=nil, config={}, &block) @source = File.expand_path(base.find_in_source_paths(source.to_s)) @block = block super(base, destination, { :recursive => true }.merge(config)) end
def invoke!
def invoke! base.empty_directory given_destination, config execute! end
def revoke!
def revoke! execute! end