bosh_cli 1.5.0.pre.1525 → 1.5.0.pre.1612

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,3 @@
1
- # Copyright (c) 2009-2012 VMware, Inc.
2
-
3
1
  module Bosh::Cli
4
2
  class PackageBuilder
5
3
  include PackagingHelper
@@ -246,34 +244,21 @@ module Bosh::Cli
246
244
  all_matches = Set.new
247
245
 
248
246
  @globs.each do |glob|
249
- # Glob like core/dea/**/* might not yield anything in alt source even
250
- # when `src_alt/core' exists. That's error prone, so we don't lookup
251
- # in `src' if `src_alt' contains any part of the glob hierarchy.
252
- top_dir = glob.split(File::SEPARATOR)[0]
253
- alt_only = top_dir && File.exists?(File.join(@alt_sources_dir, top_dir))
254
-
255
247
  matches = Set.new
256
- # Alternative source dir completely shadows the source dir, there can be
257
- # no partial match of a particular glob in both.
258
- if File.directory?(@alt_sources_dir)
259
- alt_matches = Dir.chdir(@alt_sources_dir) do
260
- resolve_glob_in_cwd(glob)
261
- end
262
- else
263
- alt_matches = []
264
- end
265
248
 
266
- if alt_matches.size > 0
267
- matches += alt_matches.map do |path|
268
- GlobMatch.new(@alt_sources_dir, path)
269
- end
249
+ src_matches = Dir.chdir(@sources_dir) { resolve_glob_in_cwd(glob) }
250
+ src_alt_matches = []
251
+ if File.directory?(@alt_sources_dir)
252
+ src_alt_matches = Dir.chdir(@alt_sources_dir) { resolve_glob_in_cwd(glob) }
270
253
  end
271
254
 
272
- normal_matches = Dir.chdir(@sources_dir) do
273
- resolve_glob_in_cwd(glob)
274
- end
255
+ # Glob like core/dea/**/* might not yield anything in alt source even
256
+ # when `src_alt/core' exists. That's error prone, so we don't lookup
257
+ # in `src' if `src_alt' contains any part of the glob hierarchy.
258
+ top_dir = glob.split(File::SEPARATOR)[0]
259
+ top_dir_in_src_alt_exists = top_dir && File.exists?(File.join(@alt_sources_dir, top_dir))
275
260
 
276
- if alt_only && alt_matches.empty? && !normal_matches.empty?
261
+ if top_dir_in_src_alt_exists && src_alt_matches.empty? && !src_matches.empty?
277
262
  raise InvalidPackage, "Package `#{name}' has a glob that " +
278
263
  "doesn't match in `#{File.basename(@alt_sources_dir)}' " +
279
264
  "but matches in `#{File.basename(@sources_dir)}'. " +
@@ -281,8 +266,12 @@ module Bosh::Cli
281
266
  "exists, so this might be an error."
282
267
  end
283
268
 
284
- matches += normal_matches.map do |path|
285
- GlobMatch.new(@sources_dir, path)
269
+ # First add src_alt matches since src_alt takes priority over src matches
270
+ matches += src_alt_matches.map { |path| GlobMatch.new(@alt_sources_dir, path) }
271
+
272
+ # Only add if top-level-dir does not exist in src_alt. No partial matches.
273
+ if !top_dir_in_src_alt_exists
274
+ matches += src_matches.map { |path| GlobMatch.new(@sources_dir, path) }
286
275
  end
287
276
 
288
277
  # Blobs directory is a little bit different: whatever matches a blob
@@ -291,18 +280,12 @@ module Bosh::Cli
291
280
  if File.directory?(File.join(@blobs_dir))
292
281
  Dir.chdir(@blobs_dir) do
293
282
  blob_matches = resolve_glob_in_cwd(glob)
294
-
295
- unless blob_matches.empty?
296
- blob_matches.each do |path|
297
- matches << GlobMatch.new(@blobs_dir, path)
298
- end
299
- end
283
+ blob_matches.each { |path| matches << GlobMatch.new(@blobs_dir, path) }
300
284
  end
301
285
  end
302
286
 
303
287
  if matches.empty?
304
- raise InvalidPackage, "Package `#{name}' has a glob that " +
305
- "resolves to an empty file list: #{glob}"
288
+ raise InvalidPackage, "Package `#{name}' has a glob that resolves to an empty file list: #{glob}"
306
289
  end
307
290
 
308
291
  all_matches += matches
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bosh
4
4
  module Cli
5
- VERSION = '1.5.0.pre.1525'
5
+ VERSION = '1.5.0.pre.1612'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.pre.1525
4
+ version: 1.5.0.pre.1612
5
5
  prerelease: 6
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: 2013-12-10 00:00:00.000000000 Z
12
+ date: 2013-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bosh_common
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.5.0.pre.1525
21
+ version: 1.5.0.pre.1612
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.5.0.pre.1525
29
+ version: 1.5.0.pre.1612
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: json_pure
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.5.0.pre.1525
117
+ version: 1.5.0.pre.1612
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.5.0.pre.1525
125
+ version: 1.5.0.pre.1612
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: net-ssh
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -253,7 +253,7 @@ dependencies:
253
253
  version: '0'
254
254
  description: ! 'BOSH CLI
255
255
 
256
- df3988'
256
+ a13d7a'
257
257
  email: support@cloudfoundry.com
258
258
  executables:
259
259
  - bosh