139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# File 'lib/appfront/command/clusters.rb', line 139
def self.create(args, opts)
exit 1 unless opts[:provider]
exit 1 unless opts[:provider] == 'amazon' or opts[:provider] == 'digitalocean' or opts[:provider] == 'manual'
if args.count == 3
name = args[0]
type = args[1]
region = args[2]
elsif args.count == 2
type = args[0]
region = args[1]
elsif args.count == 1
name = args[0]
type = 'manual'
region = 'manual'
end
tier = opts[:provider]
if type == 'manual'
spinner "Creating new manual cluster ..." do
@info = api.post "/provider/#{tier}/cluster/#{region}/#{type}" unless name
@info = api.post "/provider/#{tier}/cluster/#{region}/#{type}", name: name if name
end
else
spinner "Creating new cluster on region #{region}..." do
@info = api.post "/provider/#{tier}/cluster/#{region}/#{type}" unless name
@info = api.post "/provider/#{tier}/cluster/#{region}/#{type}", name: name if name
end
end
print "\n"
end
|