lib/thor/actions/directory.rb in thor-0.20.3 vs lib/thor/actions/directory.rb in thor-1.0.0
- old
+ new
@@ -1,6 +1,6 @@
-require "thor/actions/empty_directory"
+require_relative "empty_directory"
class Thor
module Actions
# Copies recursively the files from source directory to root directory.
# If any of the files finishes with .tt, it's considered to be a template
@@ -54,11 +54,11 @@
class Directory < EmptyDirectory #:nodoc:
attr_reader :source
def initialize(base, source, destination = nil, config = {}, &block)
- @source = File.expand_path(base.find_in_source_paths(source.to_s))
+ @source = File.expand_path(Dir[Util.escape_globs(base.find_in_source_paths(source.to_s))].first)
@block = block
super(base, destination, {:recursive => true}.merge(config))
end
def invoke!
@@ -94,25 +94,15 @@
base.copy_file(file_source, file_destination, config, &@block)
end
end
end
- if RUBY_VERSION < "2.0"
- def file_level_lookup(previous_lookup)
- File.join(previous_lookup, "{*,.[a-z]*}")
- end
+ def file_level_lookup(previous_lookup)
+ File.join(previous_lookup, "*")
+ end
- def files(lookup)
- Dir[lookup]
- end
- else
- def file_level_lookup(previous_lookup)
- File.join(previous_lookup, "*")
- end
-
- def files(lookup)
- Dir.glob(lookup, File::FNM_DOTMATCH)
- end
+ def files(lookup)
+ Dir.glob(lookup, File::FNM_DOTMATCH)
end
end
end
end