vmc 0.4.0.beta.17 → 0.4.0.beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -183,7 +183,7 @@ module VMC
183
183
  app.urls = []
184
184
  end
185
185
  else
186
- domain = client.target.sub(/^https?:\/\/api\.(.+)\/?/, '\1')
186
+ domain = client.target.sub(/^https?:\/\/[^\.]+\.(.+)\/?/, '\1')
187
187
  app.urls = [input[:url, "#{name}.#{domain}"]]
188
188
  end
189
189
 
@@ -679,8 +679,7 @@ module VMC
679
679
 
680
680
  puts "" unless quiet?
681
681
 
682
- vars.each do |pair|
683
- name, val = pair.split("=", 2)
682
+ vars.each do |name, val|
684
683
  puts "#{c(name, :name)}: #{val}"
685
684
  end
686
685
  end
@@ -716,10 +715,8 @@ module VMC
716
715
  fail "Unknown application '#{appname}'" unless app.exists?
717
716
 
718
717
  with_progress("Updating #{c(app.name, :name)}") do
719
- app.update!("env" =>
720
- app.env.reject { |v|
721
- v.start_with?("#{name}=")
722
- }.push("#{name}=#{value}"))
718
+ app.env[name] = value
719
+ app.update!
723
720
  end
724
721
 
725
722
  if app.started? && input[:restart]
@@ -748,10 +745,8 @@ module VMC
748
745
  fail "Unknown application '#{appname}'" unless app.exists?
749
746
 
750
747
  with_progress("Updating #{c(app.name, :name)}") do
751
- app.update!("env" =>
752
- app.env.reject { |v|
753
- v.start_with?("#{name}=")
754
- })
748
+ app.env.delete(name)
749
+ app.update!
755
750
  end
756
751
 
757
752
  if app.started? && input[:restart]
@@ -19,21 +19,28 @@ module VMC
19
19
  end
20
20
 
21
21
  def input_state(options)
22
- CFState.new(options)
22
+ if options.key? :default
23
+ answer = show_default(options)
24
+ end
25
+
26
+ CFState.new(options, answer)
27
+ end
28
+
29
+ def show_default(options)
30
+ case options[:default]
31
+ when true
32
+ "y"
33
+ when false
34
+ "n"
35
+ when nil
36
+ ""
37
+ else
38
+ show_choice(options[:default], options)
39
+ end
23
40
  end
24
41
 
25
42
  def prompt(question, options)
26
- value =
27
- case options[:default]
28
- when true
29
- "y"
30
- when false
31
- "n"
32
- when nil
33
- ""
34
- else
35
- options[:default].to_s
36
- end
43
+ value = show_default(options)
37
44
 
38
45
  print "#{question}"
39
46
  print c("> ", :prompt)
@@ -57,9 +64,16 @@ module VMC
57
64
  end
58
65
 
59
66
  state.clear_default!
60
- end
61
67
 
62
- super
68
+ # tab with a default accepts it and moves to the end
69
+ if which == :tab
70
+ state.goto(ans.size)
71
+ else
72
+ super
73
+ end
74
+ else
75
+ super
76
+ end
63
77
 
64
78
  print "\n" if which == :enter
65
79
  end
@@ -67,24 +81,8 @@ module VMC
67
81
  class CFState < ::Interactive::InputState
68
82
  def initialize(options = {}, answer = nil, position = 0)
69
83
  @options = options
70
-
71
- if answer
72
- @answer = answer
73
- elsif options[:default]
74
- case options[:default]
75
- when true
76
- @answer = "y"
77
- when false
78
- @answer = "n"
79
- else
80
- @answer = options[:default].to_s
81
- end
82
-
83
- @default = true
84
- else
85
- @answer = ""
86
- end
87
-
84
+ @answer = answer || ""
85
+ @default = options.key? :default
88
86
  @position = position
89
87
  @done = false
90
88
  end
@@ -1,3 +1,3 @@
1
1
  module VMC
2
- VERSION = "0.4.0.beta.17"
2
+ VERSION = "0.4.0.beta.18"
3
3
  end
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: 62196417
4
+ hash: 62196423
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
9
  - 0
10
10
  - beta
11
- - 17
12
- version: 0.4.0.beta.17
11
+ - 18
12
+ version: 0.4.0.beta.18
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-07-14 00:00:00 Z
20
+ date: 2012-07-15 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: 7
236
+ hash: 5
237
237
  segments:
238
238
  - 0
239
239
  - 4
240
- - 4
241
- version: 0.4.4
240
+ - 5
241
+ version: 0.4.5
242
242
  type: :runtime
243
243
  version_requirements: *id013
244
244
  - !ruby/object:Gem::Dependency
@@ -249,12 +249,12 @@ dependencies:
249
249
  requirements:
250
250
  - - ~>
251
251
  - !ruby/object:Gem::Version
252
- hash: 21
252
+ hash: 27
253
253
  segments:
254
254
  - 0
255
255
  - 3
256
- - 3
257
- version: 0.3.3
256
+ - 4
257
+ version: 0.3.4
258
258
  type: :runtime
259
259
  version_requirements: *id014
260
260
  - !ruby/object:Gem::Dependency