pi 0.1.25 → 0.1.26
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/lib/cli/choose_helper.rb +3 -3
- data/lib/cli/commands/apps.rb +32 -25
- data/lib/cli/commands/dns.rb +29 -14
- data/lib/cli/commands/projects.rb +32 -32
- data/lib/cli/commands/services.rb +3 -3
- data/lib/cli/interact_helper.rb +8 -2
- data/lib/cli/runner.rb +12 -8
- data/lib/cli/usage.rb +8 -7
- data/lib/cli/version.rb +1 -1
- data/lib/pi/client.rb +25 -25
- metadata +4 -4
data/lib/cli/choose_helper.rb
CHANGED
@@ -46,11 +46,11 @@ module PI::Cli
|
|
46
46
|
app = client.apps
|
47
47
|
when "project"
|
48
48
|
useproject = choose_project
|
49
|
-
app = client.apps(useproject[:
|
49
|
+
app = client.apps(useproject[:id])
|
50
50
|
when "target"
|
51
51
|
usetarget = choose_target
|
52
|
-
|
53
|
-
app = client.apps(
|
52
|
+
projectid = 0
|
53
|
+
app = client.apps(projectid, usetarget[:name])
|
54
54
|
else
|
55
55
|
if select_type
|
56
56
|
err "Unknown select type [#{select_type}]"
|
data/lib/cli/commands/apps.rb
CHANGED
@@ -14,11 +14,11 @@ module PI::Cli::Command
|
|
14
14
|
|
15
15
|
def apps
|
16
16
|
client.check_login_status
|
17
|
-
|
17
|
+
projectid = @options[:projectid]
|
18
18
|
target = @options[:target]
|
19
|
-
|
19
|
+
projectid = 0 if projectid == "all" || projectid == nil
|
20
20
|
target = nil if target == "all"
|
21
|
-
app_sum = client.app_sum(
|
21
|
+
app_sum = client.app_sum(projectid, target)
|
22
22
|
total_app = Integer(app_sum[1])
|
23
23
|
return display "No Applications" if total_app == 0
|
24
24
|
pageNum = -1
|
@@ -50,7 +50,7 @@ module PI::Cli::Command
|
|
50
50
|
}
|
51
51
|
pageNum = pageNum.to_i
|
52
52
|
end
|
53
|
-
apps = client.apps(
|
53
|
+
apps = client.apps(projectid, target, pageNum, numPerPage)
|
54
54
|
return display "No Applications" if apps.nil? || apps.empty?
|
55
55
|
return display JSON.pretty_generate(apps) if @options[:json]
|
56
56
|
apps.sort! {|a, b| a[:name] <=> b[:name] }
|
@@ -99,19 +99,32 @@ module PI::Cli::Command
|
|
99
99
|
|
100
100
|
# choose the tag
|
101
101
|
if useproject[:runtime] =~ /^(ruby)/i
|
102
|
-
tags = client.project_tags(useproject[:name])
|
103
|
-
err "No tags!" if tags.nil? || tags.empty?
|
104
|
-
tag = ask "Select Tag", :choices => tags, :indexed => true
|
105
|
-
display "Selected Tag: ",false
|
106
|
-
display "#{tag}"
|
107
102
|
deployType = "git"
|
103
|
+
choices = ["By Tag Name","By Commit ID","Latest Revision"]
|
104
|
+
select_type = ask"Upgrade Type", :choices => choices, :indexed => true
|
105
|
+
case select_type
|
106
|
+
when "By Tag Name"
|
107
|
+
tags = client.project_tags(projectid)
|
108
|
+
err "No tags!" if tags.nil? || tags.empty?
|
109
|
+
tag = ask "Select Tag", :choices => tags, :indexed => true
|
110
|
+
display "Selected Tag: ",false
|
111
|
+
display "#{tag}"
|
112
|
+
display "Branch : Master"
|
113
|
+
when "By Commit ID"
|
114
|
+
commits = client.project_commits_bybranch(projectid)
|
115
|
+
tag = ask "Select Commit ID", :choices => commits.collect { |c| c[:commit] }, :indexed => true
|
116
|
+
when "Latest Revision"
|
117
|
+
tag = ""
|
118
|
+
else
|
119
|
+
err "Invalid Input"
|
120
|
+
end
|
108
121
|
else
|
109
|
-
|
122
|
+
deployType = "binary"
|
123
|
+
binarylist = client.project_binary(projectid)
|
110
124
|
err "No version!" if binarylist.nil? || binarylist.empty?
|
111
125
|
tag = ask "Select Version", :choices => binarylist.collect { |b| b[:versionName] }, :indexed => true
|
112
126
|
display "Selected Version: ",false
|
113
|
-
display "#{tag}"
|
114
|
-
deployType = "binary"
|
127
|
+
display "#{tag}"
|
115
128
|
end
|
116
129
|
# URL combination
|
117
130
|
user = client.user_info
|
@@ -140,19 +153,13 @@ module PI::Cli::Command
|
|
140
153
|
needMonitor = ask "Need monitor?", :default => DEFAULTS["needMonitor"]
|
141
154
|
isDebug = (isDebug == false ? "no" : "yes")
|
142
155
|
needMonitor = (needMonitor == false ? "no" : "yes")
|
143
|
-
# choose the branch
|
144
|
-
branchs = client.project_branchs(useproject[:name])
|
145
|
-
err "No branchs!" if branchs.nil? || branchs.empty?
|
146
|
-
branch = ask "Select Branch", :choices => branchs, :indexed => true, :default => "master"
|
147
|
-
display "Selected Branch: ",false
|
148
|
-
display "#{branch}"
|
149
156
|
|
150
157
|
manifest = {
|
151
158
|
:targetName => target,
|
152
159
|
:name => "#{appname}",
|
153
160
|
:projectName => "#{projectname}",
|
154
161
|
:projectId => "#{projectid}",
|
155
|
-
:branch =>
|
162
|
+
:branch => "master",
|
156
163
|
:url => url,
|
157
164
|
:memory => mem_quota,
|
158
165
|
:instances => instances,
|
@@ -180,7 +187,7 @@ module PI::Cli::Command
|
|
180
187
|
if not result[:text].empty?
|
181
188
|
display "OK".green
|
182
189
|
else
|
183
|
-
display "
|
190
|
+
display "Time out"
|
184
191
|
end
|
185
192
|
else
|
186
193
|
err result[:text]
|
@@ -288,7 +295,7 @@ module PI::Cli::Command
|
|
288
295
|
if not result[:text].empty?
|
289
296
|
display "OK".green
|
290
297
|
else
|
291
|
-
display "
|
298
|
+
display "Time out"
|
292
299
|
end
|
293
300
|
else
|
294
301
|
err result[:text]
|
@@ -301,14 +308,14 @@ module PI::Cli::Command
|
|
301
308
|
app, appid = choose_app_help_target_not_all(appid_or_appname)
|
302
309
|
appid = (appid == nil ? app[:id] : appid)
|
303
310
|
if app[:deployType] == "git"
|
304
|
-
tags = client.project_tags(app[:
|
311
|
+
tags = client.project_tags(app[:projectId])
|
305
312
|
err "No tags!" if tags.nil? || tags.empty?
|
306
313
|
tag = ask "Select Tag", :choices => tags, :indexed => true unless tag
|
307
314
|
err "Don't need update application!" if tag == app[:tag]
|
308
315
|
display "Selected tag: ",false
|
309
316
|
display "#{tag}"
|
310
317
|
else
|
311
|
-
tags = client.project_binary(app[:
|
318
|
+
tags = client.project_binary(app[:projectId])
|
312
319
|
err "No version!" if tags.nil? || tags.empty?
|
313
320
|
tag = ask "Select Version", :choices => tags.collect { |b| b[:versionName] }, :indexed => true unless tag
|
314
321
|
err "Don't need update application!" if tag == app[:tag]
|
@@ -330,7 +337,7 @@ module PI::Cli::Command
|
|
330
337
|
if not result[:text].empty?
|
331
338
|
display "OK".green
|
332
339
|
else
|
333
|
-
display "
|
340
|
+
display "Time out"
|
334
341
|
end
|
335
342
|
else
|
336
343
|
err result[:text]
|
@@ -492,7 +499,7 @@ module PI::Cli::Command
|
|
492
499
|
if not result[:text].empty?
|
493
500
|
display "OK".green
|
494
501
|
else
|
495
|
-
display "
|
502
|
+
display "Time out"
|
496
503
|
end
|
497
504
|
else
|
498
505
|
err result[:text]
|
data/lib/cli/commands/dns.rb
CHANGED
@@ -11,13 +11,17 @@ module PI::Cli::Command
|
|
11
11
|
dns = client.app_dns(appid)
|
12
12
|
return display JSON.pretty_generate(dns) if @options[:json]
|
13
13
|
return display "No DNS!" if dns.nil? || dns.empty?
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
t << s
|
18
|
-
end
|
14
|
+
display "Mapped DNS Name:"
|
15
|
+
dns.each do |s|
|
16
|
+
display "#{s}"
|
19
17
|
end
|
20
|
-
|
18
|
+
# dns_table = table do |t|
|
19
|
+
# t.headings = 'Mapped DNS Name'
|
20
|
+
# dns.each do |s|
|
21
|
+
# t << s
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# display dns_table
|
21
25
|
end
|
22
26
|
|
23
27
|
def map_dns(appid_or_appname=nil)
|
@@ -93,8 +97,21 @@ module PI::Cli::Command
|
|
93
97
|
display dns_table
|
94
98
|
end
|
95
99
|
|
100
|
+
def zones
|
101
|
+
zones = client.dns_zone_list
|
102
|
+
return display JSON.pretty_generate(zones) if @options[:json]
|
103
|
+
return display "No DNS!" if zones.nil? || zones.empty?
|
104
|
+
zones_table = table do |t|
|
105
|
+
t.headings = 'ID', 'Name'
|
106
|
+
zones.each do |s|
|
107
|
+
t << [s[:id], s[:name]]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
display zones_table
|
111
|
+
end
|
112
|
+
|
96
113
|
def create_dns(dnsname=nil)
|
97
|
-
|
114
|
+
projectid = @options[:projectid]
|
98
115
|
description = @options[:desc]
|
99
116
|
zoneid = @options[:zoneid]
|
100
117
|
dns_zone = client.dns_zone_list
|
@@ -107,12 +124,10 @@ module PI::Cli::Command
|
|
107
124
|
err"The dns zone id is not exist!" if zoneid_flag != true
|
108
125
|
end
|
109
126
|
projects = client.projects
|
110
|
-
projectname = ask"Project name", :choices => projects.collect { |p| p[:name] }, :indexed => true unless
|
111
|
-
projectid = nil
|
127
|
+
projectname = ask"Project name", :choices => projects.collect { |p| p[:name] }, :indexed => true unless projectid
|
112
128
|
projects.each do |p|
|
113
129
|
projectid = p[:id] if p[:name] == projectname
|
114
130
|
end
|
115
|
-
err "Invild project" if projectid.nil?
|
116
131
|
unless zoneid
|
117
132
|
zonename = ask"Select dns zone", :choices => dns_zone.collect { |d| d[:name] }, :indexed => true
|
118
133
|
dns_zone.each do |d|
|
@@ -161,20 +176,20 @@ module PI::Cli::Command
|
|
161
176
|
unless dnsid
|
162
177
|
dnsid = choose_dnsid
|
163
178
|
end
|
164
|
-
targets = client.
|
179
|
+
targets = client.usable_dns_target(dnsid)
|
165
180
|
target = ask"Select target", :choices => targets.collect { |t| t[:targetName] }, :indexed => true
|
166
181
|
continents = client.dns_continents
|
167
182
|
tmp = continents.values
|
168
183
|
tmp.sort! {|a, b| a <=> b }
|
169
184
|
continent = ask"Select continent", :choices => tmp.collect { |t| t }, :indexed => true
|
170
185
|
display "Select continent: #{continent}"
|
171
|
-
continent = continents.
|
186
|
+
continent = continents.invert["#{continent}"]
|
172
187
|
countries = client.dns_country(continent)
|
173
188
|
tmp = countries.values
|
174
189
|
tmp.sort! {|a, b| a <=> b }
|
175
190
|
country = ask"Select country", :choices => tmp.collect { |t| t }, :indexed => true
|
176
191
|
display "Select country: #{country}"
|
177
|
-
country = countries.
|
192
|
+
country = countries.invert["#{country}"]
|
178
193
|
manifest = {
|
179
194
|
:continentName => continent,
|
180
195
|
:countryCode => country
|
@@ -188,7 +203,7 @@ module PI::Cli::Command
|
|
188
203
|
dnsid = choose_dnsid
|
189
204
|
end
|
190
205
|
|
191
|
-
targets = client.
|
206
|
+
targets = client.usable_dns_target(dnsid)
|
192
207
|
target = ask"Select target", :choices => targets.collect { |t| t[:targetName] }, :indexed => true
|
193
208
|
choices = Array.new
|
194
209
|
record = Array.new
|
@@ -50,9 +50,9 @@ module PI::Cli::Command
|
|
50
50
|
projects.sort! {|a, b| a[:name] <=> b[:name] }
|
51
51
|
display "\n"
|
52
52
|
projects_table = table do |t|
|
53
|
-
t.headings = 'Name', 'Runtime', 'Framework', 'Git Type','GitUrl', 'Description'
|
53
|
+
t.headings = 'ID', 'Name', 'Runtime', 'Framework', 'Git Type','GitUrl', 'Description'
|
54
54
|
projects.each do |project|
|
55
|
-
t << [project[:name], project[:runtime], project[:framework], project[:repositoryType], project[:gitUrl], project[:description]]
|
55
|
+
t << [project[:id], project[:name], project[:runtime], project[:framework], project[:repositoryType], project[:gitUrl], project[:description]]
|
56
56
|
end
|
57
57
|
end
|
58
58
|
display projects_table
|
@@ -141,13 +141,13 @@ module PI::Cli::Command
|
|
141
141
|
display "OK".green
|
142
142
|
end
|
143
143
|
|
144
|
-
def delete_project(
|
144
|
+
def delete_project(projectid=nil)
|
145
145
|
client.check_login_status
|
146
|
-
unless
|
146
|
+
unless projectid
|
147
147
|
useproject = choose_project
|
148
|
-
|
148
|
+
projectid = useproject[:id]
|
149
149
|
end
|
150
|
-
display "Deleting project
|
150
|
+
display "Deleting project: ",false
|
151
151
|
|
152
152
|
t = Thread.new do
|
153
153
|
loop do
|
@@ -157,12 +157,12 @@ module PI::Cli::Command
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
-
client.delete_project(
|
160
|
+
client.delete_project(projectid)
|
161
161
|
Thread.kill(t)
|
162
162
|
display 'OK'.green
|
163
163
|
end
|
164
164
|
|
165
|
-
def upload(
|
165
|
+
def upload(projectid=nil)
|
166
166
|
client.check_login_status
|
167
167
|
path = @options[:path]
|
168
168
|
if path
|
@@ -174,22 +174,22 @@ module PI::Cli::Command
|
|
174
174
|
err "No Projects" if projects.nil? || projects.empty?
|
175
175
|
java_projects = projects.delete_if{ |p| p[:runtime] =~ /^(ruby)/i}
|
176
176
|
java_projects.sort! {|a, b| a[:name] <=> b[:name] }
|
177
|
-
if
|
177
|
+
if projectid
|
178
178
|
flag = nil
|
179
179
|
java_projects.each do |j|
|
180
|
-
flag = true if
|
180
|
+
flag = true if projectid == j[:id]
|
181
181
|
end
|
182
|
-
err "The project is not found or not a java project!
|
182
|
+
err "The project is not found or not a java project! " unless flag
|
183
183
|
else
|
184
184
|
project = ask "Select Project", :choices => java_projects.collect { |j| j[:name] }, :indexed => true
|
185
185
|
display "Selected Project: ",false
|
186
186
|
display "#{project}"
|
187
187
|
end
|
188
188
|
project = client.project_search(project)
|
189
|
-
|
189
|
+
projectid = project[:id]
|
190
190
|
|
191
191
|
if version
|
192
|
-
tmp = client.project_binary_existed(
|
192
|
+
tmp = client.project_binary_existed(projectid, version)
|
193
193
|
err "Version '#{version}' already exists." if tmp.include?("true")
|
194
194
|
end
|
195
195
|
|
@@ -209,7 +209,7 @@ module PI::Cli::Command
|
|
209
209
|
unless version
|
210
210
|
loop{
|
211
211
|
version = ask "Please enter the version"
|
212
|
-
tmp = client.project_binary_existed(
|
212
|
+
tmp = client.project_binary_existed(projectid, version)
|
213
213
|
if tmp.include?("true")
|
214
214
|
display "Version '#{version}' already exists."
|
215
215
|
version =nil
|
@@ -223,7 +223,7 @@ module PI::Cli::Command
|
|
223
223
|
description = ask "Please enter in the description", :default => nil unless description
|
224
224
|
upload_file = File.new(path, 'rb')
|
225
225
|
manifest = {
|
226
|
-
:
|
226
|
+
:projectId => "#{projectid}",
|
227
227
|
:fileWAR => upload_file,
|
228
228
|
:versionName => "#{version}",
|
229
229
|
:description => "#{description}"
|
@@ -243,13 +243,13 @@ module PI::Cli::Command
|
|
243
243
|
display 'OK'.green
|
244
244
|
end
|
245
245
|
|
246
|
-
def delete_binary(
|
246
|
+
def delete_binary(projectid=nil)
|
247
247
|
client.check_login_status
|
248
|
-
unless
|
248
|
+
unless projectid
|
249
249
|
useproject = choose_project
|
250
|
-
|
250
|
+
projectid = useproject[:id]
|
251
251
|
end
|
252
|
-
binary = client.project_binary(
|
252
|
+
binary = client.project_binary(projectid)
|
253
253
|
err "No binary!" if binary.nil? || binary.empty?
|
254
254
|
binaryname = ask"Select Binary", :choices => binary.collect { |b| b[:versionName] }, :indexed => true
|
255
255
|
display "Selected Binary: ",false
|
@@ -262,13 +262,13 @@ module PI::Cli::Command
|
|
262
262
|
display 'OK'.green
|
263
263
|
end
|
264
264
|
|
265
|
-
def project_events(
|
265
|
+
def project_events(projectid=nil)
|
266
266
|
client.check_login_status
|
267
|
-
unless
|
267
|
+
unless projectid
|
268
268
|
useproject = choose_project
|
269
|
-
|
269
|
+
projectid = useproject[:id]
|
270
270
|
end
|
271
|
-
events = client.project_events(
|
271
|
+
events = client.project_events(projectid)
|
272
272
|
return display JSON.pretty_generate(events || []) if @options[:json]
|
273
273
|
return display "No Events." if events.empty?
|
274
274
|
events_table = table do |t|
|
@@ -280,13 +280,13 @@ module PI::Cli::Command
|
|
280
280
|
display events_table
|
281
281
|
end
|
282
282
|
|
283
|
-
def project_tags(
|
283
|
+
def project_tags(projectid=nil)
|
284
284
|
client.check_login_status
|
285
|
-
unless
|
285
|
+
unless projectid
|
286
286
|
useproject = choose_project
|
287
|
-
|
287
|
+
projectid = useproject[:id]
|
288
288
|
end
|
289
|
-
tags ||= client.project_tags(
|
289
|
+
tags ||= client.project_tags(projectid)
|
290
290
|
return display JSON.pretty_generate(tags || []) if @options[:json]
|
291
291
|
return display "No Tags." if tags.size == 0
|
292
292
|
tags_table = table do |t|
|
@@ -297,20 +297,20 @@ module PI::Cli::Command
|
|
297
297
|
display tags_table
|
298
298
|
end
|
299
299
|
|
300
|
-
def project_commits(
|
300
|
+
def project_commits(projectid=nil)
|
301
301
|
client.check_login_status
|
302
|
-
unless
|
302
|
+
unless projectid
|
303
303
|
useproject = choose_project
|
304
|
-
|
304
|
+
projectid = useproject[:id]
|
305
305
|
end
|
306
|
-
tags = client.project_tags(
|
306
|
+
tags = client.project_tags(projectid)
|
307
307
|
return display JSON.pretty_generate(tags || []) if @options[:json]
|
308
308
|
return display "No Commits" if tags.nil? || tags.empty?
|
309
309
|
tag = ask "Select Tag", :choices => tags, :indexed => true
|
310
310
|
display "Selected Tag: ",false
|
311
311
|
display "#{tag}"
|
312
312
|
|
313
|
-
commits = client.
|
313
|
+
commits = client.project_commits_bytag(projectid,tag)
|
314
314
|
commits.sort! {|a, b| a[:date] <=> b[:date] }
|
315
315
|
return display JSON.pretty_generate(commits || []) if @options[:json]
|
316
316
|
return display "No Commits" if commits.nil? || commits.empty?
|
@@ -60,7 +60,7 @@ module PI::Cli::Command
|
|
60
60
|
if not result[:text].empty?
|
61
61
|
display "OK".green
|
62
62
|
else
|
63
|
-
display "
|
63
|
+
display "Time out"
|
64
64
|
end
|
65
65
|
else
|
66
66
|
err result[:text]
|
@@ -173,7 +173,7 @@ module PI::Cli::Command
|
|
173
173
|
else
|
174
174
|
serviceid = choose_serviceid
|
175
175
|
end
|
176
|
-
targets = client.
|
176
|
+
targets = client.usable_service_target(serviceid)
|
177
177
|
err "No targets" if targets.nil? || targets.empty?
|
178
178
|
if target
|
179
179
|
target_flag = false
|
@@ -234,7 +234,7 @@ module PI::Cli::Command
|
|
234
234
|
if not result[:text].empty?
|
235
235
|
display "OK".green
|
236
236
|
else
|
237
|
-
display "
|
237
|
+
display "Time out"
|
238
238
|
end
|
239
239
|
else
|
240
240
|
err result[:text]
|
data/lib/cli/interact_helper.rb
CHANGED
@@ -209,12 +209,18 @@ module PI::Cli
|
|
209
209
|
res = res.push(choices.to_a[ans.to_i - 1])
|
210
210
|
[true, res]
|
211
211
|
#add
|
212
|
-
elsif choices and ans =~ /^\s*(\d+,)*\d+\s*$/ and \
|
212
|
+
# elsif choices and ans =~ /^\s*(\d+,)*\d+\s*$/ and \
|
213
|
+
elsif choices and ans =~ /^\s*(\d+,)+\d+\s*$/ and \
|
213
214
|
ans.to_i - 1 >= 0
|
214
215
|
ans = ans.split(",")
|
215
216
|
res = Array.new
|
216
217
|
ans.each do |a|
|
217
|
-
|
218
|
+
if a.to_i - 1 < choices.to_a.size
|
219
|
+
res.push(choices[a.to_i - 1])
|
220
|
+
else
|
221
|
+
puts "Unknown answer, please try again!"
|
222
|
+
return [false, nil]
|
223
|
+
end
|
218
224
|
end
|
219
225
|
# res = ["rails.samsungpaas.comrailstest.samsungpaas.com"]
|
220
226
|
[true, res]
|
data/lib/cli/runner.rb
CHANGED
@@ -33,7 +33,7 @@ class PI::Cli::Runner
|
|
33
33
|
opts.on('--path PATH') { |path| @options[:path] = path }
|
34
34
|
opts.on('--ver VERSION') { |version| @options[:ver] = version }
|
35
35
|
opts.on('--desc DESC') { |desc| @options[:desc] = desc }
|
36
|
-
opts.on('--
|
36
|
+
opts.on('--projectid ID') { |id| @options[:projectid] = id }
|
37
37
|
opts.on('--target TARG') { |targ| @options[:target] = targ }
|
38
38
|
opts.on('--instance N') { |inst| @options[:instance] = inst }
|
39
39
|
opts.on('--type TYPE') { |type| @options[:type] = type }
|
@@ -182,11 +182,11 @@ class PI::Cli::Runner
|
|
182
182
|
set_cmd(:projects, :create_project, @args.size == 1 ? 1 : 0)
|
183
183
|
|
184
184
|
when 'delete-project'
|
185
|
-
usage('pi delete-project [
|
185
|
+
usage('pi delete-project [projectid]')
|
186
186
|
set_cmd(:projects, :delete_project, @args.size == 1 ? 1 : 0)
|
187
187
|
|
188
188
|
when 'upload'
|
189
|
-
usage('pi upload [
|
189
|
+
usage('pi upload [projectid] [--path PATH] [--ver VERSION] [--desc DESC]')
|
190
190
|
if @args.size == 1
|
191
191
|
set_cmd(:projects, :upload, 1)
|
192
192
|
else
|
@@ -198,15 +198,15 @@ class PI::Cli::Runner
|
|
198
198
|
set_cmd(:projects, :delete_binary, @args.size == 1 ? 1 : 0)
|
199
199
|
|
200
200
|
when 'project-events'
|
201
|
-
usage('pi project-events [
|
201
|
+
usage('pi project-events [projectid]')
|
202
202
|
set_cmd(:projects, :project_events, @args.size == 1 ? 1 : 0)
|
203
203
|
|
204
204
|
when 'project-tags'
|
205
|
-
usage('pi project-tags [
|
205
|
+
usage('pi project-tags [projectid]')
|
206
206
|
set_cmd(:projects, :project_tags, @args.size == 1 ? 1 : 0)
|
207
207
|
|
208
208
|
when 'project-commits'
|
209
|
-
usage('pi project-commits [
|
209
|
+
usage('pi project-commits [projectid]')
|
210
210
|
set_cmd(:projects, :project_commits, @args.size == 1 ? 1 : 0)
|
211
211
|
|
212
212
|
###############################################################################
|
@@ -214,7 +214,7 @@ class PI::Cli::Runner
|
|
214
214
|
###############################################################################
|
215
215
|
|
216
216
|
when 'apps'
|
217
|
-
usage('pi apps [--
|
217
|
+
usage('pi apps [--projectid ID] [--target TARG]')
|
218
218
|
set_cmd(:apps, :apps)
|
219
219
|
|
220
220
|
when 'create-app'
|
@@ -332,9 +332,13 @@ class PI::Cli::Runner
|
|
332
332
|
when 'dns'
|
333
333
|
usage('pi dns')
|
334
334
|
set_cmd(:dns, :dns)
|
335
|
+
|
336
|
+
when 'zones'
|
337
|
+
usage('pi zones')
|
338
|
+
set_cmd(:dns, :zones)
|
335
339
|
|
336
340
|
when 'create-dns'
|
337
|
-
usage('pi create-dns [dnsname] [--zoneid ID] [--
|
341
|
+
usage('pi create-dns [dnsname] [--zoneid ID] [--projectid ID] [--desc DESC]')
|
338
342
|
set_cmd(:dns, :create_dns, @args.size == 1 ? 1 : 0)
|
339
343
|
|
340
344
|
when 'delete-dns'
|
data/lib/cli/usage.rb
CHANGED
@@ -41,14 +41,14 @@ Currently available pi commands are:
|
|
41
41
|
Project
|
42
42
|
projects List created projects
|
43
43
|
create-project [project] Create a new project
|
44
|
-
delete-project [
|
45
|
-
project-events [
|
46
|
-
project-tags [
|
47
|
-
project-commits [
|
48
|
-
upload [
|
44
|
+
delete-project [projectid] Delete the project
|
45
|
+
project-events [projectid] List the event info for the project
|
46
|
+
project-tags [projectid] List the tags for the project
|
47
|
+
project-commits [projectid] List the commit log for the project
|
48
|
+
upload [projectid][--path,--ver,--desc] Upload the war package for java project
|
49
49
|
|
50
50
|
Application
|
51
|
-
apps [--
|
51
|
+
apps [--projectid,--target] List deployed applications
|
52
52
|
create-app [appname] Create a new application
|
53
53
|
delete-app [appid] Delete the application
|
54
54
|
delete-app <appname> <--target TARGET> Delete the application
|
@@ -97,7 +97,8 @@ Currently available pi commands are:
|
|
97
97
|
unmap-dns [appid] [--dns DNS] Unmap the urls for the application
|
98
98
|
unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
|
99
99
|
dns List the dns
|
100
|
-
|
100
|
+
zones List the dns zones
|
101
|
+
create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
|
101
102
|
register-dns [dnsid] Register to target
|
102
103
|
deregister-dns [dnsid] Deregister to target
|
103
104
|
delete-dns [dnsid] Delete the dns
|
data/lib/cli/version.rb
CHANGED
data/lib/pi/client.rb
CHANGED
@@ -81,7 +81,7 @@ class PI::Client
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def github_info
|
84
|
-
json_get("#{PI::USER_PATH}/github")
|
84
|
+
json_get("#{PI::USER_PATH}/repository/bind?type=github")
|
85
85
|
end
|
86
86
|
|
87
87
|
def targets
|
@@ -93,7 +93,7 @@ class PI::Client
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def github(manifest={})
|
96
|
-
json_post("#{PI::USER_PATH}/
|
96
|
+
json_post("#{PI::USER_PATH}/repository/bind?type=github",manifest)
|
97
97
|
end
|
98
98
|
|
99
99
|
def runtimes
|
@@ -113,19 +113,19 @@ class PI::Client
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def projects(pageNum=-1, numPerPage=-1)
|
116
|
-
json_get("#{PI::PROJECTS_PATH}
|
116
|
+
json_get("#{PI::PROJECTS_PATH}?pageNum=#{pageNum}&numPerPage=#{numPerPage}")
|
117
117
|
end
|
118
118
|
|
119
119
|
def project_sum
|
120
|
-
http_get("#{PI::PROJECTS_PATH}/
|
120
|
+
http_get("#{PI::PROJECTS_PATH}/sum")
|
121
121
|
end
|
122
122
|
|
123
123
|
def create_project(name, manifest={})
|
124
124
|
status, body, headers = json_post("#{PI::PROJECT_PATH}/", manifest)
|
125
125
|
end
|
126
126
|
|
127
|
-
def delete_project(
|
128
|
-
http_delete("#{PI::PROJECT_PATH}/#{
|
127
|
+
def delete_project(projectid)
|
128
|
+
http_delete("#{PI::PROJECT_PATH}/#{projectid}",'application/json')
|
129
129
|
end
|
130
130
|
|
131
131
|
def upload(manifest={})
|
@@ -137,36 +137,36 @@ class PI::Client
|
|
137
137
|
http_delete("#{PI::PROJECT_PATH}/binary/#{binaryid}",'application/json')
|
138
138
|
end
|
139
139
|
|
140
|
-
def project_events(
|
141
|
-
json_get("#{PI::PROJECT_PATH}/events/#{
|
140
|
+
def project_events(projectid)
|
141
|
+
json_get("#{PI::PROJECT_PATH}/events/#{projectid}")
|
142
142
|
end
|
143
143
|
|
144
|
-
def project_tags(
|
145
|
-
json_get("#{PI::PROJECT_PATH}/tags/#{
|
144
|
+
def project_tags(projectid)
|
145
|
+
json_get("#{PI::PROJECT_PATH}/tags/#{projectid}")
|
146
146
|
end
|
147
147
|
|
148
|
-
def
|
149
|
-
json_get("#{PI::PROJECT_PATH}/commitinfo/#{
|
148
|
+
def project_commits_bytag(projectid,tag)
|
149
|
+
json_get("#{PI::PROJECT_PATH}/commitinfo/#{projectid}/#{tag}")
|
150
150
|
end
|
151
151
|
|
152
|
-
def
|
153
|
-
json_get("#{PI::PROJECT_PATH}/
|
152
|
+
def project_commits_bybranch(projectid,branch="master")
|
153
|
+
json_get("#{PI::PROJECT_PATH}/commitinfo/branch/#{projectid}/#{branch}")
|
154
154
|
end
|
155
155
|
|
156
|
-
def
|
157
|
-
|
156
|
+
def project_binary(projectid)
|
157
|
+
json_get("#{PI::PROJECT_PATH}/binary/list/#{projectid}")
|
158
158
|
end
|
159
|
-
|
160
|
-
def
|
161
|
-
|
159
|
+
|
160
|
+
def project_binary_existed(projectid,versionname)
|
161
|
+
http_get("#{PI::PROJECT_PATH}/binary/existed/#{projectid}/#{versionname}")
|
162
162
|
end
|
163
163
|
|
164
|
-
def apps(
|
165
|
-
json_get("#{PI::PROJECT_PATH}/apps?
|
164
|
+
def apps(projectid=0, targetname=nil, pageNum=-1, numPerPage=-1)
|
165
|
+
json_get("#{PI::PROJECT_PATH}/apps?projectId=#{projectid}&targetName=#{targetname}&pageNum=#{pageNum}&numPerPage=#{numPerPage}")
|
166
166
|
end
|
167
167
|
|
168
|
-
def app_sum(
|
169
|
-
http_get("#{PI::PROJECT_PATH}/apps/sum?
|
168
|
+
def app_sum(projectid=0, targetname=nil)
|
169
|
+
http_get("#{PI::PROJECT_PATH}/apps/sum?projectId=#{projectid}&targetName=#{targetname}")
|
170
170
|
end
|
171
171
|
|
172
172
|
#####################################################
|
@@ -285,7 +285,7 @@ class PI::Client
|
|
285
285
|
http_delete("#{PI::SERVICE_PATH}/#{serviceid}", 'application/json')
|
286
286
|
end
|
287
287
|
|
288
|
-
def
|
288
|
+
def usable_service_target(serviceid)
|
289
289
|
json_get("#{PI::SERVICE_PATH}/target/usable/#{serviceid}")
|
290
290
|
end
|
291
291
|
|
@@ -341,7 +341,7 @@ class PI::Client
|
|
341
341
|
http_delete("#{PI::DNS_PATH}/#{dnsid}",'application/json')
|
342
342
|
end
|
343
343
|
|
344
|
-
def
|
344
|
+
def usable_dns_target(dnsid)
|
345
345
|
json_get("#{PI::DNS_PATH}/dnstarget/#{dnsid}")
|
346
346
|
end
|
347
347
|
|
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: 47
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 26
|
10
|
+
version: 0.1.26
|
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-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json_pure
|