bosh-workspace 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/bosh-workspace.gemspec +5 -4
  3. data/lib/bosh/cli/commands/deployment_patch.rb +0 -1
  4. data/lib/bosh/cli/commands/prepare.rb +12 -11
  5. data/lib/bosh/workspace.rb +4 -3
  6. data/lib/bosh/workspace/credentials.rb +12 -5
  7. data/lib/bosh/workspace/git_credentials_provider.rb +80 -0
  8. data/lib/bosh/workspace/{git_remote_url.rb → helpers/git_protocol_helper.rb} +4 -8
  9. data/lib/bosh/workspace/helpers/project_deployment_helper.rb +10 -2
  10. data/lib/bosh/workspace/helpers/release_helper.rb +33 -7
  11. data/lib/bosh/workspace/manifest_builder.rb +6 -8
  12. data/lib/bosh/workspace/merge_tool.rb +73 -0
  13. data/lib/bosh/workspace/project_deployment.rb +20 -5
  14. data/lib/bosh/workspace/release.rb +103 -67
  15. data/lib/bosh/workspace/schemas/credentials.rb +22 -0
  16. data/lib/bosh/workspace/schemas/project_deployment.rb +14 -1
  17. data/lib/bosh/workspace/version.rb +1 -1
  18. data/spec/assets/bin/spruce +0 -0
  19. data/spec/assets/manifests-repo/deployments/foo.yml +1 -0
  20. data/spec/assets/manifests-repo/stubs/foo.yml +4 -0
  21. data/spec/commands/prepare_spec.rb +39 -12
  22. data/spec/credentials_spec.rb +8 -0
  23. data/spec/git_credentials_provider_spec.rb +82 -0
  24. data/spec/{git_remote_url_spec.rb → helpers/git_protocol_helper_spec.rb} +10 -11
  25. data/spec/helpers/project_deployment_helper_spec.rb +12 -1
  26. data/spec/helpers/release_helper_spec.rb +157 -73
  27. data/spec/manifest_builder_spec.rb +6 -5
  28. data/spec/merge_tool_spec.rb +98 -0
  29. data/spec/project_deployment_spec.rb +43 -1
  30. data/spec/release_spec.rb +369 -354
  31. data/spec/rugged_spec.rb +64 -0
  32. data/spec/schemas/credentials_spec.rb +22 -5
  33. data/spec/spec_helper.rb +1 -0
  34. metadata +35 -15
  35. data/lib/bosh/workspace/helpers/git_credentials_helper.rb +0 -111
  36. data/lib/bosh/workspace/helpers/spiff_helper.rb +0 -34
  37. data/spec/helpers/git_credentials_helper_spec.rb +0 -190
  38. data/spec/helpers/spiff_helper_spec.rb +0 -68
@@ -1,68 +0,0 @@
1
- describe Bosh::Workspace::SpiffHelper do
2
- describe ".spiff" do
3
- class SpiffHelperTester
4
- include Bosh::Workspace::SpiffHelper
5
- end
6
- subject { SpiffHelperTester.new }
7
- let(:path) { asset_dir("bin") }
8
- let(:templates) { ["foo.yml", "bar.yml"] }
9
- let(:target_file) { "spiffed_manifest.yml" }
10
- let(:args) { [/spiff merge/, Hash] }
11
-
12
- around do |example|
13
- original_path = ENV["PATH"]
14
- ENV["PATH"] = path
15
- example.run
16
- ENV["PATH"] = original_path
17
- end
18
-
19
- before do
20
- expect(subject).to receive(:sh).with(*args).and_yield(result)
21
- end
22
-
23
- context "spiff not in path" do
24
- let(:path) { asset_dir("empty_bin") }
25
- let(:result) { Bosh::Exec::Result.new("spiff", "", 0, true) }
26
-
27
- it "raises an error" do
28
- expect{ subject.spiff_merge templates, target_file }
29
- .to raise_error /make sure spiff is installed/
30
- end
31
- end
32
-
33
- context "spiff error" do
34
- let(:path) { asset_dir("empty_bin") }
35
- let(:result) { Bosh::Exec::Result.new("spiff", "spiff error", 1, false) }
36
-
37
- it "raises an error" do
38
- expect(subject).to receive(:say).with(/Command failed/)
39
- expect{ subject.spiff_merge templates, target_file }
40
- .to raise_error /spiff error/
41
- end
42
- end
43
-
44
- describe ".spiff_merge" do
45
- let(:file) { instance_double("File") }
46
- let(:output) { "---\n{}" }
47
- let(:result) { Bosh::Exec::Result.new("spiff", output, 0, false) }
48
-
49
- before do
50
- expect(File).to receive(:open).with(target_file, 'w').and_yield(file)
51
- expect(file).to receive(:write).with(output)
52
- end
53
-
54
- it "merges manifests" do
55
- subject.spiff_merge templates, target_file
56
- end
57
-
58
- context "spaces in template paths" do
59
- let(:templates) { ["space test/foo space test.yml"] }
60
- let(:args) { [/space\\ test\/foo\\ space\\ test.yml/, Hash] }
61
-
62
- it "merges manifests" do
63
- subject.spiff_merge templates, target_file
64
- end
65
- end
66
- end
67
- end
68
- end