vmc 0.4.0.beta.79 → 0.4.0.beta.80

Sign up to get free protection for your applications and to get access to all the features.
@@ -104,23 +104,27 @@ module VMC
104
104
  with_progress("Creating domain #{c(name, :name)}") do
105
105
  domain.create!
106
106
  end
107
+
108
+ domain
107
109
  end
108
110
 
109
111
 
110
112
  desc "Add a domain to a space"
111
113
  group :domains
112
- input(:domain, :argument => :optional,
113
- :from_given => by_name("domain"),
114
- :desc => "Domain to add") {
115
- ask "Which domain?", :choices => client.current_organization.domains,
116
- :display => proc(&:name)
117
- }
114
+ input :name, :argument => :required,
115
+ :desc => "Domain to add"
118
116
  input :space, :from_given => by_name("space"),
119
117
  :default => proc { client.current_space },
120
118
  :desc => "Space to add the domain to"
121
119
  def add_domain
122
120
  space = input[:space]
123
- domain = input[:domain]
121
+ name = input[:name].sub(/^\*\./, "")
122
+
123
+ org = space.organization
124
+
125
+ domain =
126
+ org.domains.find { |d| d.name == name } ||
127
+ invoke(:create_domain, :org => org, :name => name)
124
128
 
125
129
  with_progress("Adding #{c(domain.name, :name)} to #{c(space.name, :name)}") do
126
130
  space.add_domain(domain)
@@ -1,3 +1,3 @@
1
1
  module VMC
2
- VERSION = "0.4.0.beta.79"
2
+ VERSION = "0.4.0.beta.80"
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: 3707128965
4
+ hash: 2565518183
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
9
  - 0
10
10
  - beta
11
- - 79
12
- version: 0.4.0.beta.79
11
+ - 80
12
+ version: 0.4.0.beta.80
13
13
  platform: ruby
14
14
  authors:
15
15
  - VMware