vmc 0.4.0.beta.32 → 0.4.0.beta.33

Sign up to get free protection for your applications and to get access to all the features.
@@ -198,8 +198,7 @@ module VMC
198
198
  app.urls = []
199
199
  end
200
200
  else
201
- domain = client.target.sub(/^https?:\/\/[^\.]+\.(.+)\/?/, '\1')
202
- app.urls = [input[:url, "#{name}.#{domain}"]]
201
+ app.urls = [input[:url, "#{name}.#{target_base}"]]
203
202
  end
204
203
 
205
204
  app.memory = megabytes(input[:memory, framework, runtime])
@@ -709,10 +708,6 @@ module VMC
709
708
  end
710
709
  end
711
710
 
712
- alias_command :set_env, :env_set
713
- alias_command :set_env, :add_env
714
- alias_command :set_env, :env_add
715
-
716
711
 
717
712
  desc "Remove an environment variable"
718
713
  group :apps, :info, :hidden => true
@@ -723,7 +718,7 @@ module VMC
723
718
  :desc => "Environment variable name"
724
719
  input :restart, :type => :boolean, :default => true,
725
720
  :desc => "Restart app after updating?"
726
- def delete_env(input)
721
+ def unset_env(input)
727
722
  app = input[:app]
728
723
  name = input[:name]
729
724
 
@@ -737,8 +732,6 @@ module VMC
737
732
  end
738
733
  end
739
734
 
740
- alias_command :delete_env, :env_del
741
-
742
735
 
743
736
  desc "DEPRECATED. Use 'push' instead."
744
737
  input :app, :argument => :optional
@@ -789,7 +782,11 @@ module VMC
789
782
 
790
783
  line
791
784
 
792
- unless a.urls.empty?
785
+ if a.urls.empty?
786
+ if v2?
787
+ line "urls: #{b("#{a.guid}.#{target_base}")}"
788
+ end
789
+ else
793
790
  line "urls: #{a.urls.collect { |u| b(u) }.join(", ")}"
794
791
  end
795
792
 
@@ -976,5 +973,9 @@ module VMC
976
973
 
977
974
  format("%.#{precision}fB", num)
978
975
  end
976
+
977
+ def target_base
978
+ client.target.sub(/^https?:\/\/([^\.]+\.)?(.+)\/?/, '\2')
979
+ end
979
980
  end
980
981
  end
@@ -231,7 +231,7 @@ module VMC
231
231
  return unless input[:really, instance.name, :name]
232
232
 
233
233
  with_progress("Deleting #{c(instance.name, :name)}") do |s|
234
- bindings = instance.service_bindings
234
+ bindings = v2? ? instance.service_bindings : []
235
235
 
236
236
  if bindings.empty?
237
237
  instance.delete!
@@ -1,3 +1,3 @@
1
1
  module VMC
2
- VERSION = "0.4.0.beta.32"
2
+ VERSION = "0.4.0.beta.33"
3
3
  end
data/vmc-ng/spec/Rakefile CHANGED
@@ -11,4 +11,3 @@ RSpec::Core::RakeTask.new do |t|
11
11
  t.pattern = "**/*_spec.rb"
12
12
  t.rspec_opts = ["--format", "documentation", "--colour"]
13
13
  end
14
-
@@ -0,0 +1,19 @@
1
+ require File.expand_path("../../helpers", __FILE__)
2
+
3
+ describe "App#app" do
4
+ it "shows the app name if it exists" do
5
+ with_random_app do |app|
6
+ running(:app, {}, :app => app.name) do
7
+ outputs(app.name)
8
+ end
9
+ end
10
+ end
11
+
12
+ it "fails if an unknown app is provided" do
13
+ running(:app, {}, :app => "unknown-app") do
14
+ raises(VMC::UserError) do |e|
15
+ e.message.should == "Unknown app 'unknown-app'"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,4 @@
1
- require "./helpers"
1
+ require File.expand_path("../../helpers", __FILE__)
2
2
 
3
3
  describe "App#apps" do
4
4
  it "lists app names" do
@@ -1,13 +1,13 @@
1
- require "./helpers"
1
+ require File.expand_path("../../helpers", __FILE__)
2
2
 
3
3
  describe "App#push" do
4
4
  it "pushes interactively" do
5
5
  name = "app-#{random_str}"
6
- instances = 1 # rand(3) + 1
6
+ instances = rand(3) + 1
7
7
  framework = client.framework_by_name("sinatra")
8
8
  runtime = client.runtime_by_name("ruby19")
9
9
  url = "#{name}.fakecloud.com"
10
- memory = 256 # sample([64, 128, 256, 512])
10
+ memory = sample([64, 128, 256, 512])
11
11
 
12
12
  client.app_by_name(name).should_not be
13
13
 
@@ -1,8 +1,15 @@
1
+ require "simplecov"
2
+
3
+ SimpleCov.start do
4
+ root File.expand_path("../../", __FILE__)
5
+ add_filter "spec/"
6
+ end
7
+
1
8
  require "cfoundry"
2
9
  require "vmc"
3
10
 
4
- require "./eventlog"
5
- require "./patches"
11
+ require File.expand_path("../eventlog", __FILE__)
12
+ require File.expand_path("../patches", __FILE__)
6
13
 
7
14
 
8
15
  TARGET = ENV["VMC_TEST_TARGET"] || "http://localhost:8181"
@@ -44,8 +51,10 @@ module VMCHelpers
44
51
  @@runtimes ||= client.runtimes(0)
45
52
  end
46
53
 
47
- def with_random_app
48
- with_random_apps(1)
54
+ def with_random_app(space = client.current_space)
55
+ with_random_apps(space, 1) do |apps|
56
+ yield apps.first
57
+ end
49
58
  end
