omnibus 6.0.30 → 7.0.13
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.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/README.md +24 -8
- data/Rakefile +1 -1
- data/lib/omnibus/build_version_dsl.rb +1 -0
- data/lib/omnibus/builder.rb +6 -5
- data/lib/omnibus/changelog_printer.rb +7 -4
- data/lib/omnibus/cleaner.rb +3 -0
- data/lib/omnibus/cli.rb +1 -1
- data/lib/omnibus/cli/changelog.rb +24 -24
- data/lib/omnibus/cli/publish.rb +5 -5
- data/lib/omnibus/compressor.rb +2 -2
- data/lib/omnibus/compressors/base.rb +1 -1
- data/lib/omnibus/compressors/dmg.rb +45 -7
- data/lib/omnibus/config.rb +12 -2
- data/lib/omnibus/fetchers/git_fetcher.rb +1 -0
- data/lib/omnibus/fetchers/net_fetcher.rb +2 -3
- data/lib/omnibus/file_syncer.rb +2 -2
- data/lib/omnibus/generator_files/README.md.erb +18 -15
- data/lib/omnibus/generator_files/config/software/preparation.rb.erb +1 -1
- data/lib/omnibus/generator_files/omnibus.rb.erb +5 -4
- data/lib/omnibus/health_check.rb +1 -1
- data/lib/omnibus/licensing.rb +3 -4
- data/lib/omnibus/logger.rb +2 -1
- data/lib/omnibus/manifest.rb +1 -1
- data/lib/omnibus/metadata.rb +2 -2
- data/lib/omnibus/packagers/appx.rb +1 -2
- data/lib/omnibus/packagers/base.rb +1 -0
- data/lib/omnibus/packagers/bff.rb +6 -8
- data/lib/omnibus/packagers/deb.rb +7 -10
- data/lib/omnibus/packagers/ips.rb +3 -6
- data/lib/omnibus/packagers/makeself.rb +1 -2
- data/lib/omnibus/packagers/msi.rb +12 -11
- data/lib/omnibus/packagers/pkg.rb +125 -9
- data/lib/omnibus/packagers/rpm.rb +11 -12
- data/lib/omnibus/packagers/solaris.rb +4 -4
- data/lib/omnibus/packagers/windows_base.rb +7 -6
- data/lib/omnibus/project.rb +1 -0
- data/lib/omnibus/publisher.rb +14 -12
- data/lib/omnibus/publishers/s3_publisher.rb +6 -4
- data/lib/omnibus/s3_cache.rb +3 -1
- data/lib/omnibus/s3_helpers.rb +6 -6
- data/lib/omnibus/software.rb +66 -30
- data/lib/omnibus/templating.rb +1 -1
- data/lib/omnibus/util.rb +3 -2
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus/whitelist.rb +6 -1
- data/omnibus.gemspec +6 -6
- data/resources/rpm/signing.erb +7 -10
- data/spec/functional/builder_spec.rb +2 -1
- data/spec/functional/fetchers/file_fetcher_spec.rb +4 -4
- data/spec/functional/fetchers/git_fetcher_spec.rb +4 -4
- data/spec/functional/fetchers/net_fetcher_spec.rb +5 -6
- data/spec/functional/fetchers/path_fetcher_spec.rb +4 -4
- data/spec/functional/file_syncer_spec.rb +42 -0
- data/spec/functional/licensing_spec.rb +5 -5
- data/spec/support/examples.rb +3 -4
- data/spec/unit/builder_spec.rb +9 -9
- data/spec/unit/changelogprinter_spec.rb +8 -6
- data/spec/unit/compressor_spec.rb +3 -3
- data/spec/unit/compressors/dmg_spec.rb +43 -4
- data/spec/unit/fetchers/net_fetcher_spec.rb +16 -17
- data/spec/unit/health_check_spec.rb +2 -6
- data/spec/unit/library_spec.rb +2 -1
- data/spec/unit/manifest_diff_spec.rb +2 -2
- data/spec/unit/manifest_spec.rb +1 -1
- data/spec/unit/metadata_spec.rb +9 -11
- data/spec/unit/omnibus_spec.rb +1 -1
- data/spec/unit/packagers/bff_spec.rb +2 -2
- data/spec/unit/packagers/msi_spec.rb +2 -2
- data/spec/unit/packagers/pkg_spec.rb +354 -0
- data/spec/unit/packagers/pkgsrc_spec.rb +1 -1
- data/spec/unit/packagers/solaris_spec.rb +7 -7
- data/spec/unit/project_spec.rb +2 -2
- data/spec/unit/publisher_spec.rb +8 -9
- data/spec/unit/publishers/artifactory_publisher_spec.rb +2 -4
- data/spec/unit/publishers/s3_publisher_spec.rb +2 -4
- data/spec/unit/s3_cacher_spec.rb +19 -6
- data/spec/unit/s3_helpers_spec.rb +22 -3
- data/spec/unit/software_spec.rb +72 -42
- data/spec/unit/util_spec.rb +1 -2
- metadata +17 -11
data/lib/omnibus/software.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2012-
|
2
|
+
# Copyright 2012-2018, Chef Software Inc.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -205,6 +205,46 @@ module Omnibus
|
|
205
205
|
end
|
206
206
|
expose :maintainer
|
207
207
|
|
208
|
+
#
|
209
|
+
# Sets the bin_dirs where this software installs bins.
|
210
|
+
#
|
211
|
+
# @example
|
212
|
+
# bin_dirs ['/opt/chef-workstation/bin']
|
213
|
+
#
|
214
|
+
# @param [Array<String>] val
|
215
|
+
# the bin_dirs of the software
|
216
|
+
#
|
217
|
+
# @return [Array<String>]
|
218
|
+
#
|
219
|
+
def bin_dirs(val = NULL)
|
220
|
+
if null?(val)
|
221
|
+
@bin_dirs || [windows_safe_path("#{install_dir}/bin"), windows_safe_path("#{install_dir}/embedded/bin")]
|
222
|
+
else
|
223
|
+
@bin_dirs = val
|
224
|
+
end
|
225
|
+
end
|
226
|
+
expose :bin_dirs
|
227
|
+
|
228
|
+
#
|
229
|
+
# Sets the lib_dirs where this software installs libs.
|
230
|
+
#
|
231
|
+
# @example
|
232
|
+
# lib_dirs ['/opt/chef-workstation/bin']
|
233
|
+
#
|
234
|
+
# @param [Array<String>] val
|
235
|
+
# the lib_dirs of the software
|
236
|
+
#
|
237
|
+
# @return [Array<String>]
|
238
|
+
#
|
239
|
+
def lib_dirs(val = NULL)
|
240
|
+
if null?(val)
|
241
|
+
@lib_dirs || [windows_safe_path("#{install_dir}/embedded/lib")]
|
242
|
+
else
|
243
|
+
@lib_dirs = val
|
244
|
+
end
|
245
|
+
end
|
246
|
+
expose :lib_dirs
|
247
|
+
|
208
248
|
#
|
209
249
|
# Add a software dependency to this software.
|
210
250
|
#
|
@@ -305,7 +345,7 @@ module Omnibus
|
|
305
345
|
"only include valid keys. Invalid keys: #{extra_keys.inspect}")
|
306
346
|
end
|
307
347
|
|
308
|
-
duplicate_keys = val.keys &
|
348
|
+
duplicate_keys = val.keys & %i{git file path url}
|
309
349
|
unless duplicate_keys.size < 2
|
310
350
|
raise InvalidValue.new(:source,
|
311
351
|
"not include duplicate keys. Duplicate keys: #{duplicate_keys.inspect}")
|
@@ -509,7 +549,7 @@ module Omnibus
|
|
509
549
|
# the list of currently whitelisted files
|
510
550
|
#
|
511
551
|
def whitelist_file(file)
|
512
|
-
file = Regexp.new(file) unless file.
|
552
|
+
file = Regexp.new(file) unless file.is_a?(Regexp)
|
513
553
|
whitelist_files << file
|
514
554
|
whitelist_files.dup
|
515
555
|
end
|
@@ -668,33 +708,22 @@ module Omnibus
|
|
668
708
|
"ARFLAGS" => "-X64 cru",
|
669
709
|
}
|
670
710
|
when "solaris2"
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
"LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
|
677
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -O2",
|
678
|
-
}
|
679
|
-
elsif platform_version.satisfies?(">= 5.11")
|
680
|
-
solaris_flags = {
|
681
|
-
"CC" => "gcc -m64 -static-libgcc",
|
682
|
-
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
|
683
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -O2",
|
684
|
-
}
|
685
|
-
end
|
686
|
-
solaris_flags
|
711
|
+
{
|
712
|
+
"CC" => "gcc -m64 -static-libgcc",
|
713
|
+
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
|
714
|
+
"CFLAGS" => "-I#{install_dir}/embedded/include -O2",
|
715
|
+
}
|
687
716
|
when "freebsd"
|
688
717
|
{
|
689
718
|
"CC" => "clang",
|
690
719
|
"CXX" => "clang++",
|
691
720
|
"LDFLAGS" => "-L#{install_dir}/embedded/lib",
|
692
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -O2",
|
721
|
+
"CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
693
722
|
}
|
694
723
|
when "suse"
|
695
724
|
suse_flags = {
|
696
725
|
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
|
697
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -O2",
|
726
|
+
"CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
698
727
|
}
|
699
728
|
# Enable gcc version 4.8 if it is available
|
700
729
|
if which("gcc-4.8") && platform_version.satisfies?("< 12")
|
@@ -721,7 +750,7 @@ module Omnibus
|
|
721
750
|
else
|
722
751
|
{
|
723
752
|
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
|
724
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -O2",
|
753
|
+
"CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
725
754
|
}
|
726
755
|
end
|
727
756
|
|
@@ -987,17 +1016,18 @@ module Omnibus
|
|
987
1016
|
fetcher.version_guid
|
988
1017
|
end
|
989
1018
|
|
1019
|
+
# This is the real version if one exists (nil if there's no real version)
|
1020
|
+
def real_version
|
1021
|
+
@real_version ||= fetcher.version_for_cache || version
|
1022
|
+
end
|
1023
|
+
|
990
1024
|
# Returns the version to be used in cache.
|
991
1025
|
def version_for_cache
|
992
|
-
@version_for_cache ||= if
|
993
|
-
|
994
|
-
elsif version
|
995
|
-
version
|
1026
|
+
@version_for_cache ||= if real_version
|
1027
|
+
real_version
|
996
1028
|
else
|
997
1029
|
log.warn(log_key) do
|
998
|
-
"No version given!
|
999
|
-
"assume the version `0.0.0', but that is most certainly not your " \
|
1000
|
-
"desired behavior. If git caching seems off, this is probably why."
|
1030
|
+
"No version given! Git caching disabled." \
|
1001
1031
|
end
|
1002
1032
|
|
1003
1033
|
"0.0.0"
|
@@ -1070,7 +1100,13 @@ module Omnibus
|
|
1070
1100
|
#
|
1071
1101
|
def build_me(build_wrappers = [])
|
1072
1102
|
if Config.use_git_caching
|
1073
|
-
if
|
1103
|
+
if !real_version
|
1104
|
+
log.info(log_key) do
|
1105
|
+
"Forcing a build because resolved version is nil"
|
1106
|
+
end
|
1107
|
+
execute_build(build_wrappers)
|
1108
|
+
project.dirty!(self) unless project.dirty? # omnibus can only be mildly dirty
|
1109
|
+
elsif project.dirty?
|
1074
1110
|
log.info(log_key) do
|
1075
1111
|
"Building because `#{project.culprit.name}' dirtied the cache"
|
1076
1112
|
end
|
data/lib/omnibus/templating.rb
CHANGED
@@ -73,7 +73,7 @@ module Omnibus
|
|
73
73
|
|
74
74
|
unless options.empty?
|
75
75
|
raise ArgumentError,
|
76
|
-
"Unknown option(s): #{options.keys.map(&:inspect).join(
|
76
|
+
"Unknown option(s): #{options.keys.map(&:inspect).join(", ")}"
|
77
77
|
end
|
78
78
|
|
79
79
|
# String value returned from #render_template_content
|
data/lib/omnibus/util.rb
CHANGED
@@ -80,7 +80,7 @@ module Omnibus
|
|
80
80
|
# populated with results of the command.
|
81
81
|
#
|
82
82
|
def shellout(*args)
|
83
|
-
options = args.last.
|
83
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
84
84
|
options = SHELLOUT_OPTIONS.merge(options)
|
85
85
|
|
86
86
|
command_string = args.join(" ")
|
@@ -158,6 +158,7 @@ module Omnibus
|
|
158
158
|
yield
|
159
159
|
rescue Exception => e
|
160
160
|
raise e unless retried_exceptions.any? { |eclass| e.is_a?(eclass) }
|
161
|
+
|
161
162
|
if retries != 0
|
162
163
|
log.info(log_key) { "Retrying failed #{logstr} due to #{e} (#{retries} retries left)..." }
|
163
164
|
retries -= 1
|
@@ -196,7 +197,7 @@ module Omnibus
|
|
196
197
|
#
|
197
198
|
def compiler_safe_path(*pieces)
|
198
199
|
path = File.join(*pieces)
|
199
|
-
path = path.sub(
|
200
|
+
path = path.sub(%r{^([A-Za-z]):/}, "/\\1/") if ENV["MSYSTEM"]
|
200
201
|
path
|
201
202
|
end
|
202
203
|
|
data/lib/omnibus/version.rb
CHANGED
data/lib/omnibus/whitelist.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
# Copyright 2012-
|
2
|
+
# Copyright 2012-2020, Chef Software Inc.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
WHITELIST_LIBS = [
|
18
18
|
/ld-linux/,
|
19
|
+
/libanl\.so/,
|
19
20
|
/libc\.so/,
|
20
21
|
/libcrypt\.so/,
|
21
22
|
/libdl/,
|
@@ -33,6 +34,7 @@ WHITELIST_LIBS = [
|
|
33
34
|
].freeze
|
34
35
|
|
35
36
|
ARCH_WHITELIST_LIBS = [
|
37
|
+
/libanl\.so/,
|
36
38
|
/libc\.so/,
|
37
39
|
/libcrypt\.so/,
|
38
40
|
/libdb-5\.3\.so/,
|
@@ -133,8 +135,11 @@ MAC_WHITELIST_LIBS = [
|
|
133
135
|
/libffi\.dylib/,
|
134
136
|
/libncurses\.5\.4\.dylib/,
|
135
137
|
/libiconv/,
|
138
|
+
/libidn2\.0\.dylib/,
|
136
139
|
/libstdc\+\+\.6\.dylib/,
|
137
140
|
/libc\+\+\.1\.dylib/,
|
141
|
+
/libc\+\+\.1\.dylib/,
|
142
|
+
/libzstd\.1\.dylib/,
|
138
143
|
/Security/,
|
139
144
|
].freeze
|
140
145
|
|
data/omnibus.gemspec
CHANGED
@@ -18,25 +18,25 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.files = %w{ LICENSE README.md Rakefile Gemfile } + Dir.glob("*.gemspec") + Dir.glob("{bin,lib,resources,spec}/**/{*,.kitchen*}")
|
19
19
|
gem.bindir = "bin"
|
20
20
|
gem.executables = %w{omnibus}
|
21
|
-
gem.test_files = gem.files.grep(
|
21
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
24
24
|
gem.add_dependency "aws-sdk-s3", "~> 1"
|
25
25
|
gem.add_dependency "chef-sugar", ">= 3.3"
|
26
|
-
gem.add_dependency "cleanroom",
|
26
|
+
gem.add_dependency "chef-cleanroom", "~> 1.0"
|
27
27
|
gem.add_dependency "ffi-yajl", "~> 2.2"
|
28
28
|
gem.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
|
29
|
-
gem.add_dependency "ohai", ">= 13", "<
|
29
|
+
gem.add_dependency "ohai", ">= 13", "< 17"
|
30
30
|
gem.add_dependency "ruby-progressbar", "~> 1.7"
|
31
|
-
gem.add_dependency "thor", "
|
31
|
+
gem.add_dependency "thor", ">= 0.18", "< 2.0"
|
32
32
|
gem.add_dependency "license_scout", "~> 1.0"
|
33
33
|
|
34
34
|
gem.add_dependency "mixlib-versioning"
|
35
35
|
gem.add_dependency "pedump"
|
36
36
|
|
37
|
-
gem.add_development_dependency "artifactory", "~>
|
37
|
+
gem.add_development_dependency "artifactory", "~> 3.0"
|
38
38
|
gem.add_development_dependency "aruba", "~> 0.5"
|
39
|
-
gem.add_development_dependency "chefstyle", "= 0
|
39
|
+
gem.add_development_dependency "chefstyle", "= 1.1.0"
|
40
40
|
gem.add_development_dependency "fauxhai", ">= 5.2"
|
41
41
|
gem.add_development_dependency "rspec", "~> 3.0"
|
42
42
|
gem.add_development_dependency "rspec-json_expectations"
|
data/resources/rpm/signing.erb
CHANGED
@@ -11,25 +11,22 @@ require 'pty'
|
|
11
11
|
|
12
12
|
puts rpm_cmd
|
13
13
|
PTY.spawn(rpm_cmd) do |r, w, pid|
|
14
|
+
# Older versions of rpmsign will prompt right away for the passphrase
|
14
15
|
prompt = r.read(19)
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
STDERR.puts "unexpected output from `#{rpm_cmd}`: '#{prompt}'"
|
20
|
-
Process.kill(:KILL, pid)
|
21
|
-
exit 1
|
17
|
+
if prompt == 'Enter pass phrase: '
|
18
|
+
STDOUT.puts prompt
|
19
|
+
w.write("#{password}\n")
|
22
20
|
end
|
23
21
|
|
24
|
-
STDOUT.puts prompt
|
25
|
-
w.write("#{password}\n")
|
26
|
-
|
27
22
|
# Keep printing output unti the command exits
|
28
23
|
loop do
|
29
24
|
begin
|
30
25
|
line = r.gets
|
31
26
|
puts line
|
32
|
-
if
|
27
|
+
if line =~ /Please enter the passphrase to unlock the OpenPGP secret key:/
|
28
|
+
w.write("#{password}\n")
|
29
|
+
elsif (line =~ /failed/) && !(line =~ /warning:/)
|
33
30
|
STDERR.puts 'RPM signing failure'
|
34
31
|
exit 1
|
35
32
|
end
|
@@ -22,6 +22,7 @@ module Omnibus
|
|
22
22
|
ext = name == "ruby" ? ".exe" : ".bat"
|
23
23
|
source = Bundler.which(name + ext)
|
24
24
|
raise "Could not find #{name} in bundler environment" unless source
|
25
|
+
|
25
26
|
File.open(File.join(embedded_bin_dir, name + ".bat"), "w") do |f|
|
26
27
|
f.write <<-EOH.gsub(/^ {12}/, "")
|
27
28
|
@"#{source}" %*
|
@@ -221,7 +222,7 @@ module Omnibus
|
|
221
222
|
output = capture_logging { subject.build }
|
222
223
|
|
223
224
|
appbundler_path = File.join(embedded_bin_dir, "appbundler")
|
224
|
-
appbundler_path.gsub!(
|
225
|
+
appbundler_path.gsub!(%r{/}, '\\') if windows?
|
225
226
|
expect(output).to include("#{appbundler_path} '#{project_dir}' '#{bin_dir}'")
|
226
227
|
end
|
227
228
|
end
|
@@ -13,10 +13,10 @@ module Omnibus
|
|
13
13
|
|
14
14
|
let(:manifest_entry) do
|
15
15
|
double(Omnibus::ManifestEntry,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
name: "pathelogical",
|
17
|
+
locked_version: nil,
|
18
|
+
described_version: nil,
|
19
|
+
locked_source: source)
|
20
20
|
end
|
21
21
|
|
22
22
|
subject { described_class.new(manifest_entry, project_dir, build_dir) }
|
@@ -110,10 +110,10 @@ module Omnibus
|
|
110
110
|
let(:remote) { remote_git_repo("zlib", annotated_tags: [version]) }
|
111
111
|
let(:manifest_entry) do
|
112
112
|
double(ManifestEntry,
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
name: "software",
|
114
|
+
locked_version: "efde208366abd0f91419d8a54b45e3f6e0540105",
|
115
|
+
described_version: version,
|
116
|
+
locked_source: source)
|
117
117
|
end
|
118
118
|
|
119
119
|
subject { described_class.new(manifest_entry, project_dir, build_dir) }
|
@@ -4,8 +4,7 @@ module Omnibus
|
|
4
4
|
module RSpec
|
5
5
|
module OhaiHelpers
|
6
6
|
# Turn off the mandatory Ohai helper.
|
7
|
-
def stub_ohai(options = {}, &block)
|
8
|
-
end
|
7
|
+
def stub_ohai(options = {}, &block); end
|
9
8
|
end
|
10
9
|
end
|
11
10
|
|
@@ -29,10 +28,10 @@ module Omnibus
|
|
29
28
|
|
30
29
|
let(:manifest_entry) do
|
31
30
|
double(ManifestEntry,
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
name: "software",
|
32
|
+
locked_version: "1.2.8",
|
33
|
+
described_version: "1.2.8",
|
34
|
+
locked_source: source)
|
36
35
|
end
|
37
36
|
|
38
37
|
subject { described_class.new(manifest_entry, project_dir, build_dir) }
|
@@ -12,10 +12,10 @@ module Omnibus
|
|
12
12
|
|
13
13
|
let(:manifest_entry) do
|
14
14
|
double(Omnibus::ManifestEntry,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
name: "pathelogical",
|
16
|
+
locked_version: nil,
|
17
|
+
described_version: nil,
|
18
|
+
locked_source: source)
|
19
19
|
end
|
20
20
|
|
21
21
|
before do
|
@@ -56,6 +56,14 @@ module Omnibus
|
|
56
56
|
FileUtils.touch(File.join(source, ".dot_folder", "file_f"))
|
57
57
|
|
58
58
|
FileUtils.touch(File.join(source, ".file_g"))
|
59
|
+
|
60
|
+
FileUtils.mkdir_p(File.join(source, "nested", "deep", "folder"))
|
61
|
+
FileUtils.touch(File.join(source, "nested", "deep", "folder", "file_h"))
|
62
|
+
FileUtils.touch(File.join(source, "nested", "deep", "folder", "file_i"))
|
63
|
+
|
64
|
+
FileUtils.mkdir_p(File.join(source, "nested", "deep", "deep", "folder"))
|
65
|
+
FileUtils.touch(File.join(source, "nested", "deep", "deep", "folder", "file_j"))
|
66
|
+
FileUtils.touch(File.join(source, "nested", "deep", "deep", "folder", "file_k"))
|
59
67
|
source
|
60
68
|
end
|
61
69
|
|
@@ -233,6 +241,40 @@ module Omnibus
|
|
233
241
|
expect("#{destination}/.file_g").to be_a_file
|
234
242
|
end
|
235
243
|
|
244
|
+
it "does not copy files and folders that match the wildcard pattern" do
|
245
|
+
described_class.sync(source, destination, exclude: "nested/*/folder")
|
246
|
+
|
247
|
+
expect("#{destination}/file_a").to be_a_file
|
248
|
+
expect("#{destination}/file_b").to be_a_file
|
249
|
+
expect("#{destination}/file_c").to be_a_file
|
250
|
+
expect("#{destination}/folder/file_d").to be_a_file
|
251
|
+
expect("#{destination}/folder/file_e").to be_a_file
|
252
|
+
expect("#{destination}/.dot_folder").to be_a_directory
|
253
|
+
expect("#{destination}/.dot_folder/file_f").to be_a_file
|
254
|
+
expect("#{destination}/.file_g").to be_a_file
|
255
|
+
expect("#{destination}/nested/deep/folder/file_h").to_not be_a_file
|
256
|
+
expect("#{destination}/nested/deep/folder/file_i").to_not be_a_file
|
257
|
+
expect("#{destination}/nested/deep/deep/folder/file_j").to be_a_file
|
258
|
+
expect("#{destination}/nested/deep/deep/folder/file_k").to be_a_file
|
259
|
+
end
|
260
|
+
|
261
|
+
it "does not copy files and folders that match the super wildcard pattern" do
|
262
|
+
described_class.sync(source, destination, exclude: "nested/**/folder")
|
263
|
+
|
264
|
+
expect("#{destination}/file_a").to be_a_file
|
265
|
+
expect("#{destination}/file_b").to be_a_file
|
266
|
+
expect("#{destination}/file_c").to be_a_file
|
267
|
+
expect("#{destination}/folder/file_d").to be_a_file
|
268
|
+
expect("#{destination}/folder/file_e").to be_a_file
|
269
|
+
expect("#{destination}/.dot_folder").to be_a_directory
|
270
|
+
expect("#{destination}/.dot_folder/file_f").to be_a_file
|
271
|
+
expect("#{destination}/.file_g").to be_a_file
|
272
|
+
expect("#{destination}/nested/deep/folder/file_h").to_not be_a_file
|
273
|
+
expect("#{destination}/nested/deep/folder/file_i").to_not be_a_file
|
274
|
+
expect("#{destination}/nested/deep/deep/folder/file_j").to_not be_a_file
|
275
|
+
expect("#{destination}/nested/deep/deep/folder/file_k").to_not be_a_file
|
276
|
+
end
|
277
|
+
|
236
278
|
it "removes existing files and folders in destination" do
|
237
279
|
FileUtils.mkdir_p("#{destination}/existing_folder")
|
238
280
|
FileUtils.touch("#{destination}/existing_file")
|