guard-copy 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/guard/copy.rb +36 -18
- data/lib/guard/copy/version.rb +1 -1
- metadata +6 -6
data/lib/guard/copy.rb
CHANGED
@@ -29,24 +29,9 @@ module Guard
|
|
29
29
|
validate_from_is_directory
|
30
30
|
validate_presence_of(:to)
|
31
31
|
validate_to_does_not_include_from
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
if target_paths.any?
|
38
|
-
UI.info("Guard::Copy will copy files from:")
|
39
|
-
UI.info(" #{options[:from]}")
|
40
|
-
UI.info("to:")
|
41
|
-
target_paths.each { |target_path| UI.info(" #{target_path}") }
|
42
|
-
|
43
|
-
if options[:delete]
|
44
|
-
UI.info("Guard::Copy will delete files removed from:")
|
45
|
-
UI.info(" #{options[:from]}")
|
46
|
-
UI.info("from:")
|
47
|
-
target_paths.each { |target_path| UI.info(" #{target_path}") }
|
48
|
-
end
|
49
|
-
end
|
32
|
+
resolve_targets
|
33
|
+
validate_no_targets_are_files
|
34
|
+
display_target_paths
|
50
35
|
end
|
51
36
|
|
52
37
|
# Called when just `enter` is pressed
|
@@ -157,5 +142,38 @@ module Guard
|
|
157
142
|
end
|
158
143
|
end
|
159
144
|
|
145
|
+
def resolve_targets
|
146
|
+
@targets.each do |target|
|
147
|
+
unless target.resolve
|
148
|
+
UI.warning("Guard::Copy - '#{target.pattern}' does not match a valid directory")
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def validate_no_targets_are_files
|
154
|
+
target_paths.each do |path|
|
155
|
+
if File.file?(path)
|
156
|
+
UI.error('Guard::Copy - :to option contains a file and must be all directories')
|
157
|
+
throw :task_has_failed
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def display_target_paths
|
163
|
+
if target_paths.any?
|
164
|
+
UI.info("Guard::Copy will copy files from:")
|
165
|
+
UI.info(" #{options[:from]}")
|
166
|
+
UI.info("to:")
|
167
|
+
target_paths.each { |target_path| UI.info(" #{target_path}") }
|
168
|
+
|
169
|
+
if options[:delete]
|
170
|
+
UI.info("Guard::Copy will delete files removed from:")
|
171
|
+
UI.info(" #{options[:from]}")
|
172
|
+
UI.info("from:")
|
173
|
+
target_paths.each { |target_path| UI.info(" #{target_path}") }
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
160
178
|
end
|
161
179
|
end
|
data/lib/guard/copy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-copy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.1
|
21
|
+
version: '1.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.1
|
29
|
+
version: '1.1'
|
30
30
|
description: Guard::Copy automatically copies files.
|
31
31
|
email:
|
32
32
|
- marc.schwieterman@gmail.com
|
@@ -54,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
54
|
version: '0'
|
55
55
|
segments:
|
56
56
|
- 0
|
57
|
-
hash:
|
57
|
+
hash: 7137334980115499
|
58
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
59
|
none: false
|
60
60
|
requirements:
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
segments:
|
65
65
|
- 0
|
66
|
-
hash:
|
66
|
+
hash: 7137334980115499
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project:
|
69
69
|
rubygems_version: 1.8.24
|