bosh-workspace 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +5 -13
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +8 -0
  4. data/Gemfile +4 -0
  5. data/Guardfile +2 -2
  6. data/README.md +78 -39
  7. data/Rakefile +4 -0
  8. data/bosh-workspace.gemspec +4 -1
  9. data/lib/bosh/cli/commands/prepare.rb +74 -0
  10. data/lib/bosh/cli/commands/{01_make_manifest.rb → project_deployment.rb} +4 -26
  11. data/lib/bosh/workspace.rb +7 -3
  12. data/lib/bosh/workspace/helpers/dns_helper.rb +72 -0
  13. data/lib/bosh/workspace/helpers/project_deployment_helper.rb +8 -3
  14. data/lib/bosh/workspace/helpers/release_helper.rb +33 -0
  15. data/lib/bosh/workspace/helpers/spiff_helper.rb +1 -1
  16. data/lib/bosh/workspace/helpers/stemcell_helper.rb +45 -0
  17. data/lib/bosh/workspace/manifest_builder.rb +10 -25
  18. data/lib/bosh/workspace/project_deployment.rb +77 -0
  19. data/lib/bosh/workspace/release.rb +41 -33
  20. data/lib/bosh/workspace/stemcell.rb +23 -0
  21. data/lib/bosh/workspace/stub_file.rb +44 -0
  22. data/lib/bosh/workspace/version.rb +1 -1
  23. data/spec/assets/dns/job-properties.yml +22 -0
  24. data/spec/assets/dns/jobs.yml +18 -0
  25. data/spec/assets/dns/networks-manual.yml +19 -0
  26. data/spec/assets/dns/networks-no-manual.yml +18 -0
  27. data/spec/assets/dns/properties.yml +29 -0
  28. data/spec/assets/foo-boshrelease-repo.zip +0 -0
  29. data/spec/commands/prepare_spec.rb +99 -0
  30. data/spec/commands/{command_make_manifest_spec.rb → project_deployment_spec.rb} +4 -23
  31. data/spec/helpers/dns_helper_spec.rb +59 -0
  32. data/spec/helpers/project_deployment_helper_spec.rb +24 -23
  33. data/spec/helpers/release_helper_spec.rb +76 -0
  34. data/spec/helpers/spiff_helper_spec.rb +2 -2
  35. data/spec/helpers/stemcell_helper_spec.rb +89 -0
  36. data/spec/manifest_builder_spec.rb +24 -45
  37. data/spec/project_deployment_spec.rb +157 -0
  38. data/spec/release_spec.rb +39 -18
  39. data/spec/spec_helper.rb +9 -3
  40. data/spec/stemcell_spec.rb +28 -0
  41. data/spec/stub_file_spec.rb +74 -0
  42. metadata +90 -22
  43. data/lib/bosh/workspace/deployment_manifest.rb +0 -67
  44. data/lib/bosh/workspace/release_manager.rb +0 -14
  45. data/spec/deployment_manifest_spec.rb +0 -93
  46. data/spec/release_manager_spec.rb +0 -17
@@ -1,93 +0,0 @@
1
- describe Bosh::Manifests::DeploymentManifest do
2
- subject { Bosh::Manifests::DeploymentManifest.new manifest_file }
3
- let(:manifest_file) { get_tmp_file_path(manifest.to_yaml) }
4
- let(:name) { "foo" }
5
- let(:uuid) { "foo-bar-uuid" }
6
- let(:templates) { ["path_to_bar", "path_to_baz"] }
7
- let(:releases) { [
8
- { "name" => "foo", "version" => "latest", "git" => "example.com/foo.git" }
9
- ] }
10
- let(:meta) { { "foo" => "bar" } }
11
- let(:manifest) { {
12
- "name" => name,
13
- "director_uuid" => uuid,
14
- "templates" => templates,
15
- "releases" => releases,
16
- "meta" => meta,
17
- } }
18
-
19
- context "invalid manifest" do
20
- let(:invalid_manifest) { manifest.tap { |m| m.delete(missing) } }
21
- let(:manifest_file) { get_tmp_file_path(invalid_manifest.to_yaml) }
22
-
23
- before do
24
- subject.validate
25
- expect(subject).to_not be_valid
26
- end
27
-
28
- context "not a hash" do
29
- let(:invalid_manifest) { "foo" }
30
- it "raises an error" do
31
- expect(subject.errors).to eq ["Manifest should be a hash"]
32
- end
33
- end
34
-
35
- context "missing name" do
36
- let(:missing) { "name" }
37
- it "raises an error" do
38
- expect(subject.errors).to eq ["Manifest should contain a name"]
39
- end
40
- end
41
-
42
- context "missing director_uuid" do
43
- let(:missing) { "director_uuid" }
44
- it "raises an error" do
45
- expect(subject.errors).to eq ["Manifest should contain a director_uuid"]
46
- end
47
- end
48
-
49
- context "missing templates" do
50
- let(:missing) { "templates" }
51
- it "raises an error" do
52
- expect(subject.errors).to eq ["Manifest should contain templates"]
53
- end
54
- end
55
-
56
- context "missing releases" do
57
- let(:missing) { "releases" }
58
- it "raises an error" do
59
- expect(subject.errors).to eq ["Manifest should contain releases"]
60
- end
61
- end
62
-
63
- context "missing meta" do
64
- let(:missing) { "meta" }
65
- it "raises an error" do
66
- expect(subject.errors).to eq ["Manifest should contain meta hash"]
67
- end
68
- end
69
- end
70
-
71
- context "valid manifest" do
72
- it "has properties" do
73
- subject.validate
74
- expect(subject).to be_valid
75
- expect(subject.name).to eq name
76
- expect(subject.director_uuid).to eq uuid
77
- expect(subject.templates).to eq templates
78
- expect(subject.releases).to eq releases
79
- expect(subject.meta).to eq meta
80
- end
81
- end
82
-
83
- describe "#merged_file" do
84
- it "creates parent directory" do
85
- dir = File.dirname(subject.merged_file)
86
- expect(File.directory?(dir)).to be_true
87
- end
88
-
89
- it "retruns merged file" do
90
- expect(subject.merged_file).to match /\.deployments\//
91
- end
92
- end
93
- end
@@ -1,17 +0,0 @@
1
- describe Bosh::Manifests::ReleaseManager do
2
- let(:releases) { [ release_data ] }
3
- let(:release_data) { { "name" => "foo" } }
4
- let(:work_dir) { asset_dir("manifests-repo") }
5
- let(:releases_dir) { File.join(work_dir, ".releases") }
6
- let(:release) { instance_double("Bosh::Manifests::Release") }
7
- subject { Bosh::Manifests::ReleaseManager.new(releases, work_dir) }
8
-
9
- describe "#update_release_repos" do
10
- it "invokes checkout_current_version" do
11
- Bosh::Manifests::Release.should_receive(:new)
12
- .with(release_data, releases_dir).and_return(release)
13
- release.should_receive(:checkout_current_version)
14
- subject.update_release_repos
15
- end
16
- end
17
- end