josevalim-thor 0.10.26 → 0.10.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/thor/actions/directory.rb +24 -12
- metadata +2 -2
@@ -53,23 +53,35 @@ class Thor
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def invoke!
|
56
|
-
|
57
|
-
|
56
|
+
raise "Source #{source.inspect} does not exist" unless File.exists?(source)
|
57
|
+
base.empty_directory given_destination, @log_status
|
58
|
+
execute!
|
59
|
+
end
|
60
|
+
|
61
|
+
def revoke!
|
62
|
+
execute!
|
63
|
+
end
|
58
64
|
|
59
|
-
|
60
|
-
file_destination = File.join(given_destination, file_source.gsub(source, '.'))
|
65
|
+
protected
|
61
66
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
def execute!
|
68
|
+
lookup = recursive ? File.join(source, '**') : source
|
69
|
+
lookup = File.join(lookup, '{*,.[a-z]*}')
|
70
|
+
|
71
|
+
Dir[lookup].each do |file_source|
|
72
|
+
file_destination = File.join(given_destination, file_source.gsub(source, '.'))
|
73
|
+
next if File.directory?(file_source)
|
74
|
+
|
75
|
+
case file_source
|
76
|
+
when /\.empty_directory$/
|
77
|
+
base.empty_directory(File.dirname(file_destination), @log_status)
|
78
|
+
when /\.tt$/
|
79
|
+
base.template(file_source, file_destination[0..-4], @log_status)
|
80
|
+
else
|
81
|
+
base.copy_file(file_source, file_destination, @log_status)
|
69
82
|
end
|
70
83
|
end
|
71
84
|
end
|
72
|
-
end
|
73
85
|
|
74
86
|
end
|
75
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: josevalim-thor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yehuda Katz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|