pi 0.1.27 → 0.1.28
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.
- data/README +253 -213
- data/lib/cli/choose_helper.rb +20 -25
- data/lib/cli/commands/apps.rb +31 -35
- data/lib/cli/commands/dns.rb +37 -13
- data/lib/cli/commands/projects.rb +2 -2
- data/lib/cli/commands/services.rb +8 -8
- data/lib/cli/commands/user.rb +5 -2
- data/lib/cli/runner.rb +17 -12
- data/lib/cli/usage.rb +4 -4
- data/lib/cli/version.rb +1 -1
- data/lib/pi/client.rb +12 -10
- metadata +4 -4
data/lib/cli/commands/user.rb
CHANGED
@@ -57,8 +57,11 @@ module PI::Cli::Command
|
|
57
57
|
client.check_login_status
|
58
58
|
user = client.user_info
|
59
59
|
github_info = client.github_info
|
60
|
-
|
61
|
-
|
60
|
+
if github_info.nil?
|
61
|
+
github_info = Hash.new
|
62
|
+
github_info[:name] = "null"
|
63
|
+
github_info[:email] = "null"
|
64
|
+
end
|
62
65
|
user_merge =user.merge(github_info)
|
63
66
|
return display JSON.pretty_generate(user_merge) if @options[:json]
|
64
67
|
return display 'No user info' if user.empty?
|
data/lib/cli/runner.rb
CHANGED
@@ -32,10 +32,10 @@ class PI::Cli::Runner
|
|
32
32
|
opts.on('--email EMAIL') { |email| @options[:email] = email }
|
33
33
|
opts.on('--path PATH') { |path| @options[:path] = path }
|
34
34
|
opts.on('--ver VERSION') { |version| @options[:ver] = version }
|
35
|
-
opts.on('--desc DESC')
|
35
|
+
opts.on('--desc [DESC]') { |desc| @options[:desc] = desc || ""}
|
36
36
|
opts.on('--projectid ID') { |id| @options[:projectid] = id }
|
37
37
|
opts.on('--target TARG') { |targ| @options[:target] = targ }
|
38
|
-
opts.on('--instance N') { |inst| @options[:instance] = inst }
|
38
|
+
opts.on('--instance N', Integer) { |inst| @options[:instance] = inst }
|
39
39
|
opts.on('--type TYPE') { |type| @options[:type] = type }
|
40
40
|
opts.on('--value VALUE') { |value| @options[:value] = value }
|
41
41
|
opts.on('--service SERVICE') { |service| @options[:service] = service }
|
@@ -47,7 +47,7 @@ class PI::Cli::Runner
|
|
47
47
|
opts.on('--country COUNTRY') { |country| @options[:country] = country }
|
48
48
|
opts.on('--recordid ID') { |id| @options[:recordid] = id }
|
49
49
|
opts.on('--graceful') { @options[:graceful] = true }
|
50
|
-
opts.on('--lazy') { @options[:lazy] = true }
|
50
|
+
# opts.on('--lazy') { @options[:lazy] = true }
|
51
51
|
# generic tracing and debugging
|
52
52
|
opts.on('-t [TKEY]') { |tkey| @options[:trace] = tkey || true }
|
53
53
|
opts.on('--trace [TKEY]') { |tkey| @options[:trace] = tkey || true }
|
@@ -238,7 +238,7 @@ class PI::Cli::Runner
|
|
238
238
|
set_cmd(:apps, :stop_app, @args.size == 1 ? 1 : 0)
|
239
239
|
|
240
240
|
when 'restart-app'
|
241
|
-
usage('pi restart-app [appid] [--graceful]
|
241
|
+
usage('pi restart-app [appid] [--graceful] or pi restart-app <appname> <--target TARGET> [--graceful]')
|
242
242
|
set_cmd(:apps, :restart_app, @args.size == 1 ? 1 : 0)
|
243
243
|
|
244
244
|
when 'scale-app'
|
@@ -246,7 +246,7 @@ class PI::Cli::Runner
|
|
246
246
|
set_cmd(:apps, :scale_app, @args.size == 1 ? 1 : 0)
|
247
247
|
|
248
248
|
when 'update-app'
|
249
|
-
usage('pi update-app [appid] [--ver VERSION] [--graceful]
|
249
|
+
usage('pi update-app [appid] [--ver VERSION] [--graceful] or pi update-app <appname> <--target TARGET> [--ver VERSION][--graceful] ')
|
250
250
|
set_cmd(:apps, :update_app, @args.size == 1 ? 1 : 0)
|
251
251
|
|
252
252
|
when 'status'
|
@@ -282,11 +282,11 @@ class PI::Cli::Runner
|
|
282
282
|
set_cmd(:services, :app_service, @args.size == 1 ? 1 : 0)
|
283
283
|
|
284
284
|
when 'bind-service'
|
285
|
-
usage('pi bind-service [appid] [--service SERVICE] [--graceful]
|
285
|
+
usage('pi bind-service [appid] [--service SERVICE] [--graceful] or pi bind-service <appname> <--target TARGET> [--service SERVICE] [--graceful]')
|
286
286
|
set_cmd(:services, :bind_service, @args.size == 1 ? 1 : 0)
|
287
287
|
|
288
288
|
when 'unbind-service'
|
289
|
-
usage('pi unbind-service [appid] [--service SERVICE] [--graceful]
|
289
|
+
usage('pi unbind-service [appid] [--service SERVICE] [--graceful] or pi unbind-service <appname> <--target TARGET> [--service SERVICE] [--graceful]')
|
290
290
|
set_cmd(:services, :unbind_service, @args.size == 1 ? 1 : 0)
|
291
291
|
|
292
292
|
when 'services'
|
@@ -386,8 +386,8 @@ class PI::Cli::Runner
|
|
386
386
|
@usage_error
|
387
387
|
end
|
388
388
|
|
389
|
-
def run
|
390
|
-
|
389
|
+
def run
|
390
|
+
|
391
391
|
trap('TERM') { print "\nTerminated\n"; exit(false)}
|
392
392
|
|
393
393
|
parse_options!
|
@@ -400,9 +400,9 @@ class PI::Cli::Runner
|
|
400
400
|
|
401
401
|
# local shopts=$-
|
402
402
|
# set -o noglob
|
403
|
-
#
|
403
|
+
# system('set -o noglob')
|
404
404
|
# Kernel.exec('sudo set -o noglob')
|
405
|
-
# `set -o noglob`
|
405
|
+
# `set -o noglob`
|
406
406
|
parse_command!
|
407
407
|
# system('set +o noglob')
|
408
408
|
# set +o noglob
|
@@ -426,7 +426,12 @@ class PI::Cli::Runner
|
|
426
426
|
puts("\n")
|
427
427
|
puts(basic_usage)
|
428
428
|
@exit_status = false
|
429
|
-
rescue OptionParser::MissingArgument => e
|
429
|
+
rescue OptionParser::MissingArgument => e
|
430
|
+
puts(e.message.red)
|
431
|
+
puts("\n")
|
432
|
+
puts(basic_usage)
|
433
|
+
@exit_status = false
|
434
|
+
rescue OptionParser::InvalidArgument => e
|
430
435
|
puts(e.message.red)
|
431
436
|
puts("\n")
|
432
437
|
puts(basic_usage)
|
data/lib/cli/usage.rb
CHANGED
@@ -59,13 +59,13 @@ Currently available pi commands are:
|
|
59
59
|
stop-app --graceful Stop the application in a graceful mode
|
60
60
|
restart-app [appid] Restart the application
|
61
61
|
restart-app <appname> <--target TARGET> Restart the application
|
62
|
-
restart-app --graceful
|
62
|
+
restart-app --graceful Restart the application in a graceful mode
|
63
63
|
scale-app [appid] [--instance N] Scale the application instances up or down
|
64
64
|
scale-app <appname> <--target TARGET> [--instance N] Scale the application instances up or down
|
65
65
|
scale-app --graceful Scale the application instances in a graceful mode
|
66
66
|
update-app [appid] [--ver VERSION] Update the application
|
67
67
|
update-app <appname> <--target TARGET> [--ver VERSION] Update the application
|
68
|
-
update-app --graceful
|
68
|
+
update-app --graceful Update the application in a graceful mode
|
69
69
|
status [appid] Display resource usage for the application
|
70
70
|
status <appname> <--target TARGET> Display resource usage for the application
|
71
71
|
app-env [appid] Display the environments for the application
|
@@ -84,10 +84,10 @@ Currently available pi commands are:
|
|
84
84
|
app-service <appname> <--target TARGET> Display the binded services for the application
|
85
85
|
bind-service [appid] [--service SERVICE] Bind the services for the application
|
86
86
|
bind-service <appname> <--target TARGET> [--service] Bind the services for the application
|
87
|
-
bind-service --graceful
|
87
|
+
bind-service --graceful Bind the services for the application in a graceful mode
|
88
88
|
unbind-service [appid] [--service SERVICE] Unbind the services for the application
|
89
89
|
unbind-service <appname> <--target TARGET> [--service] Unbind the services for the application
|
90
|
-
unbind-service --graceful
|
90
|
+
unbind-service --graceful Unbind the services for the application in a graceful mode
|
91
91
|
services List dedicated services
|
92
92
|
service [serviceid] List the connection info for the service
|
93
93
|
export-service [serviceid] Export dedicated service url
|
data/lib/cli/version.rb
CHANGED
data/lib/pi/client.rb
CHANGED
@@ -179,6 +179,8 @@ class PI::Client
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def app_search(targetname, appname)
|
182
|
+
targetname = uri_encode(targetname)
|
183
|
+
appname = uri_encode(appname)
|
182
184
|
json_get("#{PI::APP_PATH}/search/#{targetname}/#{appname}")
|
183
185
|
end
|
184
186
|
|
@@ -210,16 +212,16 @@ class PI::Client
|
|
210
212
|
json_post("#{PI::APP_PATH}/#{appid}/stop?graceful=#{graceful}",manifest={})
|
211
213
|
end
|
212
214
|
|
213
|
-
def restart_app(appid, graceful
|
214
|
-
json_post("#{PI::APP_PATH}/#{appid}/restart?graceful=#{graceful}
|
215
|
+
def restart_app(appid, graceful)
|
216
|
+
json_post("#{PI::APP_PATH}/#{appid}/restart?graceful=#{graceful}",manifest={})
|
215
217
|
end
|
216
218
|
|
217
|
-
def scale_app(appid, instance
|
218
|
-
json_post("#{PI::APP_PATH}/#{appid}/scale?instance=#{instance}
|
219
|
+
def scale_app(appid, instance)
|
220
|
+
json_post("#{PI::APP_PATH}/#{appid}/scale?instance=#{instance}", manifest={})
|
219
221
|
end
|
220
222
|
|
221
|
-
def update_app(appid, tag, graceful
|
222
|
-
json_post("#{PI::APP_PATH}/#{appid}/rollback/#{tag}?graceful=#{graceful}
|
223
|
+
def update_app(appid, tag, graceful)
|
224
|
+
json_post("#{PI::APP_PATH}/#{appid}/rollback/#{tag}?graceful=#{graceful}", manifest={})
|
223
225
|
end
|
224
226
|
|
225
227
|
def status(appid)
|
@@ -265,12 +267,12 @@ class PI::Client
|
|
265
267
|
json_get("#{PI::APP_PATH}/#{appid}/service/bind")
|
266
268
|
end
|
267
269
|
|
268
|
-
def bind_service(appid,
|
269
|
-
json_post("#{PI::APP_PATH}/#{appid}/service/bind
|
270
|
+
def bind_service(appid, manifest={})
|
271
|
+
json_post("#{PI::APP_PATH}/#{appid}/service/bind",manifest)
|
270
272
|
end
|
271
273
|
|
272
|
-
def unbind_service(appid, servicename
|
273
|
-
http_delete("#{PI::APP_PATH}/#{appid}/service/unbind/#{servicename}
|
274
|
+
def unbind_service(appid, servicename)
|
275
|
+
http_delete("#{PI::APP_PATH}/#{appid}/service/unbind/#{servicename}",'application/json')
|
274
276
|
end
|
275
277
|
|
276
278
|
def services
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 35
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 28
|
10
|
+
version: 0.1.28
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Samsung
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-08-
|
18
|
+
date: 2012-08-31 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json_pure
|