manifests-vmc-plugin 0.6.1 → 0.6.2.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +24 -32
- data/lib/manifests-vmc-plugin/loader/normalizer.rb +8 -0
- data/lib/manifests-vmc-plugin/plugin.rb +3 -2
- data/lib/manifests-vmc-plugin/version.rb +1 -1
- data/spec/manifests-vmc-plugin/loader/normalizer_spec.rb +22 -1
- data/spec/manifests-vmc-plugin/loader/plugin_spec.rb +66 -28
- metadata +12 -8
data/Rakefile
CHANGED
@@ -1,47 +1,39 @@
|
|
1
1
|
require "rake"
|
2
|
+
require "rspec/core/rake_task"
|
2
3
|
|
3
4
|
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
4
5
|
require "manifests-vmc-plugin/version"
|
5
6
|
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
8
|
task :default => :spec
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
task :test => ["bundler:install", "test:integration"]
|
13
|
-
|
14
|
-
task :build do
|
15
|
-
sh "gem build manifests-vmc-plugin.gemspec"
|
16
|
-
end
|
17
|
-
|
18
|
-
task :install => :build do
|
19
|
-
sh "gem install --local manifests-vmc-plugin-#{VMCManifests::VERSION}.gem"
|
20
|
-
end
|
21
|
-
|
22
|
-
task :uninstall do
|
23
|
-
sh "gem uninstall manifests-vmc-plugin"
|
24
|
-
end
|
25
|
-
|
26
|
-
task :reinstall => [:uninstall, :install]
|
10
|
+
namespace :deploy do
|
11
|
+
def last_staging_sha
|
12
|
+
`git rev-parse latest-staging`.strip
|
13
|
+
end
|
27
14
|
|
28
|
-
|
29
|
-
|
30
|
-
end
|
15
|
+
def last_release_sha
|
16
|
+
`git rev-parse latest-release`.strip
|
17
|
+
end
|
31
18
|
|
32
|
-
|
33
|
-
|
34
|
-
task "install" do
|
35
|
-
sh("bundle install")
|
19
|
+
def last_staging_ref_was_released?
|
20
|
+
last_staging_sha == last_release_sha
|
36
21
|
end
|
37
|
-
end
|
38
22
|
|
39
|
-
|
40
|
-
|
41
|
-
|
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"
|
42
28
|
end
|
43
29
|
|
44
|
-
task
|
45
|
-
sh
|
30
|
+
task :gem do
|
31
|
+
sh "git fetch"
|
32
|
+
sh "git checkout #{last_staging_sha}"
|
33
|
+
sh "gem release"
|
34
|
+
sh "git tag -f v#{VMCManifests::VERSION}"
|
35
|
+
sh "git tag -f latest-release"
|
36
|
+
sh "git push origin :latest-release"
|
37
|
+
sh "git push origin latest-release"
|
46
38
|
end
|
47
39
|
end
|
@@ -105,6 +105,14 @@ module VMCManifests
|
|
105
105
|
if app.key?("url") && app["url"].nil?
|
106
106
|
app["url"] = "none"
|
107
107
|
end
|
108
|
+
|
109
|
+
if app.key?("subdomain")
|
110
|
+
if app.key?("host")
|
111
|
+
app.delete("subdomain")
|
112
|
+
else
|
113
|
+
app["host"] = app.delete("subdomain")
|
114
|
+
end
|
115
|
+
end
|
108
116
|
end
|
109
117
|
|
110
118
|
def toplevel_attributes(manifest)
|
@@ -116,11 +116,12 @@ class ManifestsPlugin < VMC::App::Base
|
|
116
116
|
|
117
117
|
def push_input_for(app_manifest, input)
|
118
118
|
existing_app = client.app_by_name(app_manifest[:name])
|
119
|
+
rebased_input = input.rebase_given(app_manifest)
|
119
120
|
|
120
121
|
if !existing_app || input[:reset]
|
121
|
-
input =
|
122
|
+
input = rebased_input
|
122
123
|
else
|
123
|
-
warn_reset_changes if manifest_differs?(existing_app,
|
124
|
+
warn_reset_changes if manifest_differs?(existing_app, rebased_input)
|
124
125
|
end
|
125
126
|
|
126
127
|
input.merge(
|
@@ -27,7 +27,28 @@ describe VMCManifests::Normalizer do
|
|
27
27
|
|
28
28
|
it "sets it to none" do
|
29
29
|
expect(subject).to eq(
|
30
|
-
:applications => [{ :path => ".", :url => "none" }]
|
30
|
+
:applications => [{ :path => ".", :url => "none" }]
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'with a manifest with a subdomain attribute' do
|
36
|
+
let(:manifest) { { "applications" => { "." => { "subdomain" => "use-this-for-host" } } } }
|
37
|
+
|
38
|
+
it "sets the subdomain key to be host" do
|
39
|
+
expect(subject).to eq(
|
40
|
+
:applications => [{ :path => ".", :host => "use-this-for-host" }]
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when the host attribute is also set" do
|
45
|
+
let(:manifest) { { "applications" => { "." => { "subdomain" => "dont-use-this-for-host", "host" => "canonical-attribute" } } } }
|
46
|
+
|
47
|
+
it 'does not overwrite an explicit host attribute' do
|
48
|
+
expect(subject).to eq(
|
49
|
+
:applications => [{ :path => ".", :host => "canonical-attribute" }]
|
50
|
+
)
|
51
|
+
end
|
31
52
|
end
|
32
53
|
end
|
33
54
|
|
@@ -220,33 +220,6 @@ describe ManifestsPlugin do
|
|
220
220
|
subject
|
221
221
|
end
|
222
222
|
end
|
223
|
-
|
224
|
-
context "and --reset was NOT given" do
|
225
|
-
let(:given_hash) { { :name => "a", :instances => "100" } }
|
226
|
-
|
227
|
-
context "and the app settings differ" do
|
228
|
-
let(:app) { fake :app, :name => "a", :memory => 256 }
|
229
|
-
|
230
|
-
it "tells the user to use --reset to apply changes" do
|
231
|
-
mock(plugin).warn_reset_changes
|
232
|
-
mock(wrapped).call(anything) do |inputs|
|
233
|
-
expect(inputs.given).to eq(
|
234
|
-
:name => "a", :instances => "100")
|
235
|
-
end
|
236
|
-
subject
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
it "does not add the manifest's values to the inputs" do
|
241
|
-
stub(plugin).warn_reset_changes
|
242
|
-
mock(wrapped).call(anything) do |inputs|
|
243
|
-
expect(inputs.given).to eq(
|
244
|
-
:name => "a", :instances => "100")
|
245
|
-
end
|
246
|
-
|
247
|
-
subject
|
248
|
-
end
|
249
|
-
end
|
250
223
|
end
|
251
224
|
|
252
225
|
context "and the app does NOT exist" do
|
@@ -324,4 +297,69 @@ describe ManifestsPlugin do
|
|
324
297
|
end
|
325
298
|
end
|
326
299
|
end
|
327
|
-
|
300
|
+
|
301
|
+
describe "#push_input_for" do
|
302
|
+
context "with an existing app" do
|
303
|
+
before do
|
304
|
+
stub(plugin).from_manifest { "PATH" }
|
305
|
+
app.changes.clear
|
306
|
+
end
|
307
|
+
|
308
|
+
let(:client) { fake_client(:apps => [app]) }
|
309
|
+
let(:manifest_memory) { "256M" }
|
310
|
+
let(:app) { fake :app, :name => "a", :memory => 256 }
|
311
|
+
let(:manifest) { { :name => "a", :memory => manifest_memory } }
|
312
|
+
|
313
|
+
subject { plugin.send(:push_input_for, manifest, inputs) }
|
314
|
+
|
315
|
+
context "with --reset" do
|
316
|
+
let(:inputs_hash) { { :reset => true } }
|
317
|
+
|
318
|
+
context "with changes" do
|
319
|
+
let(:manifest_memory) { "128M" }
|
320
|
+
|
321
|
+
it "applies the changes" do
|
322
|
+
subject[:memory].should == "128M"
|
323
|
+
end
|
324
|
+
|
325
|
+
it "does not ask to set --reset" do
|
326
|
+
dont_allow(plugin).warn_reset_changes
|
327
|
+
subject
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
context "without changes" do
|
332
|
+
it "does not ask to set --reset" do
|
333
|
+
dont_allow(plugin).warn_reset_changes
|
334
|
+
subject
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
context "without --reset" do
|
340
|
+
let(:inputs_hash) { {} }
|
341
|
+
|
342
|
+
context "with changes" do
|
343
|
+
let(:manifest_memory) { "128M" }
|
344
|
+
|
345
|
+
it "asks user to provide --reset" do
|
346
|
+
mock(plugin).warn_reset_changes
|
347
|
+
subject
|
348
|
+
end
|
349
|
+
|
350
|
+
it "does not apply changes" do
|
351
|
+
stub(plugin).warn_reset_changes
|
352
|
+
subject[:memory].should == nil
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
context "without changes" do
|
357
|
+
it "does not ask to set --reset" do
|
358
|
+
dont_allow(plugin).warn_reset_changes
|
359
|
+
subject
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
364
|
+
end
|
365
|
+
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: 3394871731
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
+
- 2
|
10
|
+
- rc
|
9
11
|
- 1
|
10
|
-
version: 0.6.
|
12
|
+
version: 0.6.2.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Alex Suraci
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2013-
|
20
|
+
date: 2013-03-01 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: cfoundry
|
@@ -136,12 +138,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
139
|
none: false
|
138
140
|
requirements:
|
139
|
-
- - "
|
141
|
+
- - ">"
|
140
142
|
- !ruby/object:Gem::Version
|
141
|
-
hash:
|
143
|
+
hash: 25
|
142
144
|
segments:
|
143
|
-
-
|
144
|
-
|
145
|
+
- 1
|
146
|
+
- 3
|
147
|
+
- 1
|
148
|
+
version: 1.3.1
|
145
149
|
requirements: []
|
146
150
|
|
147
151
|
rubyforge_project: manifests-vmc-plugin
|