manifests-vmc-plugin 0.6.2 → 0.6.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -33
- data/lib/manifests-vmc-plugin.rb +4 -0
- data/lib/manifests-vmc-plugin/errors.rb +12 -0
- data/lib/manifests-vmc-plugin/loader/builder.rb +3 -0
- data/lib/manifests-vmc-plugin/version.rb +1 -1
- data/spec/manifests-vmc-plugin/errors_spec.rb +29 -0
- data/spec/manifests-vmc-plugin/loader/builder_spec.rb +84 -0
- data/spec/manifests-vmc-plugin/{loader/plugin_spec.rb → plugin_spec.rb} +0 -0
- data/spec/manifests-vmc-plugin_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -1
- metadata +32 -15
data/Rakefile
CHANGED
@@ -1,38 +1,5 @@
|
|
1
1
|
require "rake"
|
2
2
|
require "rspec/core/rake_task"
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
5
|
-
require "manifests-vmc-plugin/version"
|
6
|
-
|
7
4
|
RSpec::Core::RakeTask.new(:spec)
|
8
5
|
task :default => :spec
|
9
|
-
|
10
|
-
namespace :deploy do
|
11
|
-
def last_staging_sha
|
12
|
-
`git rev-parse latest-staging`.strip
|
13
|
-
end
|
14
|
-
|
15
|
-
def last_release_sha
|
16
|
-
`git rev-parse latest-release`.strip
|
17
|
-
end
|
18
|
-
|
19
|
-
def last_staging_ref_was_released?
|
20
|
-
last_staging_sha == last_release_sha
|
21
|
-
end
|
22
|
-
|
23
|
-
task :staging, :version do |_, args|
|
24
|
-
sh "gem bump --push #{"--version #{args.version}" if args.version}" if last_staging_ref_was_released?
|
25
|
-
sh "git tag -f latest-staging"
|
26
|
-
sh "git push origin :latest-staging"
|
27
|
-
sh "git push origin latest-staging"
|
28
|
-
end
|
29
|
-
|
30
|
-
task :gem do
|
31
|
-
sh "git fetch"
|
32
|
-
sh "git checkout #{last_staging_sha}"
|
33
|
-
sh "gem release --tag"
|
34
|
-
sh "git tag -f latest-release"
|
35
|
-
sh "git push origin :latest-release"
|
36
|
-
sh "git push origin latest-release"
|
37
|
-
end
|
38
|
-
end
|
data/lib/manifests-vmc-plugin.rb
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
module VMCManifests
|
2
|
+
class InvalidManifest < RuntimeError
|
3
|
+
attr_reader :file
|
4
|
+
|
5
|
+
def initialize(file)
|
6
|
+
@file = file
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_s
|
10
|
+
"Manifest file '#{@file}' is malformed."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
2
14
|
class CircularDependency < RuntimeError
|
3
15
|
def initialize(app)
|
4
16
|
@app = app
|
@@ -3,11 +3,14 @@ module VMCManifests
|
|
3
3
|
# parse a manifest and merge with its inherited manifests
|
4
4
|
def build(file)
|
5
5
|
manifest = YAML.load_file file
|
6
|
+
raise InvalidManifest.new(file) unless manifest
|
6
7
|
|
7
8
|
Array(manifest["inherit"]).each do |path|
|
8
9
|
manifest = merge_parent(path, manifest)
|
9
10
|
end
|
10
11
|
|
12
|
+
manifest.delete("inherit")
|
13
|
+
|
11
14
|
manifest
|
12
15
|
end
|
13
16
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
require "manifests-vmc-plugin/errors"
|
4
|
+
|
5
|
+
|
6
|
+
describe VMCManifests::InvalidManifest do
|
7
|
+
let(:file) { "/path/to/file" }
|
8
|
+
|
9
|
+
subject { described_class.new(file) }
|
10
|
+
|
11
|
+
describe "#initialize" do
|
12
|
+
it "is initialized with a file" do
|
13
|
+
described_class.new(file)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#to_s" do
|
18
|
+
it "says the file is malformed" do
|
19
|
+
expect(subject.to_s).to eq(
|
20
|
+
"Manifest file '#{file}' is malformed.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#file" do
|
25
|
+
it "returns the file it was initialized with" do
|
26
|
+
expect(subject.file).to eq(file)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
require "manifests-vmc-plugin/loader"
|
4
|
+
require "manifests-vmc-plugin/errors"
|
5
|
+
|
6
|
+
|
7
|
+
describe VMCManifests::Builder do
|
8
|
+
subject { VMCManifests::Loader.new(nil, nil) }
|
9
|
+
|
10
|
+
describe "#build" do
|
11
|
+
let(:file) { "manifest.yml" }
|
12
|
+
|
13
|
+
before do
|
14
|
+
FakeFS.activate!
|
15
|
+
|
16
|
+
File.open(file, "w") do |io|
|
17
|
+
io.write manifest
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
after do
|
22
|
+
FakeFS.deactivate!
|
23
|
+
FakeFS::FileSystem.clear
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with a simple manifest" do
|
27
|
+
let(:manifest) do
|
28
|
+
<<EOF
|
29
|
+
---
|
30
|
+
foo: bar
|
31
|
+
EOF
|
32
|
+
end
|
33
|
+
|
34
|
+
it "loads the manifest YAML" do
|
35
|
+
expect(subject.build(file)).to eq("foo" => "bar")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "with a manifest that inherits another" do
|
40
|
+
let(:manifest) do
|
41
|
+
<<EOF
|
42
|
+
---
|
43
|
+
inherit: other-manifest.yml
|
44
|
+
foo:
|
45
|
+
baz: c
|
46
|
+
EOF
|
47
|
+
end
|
48
|
+
|
49
|
+
before do
|
50
|
+
FakeFS.activate!
|
51
|
+
|
52
|
+
File.open("other-manifest.yml", "w") do |io|
|
53
|
+
io.write <<OTHER
|
54
|
+
---
|
55
|
+
foo:
|
56
|
+
bar: a
|
57
|
+
baz: b
|
58
|
+
OTHER
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
it "merges itself into the parent, by depth" do
|
63
|
+
manifest = subject.build(file)
|
64
|
+
expect(manifest).to include(
|
65
|
+
"foo" => { "bar" => "a", "baz" => "c" })
|
66
|
+
end
|
67
|
+
|
68
|
+
it "does not include the 'inherit' attribute" do
|
69
|
+
manifest = subject.build(file)
|
70
|
+
expect(manifest).to_not include("inherit")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "with an invalid manifest" do
|
75
|
+
let(:manifest) { "" }
|
76
|
+
|
77
|
+
it "raises an error" do
|
78
|
+
expect {
|
79
|
+
subject.build(file)
|
80
|
+
}.to raise_error(VMCManifests::InvalidManifest)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
File without changes
|
@@ -53,6 +53,7 @@ describe VMCManifests do
|
|
53
53
|
:memory => 2048,
|
54
54
|
:total_instances => 2,
|
55
55
|
:command => "ruby main.rb",
|
56
|
+
:buildpack => "git://example.com/foo.git",
|
56
57
|
:routes => [
|
57
58
|
fake(:route,
|
58
59
|
:host => "some-app-name",
|
@@ -83,6 +84,7 @@ describe VMCManifests do
|
|
83
84
|
its(["path"]) { should eq "some-path" }
|
84
85
|
its(["url"]) { should eq "some-app-name.${target-base}" }
|
85
86
|
its(["command"]) { should eq "ruby main.rb" }
|
87
|
+
its(["buildpack"]) { should eq "git://example.com/foo.git" }
|
86
88
|
|
87
89
|
it "contains the service information" do
|
88
90
|
expect(subject["services"]).to be_a Hash
|
data/spec/spec_helper.rb
CHANGED
@@ -6,6 +6,7 @@ require "cfoundry"
|
|
6
6
|
require "webmock"
|
7
7
|
require "cfoundry/test_support"
|
8
8
|
require "vmc/test_support"
|
9
|
+
require "fakefs/safe"
|
9
10
|
|
10
11
|
WebMock.disable_net_connect!
|
11
12
|
|
@@ -13,4 +14,4 @@ RSpec.configure do |c|
|
|
13
14
|
c.include Fake::FakeMethods
|
14
15
|
c.include VMC::TestSupport::InteractHelper
|
15
16
|
c.mock_with :rr
|
16
|
-
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manifests-vmc-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: -2300990570
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
|
9
|
+
- 3
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 0.6.3.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Alex Suraci
|
@@ -15,20 +17,29 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2013-03-
|
20
|
+
date: 2013-03-12 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
24
|
none: false
|
23
25
|
requirements:
|
24
|
-
- -
|
26
|
+
- - ">="
|
25
27
|
- !ruby/object:Gem::Version
|
26
|
-
hash:
|
28
|
+
hash: -2300990558
|
27
29
|
segments:
|
28
30
|
- 0
|
29
31
|
- 5
|
30
|
-
-
|
31
|
-
|
32
|
+
- 3
|
33
|
+
- rc
|
34
|
+
- 3
|
35
|
+
version: 0.5.3.rc3
|
36
|
+
- - <
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
hash: 7
|
39
|
+
segments:
|
40
|
+
- 0
|
41
|
+
- 6
|
42
|
+
version: "0.6"
|
32
43
|
prerelease: false
|
33
44
|
type: :runtime
|
34
45
|
name: cfoundry
|
@@ -112,8 +123,10 @@ files:
|
|
112
123
|
- lib/manifests-vmc-plugin/plugin.rb
|
113
124
|
- lib/manifests-vmc-plugin/version.rb
|
114
125
|
- lib/manifests-vmc-plugin.rb
|
126
|
+
- spec/manifests-vmc-plugin/errors_spec.rb
|
127
|
+
- spec/manifests-vmc-plugin/loader/builder_spec.rb
|
115
128
|
- spec/manifests-vmc-plugin/loader/normalizer_spec.rb
|
116
|
-
- spec/manifests-vmc-plugin/
|
129
|
+
- spec/manifests-vmc-plugin/plugin_spec.rb
|
117
130
|
- spec/manifests-vmc-plugin_spec.rb
|
118
131
|
- spec/spec_helper.rb
|
119
132
|
homepage: http://cloudfoundry.com/
|
@@ -136,12 +149,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
150
|
none: false
|
138
151
|
requirements:
|
139
|
-
- - "
|
152
|
+
- - ">"
|
140
153
|
- !ruby/object:Gem::Version
|
141
|
-
hash:
|
154
|
+
hash: 25
|
142
155
|
segments:
|
143
|
-
-
|
144
|
-
|
156
|
+
- 1
|
157
|
+
- 3
|
158
|
+
- 1
|
159
|
+
version: 1.3.1
|
145
160
|
requirements: []
|
146
161
|
|
147
162
|
rubyforge_project: manifests-vmc-plugin
|
@@ -150,7 +165,9 @@ signing_key:
|
|
150
165
|
specification_version: 3
|
151
166
|
summary: Cloud Foundry automation via manifest documents.
|
152
167
|
test_files:
|
168
|
+
- spec/manifests-vmc-plugin/errors_spec.rb
|
169
|
+
- spec/manifests-vmc-plugin/loader/builder_spec.rb
|
153
170
|
- spec/manifests-vmc-plugin/loader/normalizer_spec.rb
|
154
|
-
- spec/manifests-vmc-plugin/
|
171
|
+
- spec/manifests-vmc-plugin/plugin_spec.rb
|
155
172
|
- spec/manifests-vmc-plugin_spec.rb
|
156
173
|
- spec/spec_helper.rb
|