z_build 1.1.1 → 1.1.2
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/z_build.rb +53 -12
- metadata +3 -3
data/lib/z_build.rb
CHANGED
@@ -7,10 +7,11 @@ require 'tempfile'
|
|
7
7
|
# light-weight build processes, written in Ruby. This library was authored in my spare time
|
8
8
|
# for {https://zoosk.com Zoosk} with a desire for more easily maintainable build processes,
|
9
9
|
# with a love for Ruby, and with a strong dislike for PHING/ANT and XML builds systems.
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
10
|
+
# Z'Build mostly concerns itself with directory creation, file copying, token replacement,
|
11
|
+
# and relative path management. At it's core the Z'Build suite is intended to be minimal,
|
12
|
+
# sufficient, and transparent. If there is some aspect of your existing build that cannot
|
13
|
+
# be translated or mimicked with a series of Z'Build functions, then there may well be a missing
|
14
|
+
# feature, or otherwise there might be an opportunity to simplify your processes. However, it is
|
14
15
|
# expected that custom needs will require specialized code and as a library Z'Build is
|
15
16
|
# designed to be easily extended and works very well in conjuncation with build tools
|
16
17
|
# such as Ruby Rake. It is not meant to be a stand-alone build replacement - Rake/Thor/etc
|
@@ -211,10 +212,30 @@ module ZBuild
|
|
211
212
|
queued_dirs = []
|
212
213
|
queued_files = {}
|
213
214
|
working_exclude = opts[:exclude] ? opts[:exclude].to_a : []
|
215
|
+
|
216
|
+
# normalize excluded file relative path notations
|
217
|
+
working_exclude = working_exclude.collect do |e|
|
218
|
+
p = e.clone
|
219
|
+
p = p.sub('./', '')
|
220
|
+
|
221
|
+
# when working path is relative to root, walk path will return paths relative to root as well
|
222
|
+
# so ensure all exclusion paths are also relative to root
|
223
|
+
if from.start_with?('/') && !p.start_with?('/')
|
224
|
+
p = File.join('/', p)
|
225
|
+
elsif from.start_with?('./') && !p.start_with?('./')
|
226
|
+
p = File.join('./', p)
|
227
|
+
end
|
228
|
+
|
229
|
+
if p.end_with? '/'
|
230
|
+
p = p[0, p.size - 1]
|
231
|
+
end
|
232
|
+
|
233
|
+
p
|
234
|
+
end
|
214
235
|
|
215
236
|
if opts[:recurse]
|
216
237
|
|
217
|
-
if !File.directory?
|
238
|
+
if !File.directory? working_path_given
|
218
239
|
raise "Working path must be a directory when :recurse => true, given: #{working_path_given}"
|
219
240
|
end
|
220
241
|
|
@@ -233,9 +254,16 @@ module ZBuild
|
|
233
254
|
|
234
255
|
# from - the directory relative to working dir
|
235
256
|
# deploy_path_given - the directory relative to the deploy dir
|
236
|
-
|
237
257
|
self.walk_path(from) do |f_path, is_dir|
|
238
|
-
|
258
|
+
should_exclude = false
|
259
|
+
working_exclude.each do |e|
|
260
|
+
if f_path.start_with? e
|
261
|
+
should_exclude = true
|
262
|
+
break
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
if should_exclude
|
239
267
|
# ignore files or directories marked for exclusion
|
240
268
|
next
|
241
269
|
end
|
@@ -265,10 +293,23 @@ module ZBuild
|
|
265
293
|
end
|
266
294
|
|
267
295
|
self.glob(from) do |f_path, is_dir|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
296
|
+
should_exclude = false
|
297
|
+
working_exclude.each do |e|
|
298
|
+
f_path_normalized = e
|
299
|
+
if f_path_normalized.start_with?('./') && !e.start_with?('./')
|
300
|
+
f_path_normalized = f_path_normalized.sub('./', '')
|
301
|
+
end
|
302
|
+
|
303
|
+
if f_path_normalized.start_with? e
|
304
|
+
should_exclude = true
|
305
|
+
break
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
if should_exclude
|
310
|
+
# ignore files or directories marked for exclusion
|
311
|
+
next
|
312
|
+
end
|
272
313
|
|
273
314
|
if File.directory? deploy_path_given
|
274
315
|
# given dir, so retain name of original file
|
@@ -277,7 +318,7 @@ module ZBuild
|
|
277
318
|
# deploy_path given is an actual file target
|
278
319
|
dest_path = deploy_path_given
|
279
320
|
end
|
280
|
-
|
321
|
+
|
281
322
|
# f_path provided is relative to working dir - dest is absolute to deploy target
|
282
323
|
queued_files[f_path] = dest_path
|
283
324
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 2
|
9
|
+
version: 1.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Shaun Bruno
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2013-
|
17
|
+
date: 2013-04-15 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|