50
59
 
51
60
  # create 2-5 random apps, call the block, and then delete them
@@ -82,7 +91,7 @@ module VMCHelpers
82
91
  space.delete!
83
92
  end
84
93
 
85
- def running(command, inputs = {})
94
+ def running(command, inputs = {}, given = {})
86
95
  VMC::CLI.new.exit_status 0
87
96
 
88
97
  before_in = $stdin
@@ -102,7 +111,7 @@ module VMCHelpers
102
111
 
103
112
  thd = Thread.new do
104
113
  begin
105
- VMC::CLI.new.invoke(command, inputs)
114
+ VMC::CLI.new.invoke(command, inputs, given)
106
115
  rescue SystemExit => e
107
116
  unless e.status == 0
108
117
  raise <<EOF
@@ -265,17 +274,23 @@ module VMCMatchers
265
274
 
266
275
 
267
276
  class FailWith
268
- def initialize(exception)
277
+ def initialize(exception, predicate = nil)
269
278
  @expected = exception
279
+ @predicate = predicate
270
280
  end
271
281
 
272
282
  def matches?(log)
273
283
  @actual = log.wait_for_event(EventLog::Raised).exception
274
- @actual.is_a?(@expected)
284
+
285
+ return false unless @actual.is_a?(@expected)
286
+
287
+ @predicate.call(@actual) if @predicate
288
+
289
+ true
275
290
  end
276
291
 
277
292
  def failure_message
278
- "expected #@expected to be raised, but got #{@actual.class}: '#@actual"
293
+ "expected #@expected to be raised, but got #{@actual.class}: '#@actual'"
279
294
  end
280
295
 
281
296
  def negative_failure_message
@@ -283,8 +298,8 @@ module VMCMatchers
283
298
  end
284
299
  end
285
300
 
286
- def fail_with(exception)
287
- FailWith.new(exception)
301
+ def fail_with(exception, &blk)
302
+ FailWith.new(exception, blk)
288
303
  end
289
304
 
290
305
 
@@ -356,8 +371,8 @@ module VMCMatchers
356
371
  $vmc_event.should have_input(name, value)
357
372
  end
358
373
 
359
- def raises(exception)
360
- $vmc_event.should fail_with(exception)
374
+ def raises(exception, &blk)
375
+ $vmc_event.should fail_with(exception, &blk)
361
376
  end
362
377
 
363
378
  def finish
@@ -1,4 +1,4 @@
1
- require "./helpers"
1
+ require File.expand_path("../../helpers", __FILE__)
2
2
 
3
3
  describe "Start#target" do
4
4
  it "shows target url with no arguments" do
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1321150223
4
+ hash: -3286034684
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
9
  - 0
10
10
  - beta
11
- - 32
12
- version: 0.4.0.beta.32
11
+ - 33
12
+ version: 0.4.0.beta.33
13
13
  platform: ruby
14
14
  authors:
15
15
  - VMware
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-08-15 00:00:00 Z
20
+ date: 2012-08-17 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: json_pure
@@ -233,12 +233,12 @@ dependencies:
233
233
  requirements:
234
234
  - - ~>
235
235
  - !ruby/object:Gem::Version
236
- hash: 3
236
+ hash: 1
237
237
  segments:
238
238
  - 0
239
239
  - 4
240
- - 6
241
- version: 0.4.6
240
+ - 7
241
+ version: 0.4.7
242
242
  type: :runtime
243
243
  version_requirements: *id013
244
244
  - !ruby/object:Gem::Dependency
@@ -265,12 +265,12 @@ dependencies:
265
265
  requirements:
266
266
  - - ~>
267
267
  - !ruby/object:Gem::Version
268
- hash: 7
268
+ hash: 3
269
269
  segments:
270
270
  - 0
271
271
  - 0
272
- - 12
273
- version: 0.0.12
272
+ - 14
273
+ version: 0.0.14
274
274
  type: :runtime
275
275
  version_requirements: *id015
276
276
  - !ruby/object:Gem::Dependency
@@ -281,12 +281,12 @@ dependencies:
281
281
  requirements:
282
282
  - - ~>
283
283
  - !ruby/object:Gem::Version
284
- hash: 13
284
+ hash: 9
285
285
  segments:
286
286
  - 0
287
287
  - 4
288
- - 1
289
- version: 0.4.1
288
+ - 3
289
+ version: 0.4.3
290
290
  type: :runtime
291
291
  version_requirements: *id016
292
292
  - !ruby/object:Gem::Dependency
@@ -317,6 +317,20 @@ dependencies:
317
317
  version: "0"
318
318
  type: :runtime
319
319
  version_requirements: *id018
320
+ - !ruby/object:Gem::Dependency
321
+ name: simplecov
322
+ prerelease: false
323
+ requirement: &id019 !ruby/object:Gem::Requirement
324
+ none: false
325
+ requirements:
326
+ - - ">="
327
+ - !ruby/object:Gem::Version
328
+ hash: 3
329
+ segments:
330
+ - 0
331
+ version: "0"
332
+ type: :runtime
333
+ version_requirements: *id019
320
334
  description:
321
335
  email: support@vmware.com
322
336
  executables:
@@ -386,6 +400,7 @@ files:
386
400
  - vmc-ng/lib/vmc/spacing.rb
387
401
  - vmc-ng/lib/vmc/version.rb
388
402
  - vmc-ng/lib/vmc.rb
403
+ - vmc-ng/spec/app/app_spec.rb
389
404
  - vmc-ng/spec/app/apps_spec.rb
390
405
  - vmc-ng/spec/app/push_spec.rb
391
406
  - vmc-ng/spec/assets/hello-sinatra/Gemfile