berkshelf 5.5.0 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -3
- data/Gemfile +31 -31
- data/Gemfile.lock +3 -3
- data/Guardfile +13 -13
- data/Rakefile +1 -0
- data/Thorfile +16 -16
- data/berkshelf.gemspec +35 -35
- data/features/step_definitions/chef/config_steps.rb +4 -4
- data/features/step_definitions/chef_server_steps.rb +6 -6
- data/features/step_definitions/cli_steps.rb +3 -3
- data/features/step_definitions/config_steps.rb +5 -5
- data/features/step_definitions/filesystem_steps.rb +12 -11
- data/features/support/env.rb +21 -21
- data/lib/berkshelf.rb +66 -66
- data/lib/berkshelf/base_generator.rb +10 -11
- data/lib/berkshelf/berksfile.rb +38 -38
- data/lib/berkshelf/cached_cookbook.rb +7 -7
- data/lib/berkshelf/cli.rb +126 -126
- data/lib/berkshelf/commands/shelf.rb +19 -18
- data/lib/berkshelf/commands/test_command.rb +2 -2
- data/lib/berkshelf/community_rest.rb +38 -38
- data/lib/berkshelf/config.rb +42 -41
- data/lib/berkshelf/cookbook_generator.rb +38 -38
- data/lib/berkshelf/cookbook_store.rb +4 -4
- data/lib/berkshelf/core_ext/file_utils.rb +1 -1
- data/lib/berkshelf/dependency.rb +23 -21
- data/lib/berkshelf/downloader.rb +24 -25
- data/lib/berkshelf/errors.rb +17 -17
- data/lib/berkshelf/file_syncer.rb +9 -8
- data/lib/berkshelf/formatters/human.rb +3 -3
- data/lib/berkshelf/formatters/json.rb +2 -2
- data/lib/berkshelf/init_generator.rb +64 -64
- data/lib/berkshelf/installer.rb +103 -102
- data/lib/berkshelf/location.rb +9 -9
- data/lib/berkshelf/locations/git.rb +16 -16
- data/lib/berkshelf/locations/github.rb +1 -1
- data/lib/berkshelf/locations/path.rb +2 -2
- data/lib/berkshelf/lockfile.rb +309 -315
- data/lib/berkshelf/mixin/git.rb +3 -3
- data/lib/berkshelf/packager.rb +4 -4
- data/lib/berkshelf/resolver.rb +2 -2
- data/lib/berkshelf/resolver/graph.rb +1 -1
- data/lib/berkshelf/shell.rb +1 -1
- data/lib/berkshelf/source.rb +6 -6
- data/lib/berkshelf/source_uri.rb +2 -2
- data/lib/berkshelf/ssl_policies.rb +3 -3
- data/lib/berkshelf/thor.rb +1 -1
- data/lib/berkshelf/uploader.rb +48 -48
- data/lib/berkshelf/validator.rb +2 -2
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +11 -11
- data/spec/config/knife.rb +2 -2
- data/spec/fixtures/Berksfile +3 -3
- data/spec/fixtures/cookbook-path/jenkins-config/metadata.rb +3 -3
- data/spec/fixtures/cookbook-store/jenkins-2.0.3/metadata.rb +5 -5
- data/spec/fixtures/cookbook-store/jenkins-2.0.4/metadata.rb +4 -4
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -3
- data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
- data/spec/spec_helper.rb +9 -9
- data/spec/support/chef_api.rb +11 -12
- data/spec/support/chef_server.rb +10 -10
- data/spec/support/git.rb +23 -23
- data/spec/support/kitchen.rb +2 -2
- data/spec/support/matchers/filepath_matchers.rb +2 -2
- data/spec/support/path_helpers.rb +12 -12
- data/spec/support/shared_examples/formatter.rb +1 -1
- data/spec/unit/berkshelf/berksfile_spec.rb +78 -78
- data/spec/unit/berkshelf/cached_cookbook_spec.rb +42 -42
- data/spec/unit/berkshelf/cli_spec.rb +6 -6
- data/spec/unit/berkshelf/community_rest_spec.rb +83 -83
- data/spec/unit/berkshelf/config_spec.rb +13 -13
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +39 -39
- data/spec/unit/berkshelf/cookbook_store_spec.rb +41 -41
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +5 -6
- data/spec/unit/berkshelf/core_ext/pathname_spec.rb +1 -1
- data/spec/unit/berkshelf/dependency_spec.rb +43 -43
- data/spec/unit/berkshelf/downloader_spec.rb +20 -20
- data/spec/unit/berkshelf/errors_spec.rb +3 -3
- data/spec/unit/berkshelf/file_syncer_spec.rb +86 -86
- data/spec/unit/berkshelf/formatters/base_spec.rb +23 -23
- data/spec/unit/berkshelf/formatters/human_spec.rb +2 -2
- data/spec/unit/berkshelf/formatters/json_spec.rb +2 -2
- data/spec/unit/berkshelf/formatters/null_spec.rb +3 -3
- data/spec/unit/berkshelf/init_generator_spec.rb +92 -92
- data/spec/unit/berkshelf/installer_spec.rb +8 -8
- data/spec/unit/berkshelf/location_spec.rb +11 -11
- data/spec/unit/berkshelf/locations/base_spec.rb +35 -35
- data/spec/unit/berkshelf/locations/git_spec.rb +87 -87
- data/spec/unit/berkshelf/locations/path_spec.rb +40 -40
- data/spec/unit/berkshelf/lockfile_parser_spec.rb +71 -71
- data/spec/unit/berkshelf/lockfile_spec.rb +197 -197
- data/spec/unit/berkshelf/logger_spec.rb +3 -3
- data/spec/unit/berkshelf/mixin/logging_spec.rb +5 -5
- data/spec/unit/berkshelf/packager_spec.rb +2 -2
- data/spec/unit/berkshelf/resolver/graph_spec.rb +1 -1
- data/spec/unit/berkshelf/resolver_spec.rb +17 -17
- data/spec/unit/berkshelf/shell_spec.rb +34 -34
- data/spec/unit/berkshelf/source_spec.rb +12 -11
- data/spec/unit/berkshelf/source_uri_spec.rb +1 -1
- data/spec/unit/berkshelf/ssl_policies_spec.rb +25 -25
- data/spec/unit/berkshelf/uploader_spec.rb +54 -54
- data/spec/unit/berkshelf/validator_spec.rb +16 -16
- data/spec/unit/berkshelf/visualizer_spec.rb +17 -17
- data/spec/unit/berkshelf_spec.rb +18 -18
- metadata +5 -5
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Berkshelf
|
4
4
|
describe Downloader do
|
5
5
|
let(:berksfile) do
|
6
6
|
double(Berksfile,
|
7
7
|
lockfile: lockfile,
|
8
|
-
dependencies: []
|
8
|
+
dependencies: []
|
9
9
|
)
|
10
10
|
end
|
11
11
|
|
@@ -16,7 +16,7 @@ module Berkshelf
|
|
16
16
|
end
|
17
17
|
|
18
18
|
let(:graph) { double(Lockfile::Graph, locks: {}) }
|
19
|
-
let(:self_signed_crt_path) { File.join(BERKS_SPEC_DATA,
|
19
|
+
let(:self_signed_crt_path) { File.join(BERKS_SPEC_DATA, "trusted_certs") }
|
20
20
|
let(:self_signed_crt) { OpenSSL::X509::Certificate.new(IO.read("#{self_signed_crt_path}/example.crt")) }
|
21
21
|
let(:cert_store) { OpenSSL::X509::Store.new.add_cert(self_signed_crt) }
|
22
22
|
let(:ssl_policy) { double(SSLPolicy, store: cert_store) }
|
@@ -28,9 +28,9 @@ module Berkshelf
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "#try_download" do
|
31
|
-
let(:remote_cookbook) { double(
|
31
|
+
let(:remote_cookbook) { double("remote-cookbook") }
|
32
32
|
let(:source) do
|
33
|
-
source = double(
|
33
|
+
source = double("source")
|
34
34
|
allow(source).to receive(:cookbook) { remote_cookbook }
|
35
35
|
source
|
36
36
|
end
|
@@ -40,7 +40,7 @@ module Berkshelf
|
|
40
40
|
it "supports the 'opscode' location type" do
|
41
41
|
allow(remote_cookbook).to receive(:location_type) { :opscode }
|
42
42
|
allow(remote_cookbook).to receive(:location_path) { "http://api.opscode.com" }
|
43
|
-
rest = double(
|
43
|
+
rest = double("community-rest")
|
44
44
|
expect(CommunityREST).to receive(:new).with("http://api.opscode.com") { rest }
|
45
45
|
expect(rest).to receive(:download).with(name, version)
|
46
46
|
subject.try_download(source, name, version)
|
@@ -49,32 +49,32 @@ module Berkshelf
|
|
49
49
|
it "supports the 'supermarket' location type" do
|
50
50
|
allow(remote_cookbook).to receive(:location_type) { :supermarket }
|
51
51
|
allow(remote_cookbook).to receive(:location_path) { "http://api.supermarket.com" }
|
52
|
-
rest = double(
|
52
|
+
rest = double("community-rest")
|
53
53
|
expect(CommunityREST).to receive(:new).with("http://api.supermarket.com") { rest }
|
54
54
|
expect(rest).to receive(:download).with(name, version)
|
55
55
|
subject.try_download(source, name, version)
|
56
56
|
end
|
57
57
|
|
58
|
-
describe
|
59
|
-
let(:chef_server_url) {
|
58
|
+
describe "chef_server location type" do
|
59
|
+
let(:chef_server_url) { "http://configured-chef-server/" }
|
60
60
|
let(:ridley_client) do
|
61
61
|
double(Ridley::Client,
|
62
|
-
cookbook: double(
|
62
|
+
cookbook: double("cookbook", download: "fake")
|
63
63
|
)
|
64
64
|
end
|
65
65
|
let(:chef_config) do
|
66
66
|
double(Ridley::Chef::Config,
|
67
|
-
node_name:
|
68
|
-
client_key:
|
67
|
+
node_name: "fake-client",
|
68
|
+
client_key: "client-key",
|
69
69
|
chef_server_url: chef_server_url,
|
70
|
-
validation_client_name:
|
71
|
-
validation_key:
|
72
|
-
cookbook_copyright:
|
73
|
-
cookbook_email:
|
74
|
-
cookbook_license:
|
70
|
+
validation_client_name: "validator",
|
71
|
+
validation_key: "validator.pem",
|
72
|
+
cookbook_copyright: "user",
|
73
|
+
cookbook_email: "user@example.com",
|
74
|
+
cookbook_license: "apachev2",
|
75
75
|
trusted_certs_dir: self_signed_crt_path,
|
76
76
|
knife: {
|
77
|
-
chef_guard: false
|
77
|
+
chef_guard: false,
|
78
78
|
}
|
79
79
|
)
|
80
80
|
end
|
@@ -100,8 +100,8 @@ module Berkshelf
|
|
100
100
|
client_key: chef_config.client_key,
|
101
101
|
ssl: {
|
102
102
|
verify: berkshelf_config.ssl.verify,
|
103
|
-
cert_store: cert_store
|
104
|
-
}
|
103
|
+
cert_store: cert_store,
|
104
|
+
},
|
105
105
|
}
|
106
106
|
expect(Ridley).to receive(:open).with(credentials) { ridley_client }
|
107
107
|
subject.try_download(source, name, version)
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Berkshelf::BerkshelfError do
|
4
4
|
skip
|
5
5
|
end
|
6
6
|
|
7
7
|
describe Berkshelf::CommunitySiteError do
|
8
|
-
let(:api_uri) {
|
9
|
-
let(:message) {
|
8
|
+
let(:api_uri) { "https://infra.as.code" }
|
9
|
+
let(:message) { "Cookbook name" }
|
10
10
|
|
11
11
|
subject { described_class.new(api_uri, message) }
|
12
12
|
|
@@ -1,107 +1,107 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Berkshelf
|
4
4
|
describe FileSyncer do
|
5
|
-
describe
|
5
|
+
describe "#glob" do
|
6
6
|
before do
|
7
|
-
FileUtils.mkdir_p(File.join(tmp_path,
|
8
|
-
FileUtils.mkdir_p(File.join(tmp_path,
|
7
|
+
FileUtils.mkdir_p(File.join(tmp_path, "folder"))
|
8
|
+
FileUtils.mkdir_p(File.join(tmp_path, ".hidden_folder"))
|
9
9
|
|
10
|
-
FileUtils.touch(File.join(tmp_path,
|
11
|
-
FileUtils.touch(File.join(tmp_path,
|
10
|
+
FileUtils.touch(File.join(tmp_path, "folder", "file"))
|
11
|
+
FileUtils.touch(File.join(tmp_path, ".hidden_file"))
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:list) do
|
15
15
|
described_class
|
16
16
|
.glob("#{tmp_path}/**/*")
|
17
|
-
.map { |item| item.sub("#{tmp_path}/",
|
17
|
+
.map { |item| item.sub("#{tmp_path}/", "") }
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
21
|
-
expect(list).to include(
|
22
|
-
expect(list).to include(
|
20
|
+
it "includes regular files" do
|
21
|
+
expect(list).to include("folder")
|
22
|
+
expect(list).to include("folder/file")
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
26
|
-
expect(list).to_not include(
|
25
|
+
it "ignores ." do
|
26
|
+
expect(list).to_not include(".")
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
30
|
-
expect(list).to_not include(
|
29
|
+
it "ignores .." do
|
30
|
+
expect(list).to_not include("..")
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
34
|
-
expect(list).to include(
|
33
|
+
it "includes hidden files" do
|
34
|
+
expect(list).to include(".hidden_file")
|
35
35
|
end
|
36
36
|
|
37
|
-
it
|
38
|
-
expect(list).to include(
|
37
|
+
it "includes hidden folders" do
|
38
|
+
expect(list).to include(".hidden_folder")
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
describe
|
42
|
+
describe "#sync" do
|
43
43
|
let(:source) do
|
44
|
-
source = File.join(tmp_path,
|
44
|
+
source = File.join(tmp_path, "source")
|
45
45
|
FileUtils.mkdir_p(source)
|
46
46
|
|
47
|
-
FileUtils.touch(File.join(source,
|
48
|
-
FileUtils.touch(File.join(source,
|
49
|
-
FileUtils.touch(File.join(source,
|
47
|
+
FileUtils.touch(File.join(source, "file_a"))
|
48
|
+
FileUtils.touch(File.join(source, "file_b"))
|
49
|
+
FileUtils.touch(File.join(source, "file_c"))
|
50
50
|
|
51
|
-
FileUtils.mkdir_p(File.join(source,
|
52
|
-
FileUtils.touch(File.join(source,
|
53
|
-
FileUtils.touch(File.join(source,
|
51
|
+
FileUtils.mkdir_p(File.join(source, "folder"))
|
52
|
+
FileUtils.touch(File.join(source, "folder", "file_d"))
|
53
|
+
FileUtils.touch(File.join(source, "folder", "file_e"))
|
54
54
|
|
55
|
-
FileUtils.mkdir_p(File.join(source,
|
56
|
-
FileUtils.touch(File.join(source,
|
55
|
+
FileUtils.mkdir_p(File.join(source, ".dot_folder"))
|
56
|
+
FileUtils.touch(File.join(source, ".dot_folder", "file_f"))
|
57
57
|
|
58
|
-
FileUtils.touch(File.join(source,
|
58
|
+
FileUtils.touch(File.join(source, ".file_g"))
|
59
59
|
|
60
60
|
# VCS files: Arch
|
61
|
-
FileUtils.mkdir_p(File.join(source,
|
62
|
-
FileUtils.mkdir_p(File.join(source,
|
61
|
+
FileUtils.mkdir_p(File.join(source, ".arch-ids"))
|
62
|
+
FileUtils.mkdir_p(File.join(source, "{arch}"))
|
63
63
|
|
64
64
|
# VCS files: Bazaar
|
65
|
-
FileUtils.touch(File.join(source,
|
66
|
-
FileUtils.touch(File.join(source,
|
67
|
-
FileUtils.touch(File.join(source,
|
65
|
+
FileUtils.touch(File.join(source, ".bzr"))
|
66
|
+
FileUtils.touch(File.join(source, ".bzrignore"))
|
67
|
+
FileUtils.touch(File.join(source, ".bzrtags"))
|
68
68
|
|
69
69
|
# VCS files: CVS
|
70
|
-
FileUtils.mkdir_p(File.join(source,
|
71
|
-
FileUtils.touch(File.join(source,
|
70
|
+
FileUtils.mkdir_p(File.join(source, "CVS"))
|
71
|
+
FileUtils.touch(File.join(source, ".cvsignore"))
|
72
72
|
|
73
73
|
# VCS files: Darcs
|
74
|
-
FileUtils.touch(File.join(source,
|
74
|
+
FileUtils.touch(File.join(source, "_darcs"))
|
75
75
|
|
76
76
|
# VCS files: git
|
77
|
-
FileUtils.mkdir_p(File.join(source,
|
78
|
-
FileUtils.touch(File.join(source,
|
79
|
-
git_readonly_file = File.join(source,
|
77
|
+
FileUtils.mkdir_p(File.join(source, ".git", "objects", "08"))
|
78
|
+
FileUtils.touch(File.join(source, ".git", "HEAD"))
|
79
|
+
git_readonly_file = File.join(source, ".git", "objects", "08", "01ddba0b1237b2e0e602cf5fdb6544561950cb")
|
80
80
|
FileUtils.touch(File.join(git_readonly_file))
|
81
81
|
FileUtils.chmod("ugo=r", git_readonly_file)
|
82
|
-
FileUtils.touch(File.join(source,
|
82
|
+
FileUtils.touch(File.join(source, ".gitignore"))
|
83
83
|
|
84
84
|
# VCS files: Mercurial
|
85
|
-
FileUtils.touch(File.join(source,
|
86
|
-
FileUtils.touch(File.join(source,
|
87
|
-
FileUtils.touch(File.join(source,
|
85
|
+
FileUtils.touch(File.join(source, ".hg"))
|
86
|
+
FileUtils.touch(File.join(source, ".hgignore"))
|
87
|
+
FileUtils.touch(File.join(source, ".hgrags"))
|
88
88
|
|
89
89
|
# VCS files: RCS
|
90
|
-
FileUtils.mkdir_p(File.join(source,
|
90
|
+
FileUtils.mkdir_p(File.join(source, "RCS"))
|
91
91
|
|
92
92
|
# VCS files: SCCS
|
93
|
-
FileUtils.mkdir_p(File.join(source,
|
93
|
+
FileUtils.mkdir_p(File.join(source, "SCCS"))
|
94
94
|
|
95
95
|
# VCS files: Subversion
|
96
|
-
FileUtils.mkdir_p(File.join(source,
|
96
|
+
FileUtils.mkdir_p(File.join(source, ".svn"))
|
97
97
|
|
98
98
|
source
|
99
99
|
end
|
100
100
|
|
101
|
-
let(:destination) { File.join(tmp_path,
|
101
|
+
let(:destination) { File.join(tmp_path, "destination") }
|
102
102
|
|
103
|
-
context
|
104
|
-
it
|
103
|
+
context "when the destination is empty" do
|
104
|
+
it "syncs the directories" do
|
105
105
|
described_class.sync(source, destination)
|
106
106
|
|
107
107
|
expect("#{destination}/file_a").to be_a_file
|
@@ -114,10 +114,10 @@ module Berkshelf
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
context
|
117
|
+
context "when the directory exists" do
|
118
118
|
before { FileUtils.mkdir_p(destination) }
|
119
119
|
|
120
|
-
it
|
120
|
+
it "does not delete existing files and folders" do
|
121
121
|
FileUtils.mkdir_p("#{destination}/existing_folder")
|
122
122
|
FileUtils.mkdir_p("#{destination}/.existing_folder")
|
123
123
|
FileUtils.touch("#{destination}/existing_file")
|
@@ -139,7 +139,7 @@ module Berkshelf
|
|
139
139
|
expect("#{destination}/.existing_file").to be_a_file
|
140
140
|
end
|
141
141
|
|
142
|
-
it
|
142
|
+
it "optionally deletes existing files and folders" do
|
143
143
|
FileUtils.mkdir_p("#{destination}/existing_folder")
|
144
144
|
FileUtils.mkdir_p("#{destination}/.existing_folder")
|
145
145
|
FileUtils.touch("#{destination}/existing_file")
|
@@ -161,7 +161,7 @@ module Berkshelf
|
|
161
161
|
expect("#{destination}/.existing_file").to_not be_a_file
|
162
162
|
end
|
163
163
|
|
164
|
-
it
|
164
|
+
it "skips excluded VCS files" do
|
165
165
|
described_class.sync(source, destination, exclude: Berksfile::EXCLUDED_VCS_FILES_WHEN_VENDORING)
|
166
166
|
|
167
167
|
# VCS files: Arch
|
@@ -202,41 +202,41 @@ module Berkshelf
|
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
|
-
context
|
205
|
+
context "with deeply nested paths and symlinks", :not_supported_on_windows do
|
206
206
|
let(:source) do
|
207
|
-
source = File.join(tmp_path,
|
207
|
+
source = File.join(tmp_path, "source")
|
208
208
|
FileUtils.mkdir_p(source)
|
209
209
|
|
210
|
-
FileUtils.mkdir_p(File.join(source,
|
211
|
-
|
212
|
-
|
210
|
+
FileUtils.mkdir_p(File.join(source, "bin"))
|
211
|
+
FileUtils.touch(File.join(source, "bin", "apt"))
|
212
|
+
FileUtils.touch(File.join(source, "bin", "yum"))
|
213
213
|
|
214
|
-
FileUtils.touch(File.join(source,
|
214
|
+
FileUtils.touch(File.join(source, "LICENSE"))
|
215
215
|
|
216
|
-
FileUtils.mkdir_p(File.join(source,
|
217
|
-
FileUtils.mkdir_p(File.join(source,
|
218
|
-
|
216
|
+
FileUtils.mkdir_p(File.join(source, "include"))
|
217
|
+
FileUtils.mkdir_p(File.join(source, "include", "linux"))
|
218
|
+
FileUtils.touch(File.join(source, "include", "linux", "init.ini"))
|
219
219
|
|
220
|
-
FileUtils.mkdir_p(File.join(source,
|
221
|
-
FileUtils.mkdir_p(File.join(source,
|
222
|
-
|
223
|
-
|
224
|
-
|
220
|
+
FileUtils.mkdir_p(File.join(source, "source"))
|
221
|
+
FileUtils.mkdir_p(File.join(source, "source", "bin"))
|
222
|
+
FileUtils.touch(File.join(source, "source", "bin", "apt"))
|
223
|
+
FileUtils.touch(File.join(source, "source", "bin", "yum"))
|
224
|
+
FileUtils.touch(File.join(source, "source", "LICENSE"))
|
225
225
|
|
226
|
-
FileUtils.mkdir_p(File.join(source,
|
226
|
+
FileUtils.mkdir_p(File.join(source, "empty_directory"))
|
227
227
|
|
228
|
-
FileUtils.mkdir_p(File.join(source,
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
228
|
+
FileUtils.mkdir_p(File.join(source, "links"))
|
229
|
+
FileUtils.touch(File.join(source, "links", "home.html"))
|
230
|
+
FileUtils.ln_s("./home.html", "#{source}/links/index.html")
|
231
|
+
FileUtils.ln_s("./home.html", "#{source}/links/default.html")
|
232
|
+
FileUtils.ln_s("../source/bin/apt", "#{source}/links/apt")
|
233
233
|
|
234
|
-
FileUtils.ln_s(
|
234
|
+
FileUtils.ln_s("/foo/bar", "#{source}/root")
|
235
235
|
|
236
236
|
source
|
237
237
|
end
|
238
238
|
|
239
|
-
it
|
239
|
+
it "copies relative and absolute symlinks" do
|
240
240
|
described_class.sync(source, destination)
|
241
241
|
|
242
242
|
expect("#{destination}/bin").to be_a_directory
|
@@ -263,23 +263,23 @@ module Berkshelf
|
|
263
263
|
expect("#{destination}/links/default.html").to be_a_symlink_to("./home.html")
|
264
264
|
expect("#{destination}/links/apt").to be_a_symlink_to("../source/bin/apt")
|
265
265
|
|
266
|
-
expect("#{destination}/root").to be_a_symlink_to(
|
266
|
+
expect("#{destination}/root").to be_a_symlink_to("/foo/bar")
|
267
267
|
end
|
268
268
|
|
269
|
-
it
|
269
|
+
it "copies relative and absolute symlinks when destination is a relative path" do
|
270
270
|
described_class.sync(source, "#{destination.gsub(Dir.pwd, '.')}")
|
271
271
|
|
272
272
|
expect("#{destination}/links/index.html").to be_a_symlink_to("./home.html")
|
273
273
|
expect("#{destination}/links/default.html").to be_a_symlink_to("./home.html")
|
274
274
|
expect("#{destination}/links/apt").to be_a_symlink_to("../source/bin/apt")
|
275
|
-
expect("#{destination}/root").to be_a_symlink_to(
|
275
|
+
expect("#{destination}/root").to be_a_symlink_to("/foo/bar")
|
276
276
|
end
|
277
277
|
|
278
278
|
end
|
279
279
|
|
280
|
-
context
|
281
|
-
it
|
282
|
-
described_class.sync(source, destination, exclude:
|
280
|
+
context "when :exclude is given" do
|
281
|
+
it "does not copy files and folders that match the pattern" do
|
282
|
+
described_class.sync(source, destination, exclude: ".dot_folder")
|
283
283
|
|
284
284
|
expect("#{destination}/file_a").to be_a_file
|
285
285
|
expect("#{destination}/file_b").to be_a_file
|
@@ -291,8 +291,8 @@ module Berkshelf
|
|
291
291
|
expect("#{destination}/.file_g").to be_a_file
|
292
292
|
end
|
293
293
|
|
294
|
-
it
|
295
|
-
described_class.sync(source, destination, exclude:
|
294
|
+
it "does not copy files and folder matching a pattern with a wildcard" do
|
295
|
+
described_class.sync(source, destination, exclude: "**/file_e")
|
296
296
|
|
297
297
|
expect("#{destination}/file_a").to be_a_file
|
298
298
|
expect("#{destination}/file_b").to be_a_file
|
@@ -304,13 +304,13 @@ module Berkshelf
|
|
304
304
|
expect("#{destination}/.file_g").to be_a_file
|
305
305
|
end
|
306
306
|
|
307
|
-
it
|
307
|
+
it "removes existing files and folders in destination" do
|
308
308
|
FileUtils.mkdir_p("#{destination}/existing_folder")
|
309
309
|
FileUtils.touch("#{destination}/existing_file")
|
310
310
|
FileUtils.mkdir_p("#{destination}/.dot_folder")
|
311
311
|
FileUtils.touch("#{destination}/.dot_folder/file_f")
|
312
312
|
|
313
|
-
described_class.sync(source, destination, delete: true, exclude:
|
313
|
+
described_class.sync(source, destination, delete: true, exclude: ".dot_folder")
|
314
314
|
|
315
315
|
expect("#{destination}/file_a").to be_a_file
|
316
316
|
expect("#{destination}/file_b").to be_a_file
|
@@ -1,35 +1,35 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Berkshelf
|
4
4
|
describe BaseFormatter do
|
5
|
-
it
|
6
|
-
expect
|
7
|
-
subject.install(
|
8
|
-
|
5
|
+
it "has abstract methods for all the messaging modes" do
|
6
|
+
expect do
|
7
|
+
subject.install("my_coobook", "1.2.3", "http://community")
|
8
|
+
end.to raise_error(AbstractFunction)
|
9
9
|
|
10
|
-
expect
|
11
|
-
subject.use(
|
12
|
-
|
10
|
+
expect do
|
11
|
+
subject.use("my_coobook", "1.2.3")
|
12
|
+
end.to raise_error(AbstractFunction)
|
13
13
|
|
14
|
-
expect
|
15
|
-
subject.use(
|
16
|
-
|
14
|
+
expect do
|
15
|
+
subject.use("my_coobook", "1.2.3", "http://community")
|
16
|
+
end.to raise_error(AbstractFunction)
|
17
17
|
|
18
|
-
expect
|
19
|
-
subject.uploaded(
|
20
|
-
|
18
|
+
expect do
|
19
|
+
subject.uploaded("my_coobook", "1.2.3", "http://chef_server")
|
20
|
+
end.to raise_error(AbstractFunction)
|
21
21
|
|
22
|
-
expect
|
23
|
-
subject.msg(
|
24
|
-
|
22
|
+
expect do
|
23
|
+
subject.msg("something you to know")
|
24
|
+
end.to raise_error(AbstractFunction)
|
25
25
|
|
26
|
-
expect
|
27
|
-
subject.error(
|
28
|
-
|
26
|
+
expect do
|
27
|
+
subject.error("whoa this is bad")
|
28
|
+
end.to raise_error(AbstractFunction)
|
29
29
|
|
30
|
-
expect
|
31
|
-
subject.fetch(double(
|
32
|
-
|
30
|
+
expect do
|
31
|
+
subject.fetch(double("dependency"))
|
32
|
+
end.to raise_error(AbstractFunction)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|