pi 0.1.29 → 0.1.30

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -41,7 +41,7 @@ _Copyright 2010-2012, Samsung.
41
41
  "highline", "~> 1.6.1"
42
42
  "rest-client", ">= 1.6.1", "< 1.7.0"
43
43
  "terminal-table", "~> 1.4.2"
44
- "interact", "~> 0.4.0"
44
+ "interact", ">= 0.4.7"
45
45
 
46
46
  2.2 Creating Your Own Gem
47
47
 
@@ -196,6 +196,10 @@ module PI::Cli
196
196
  check_status(uuid)
197
197
  end
198
198
  end
199
+
200
+ def check_version_name_valid?(version)
201
+ version.size > 30 ? false : true
202
+ end
199
203
 
200
204
  # only [a-zA-Z0-9] for project name and app name (size <=18)
201
205
  def check_name_valid?(name)
@@ -281,18 +281,20 @@ module PI::Cli::Command
281
281
  targets = client.usable_dns_target(dnsid)
282
282
  targets.each do |t|
283
283
  t[:records].each do |v|
284
- i = 0
285
- record_info.push({ :id => v[:id],:targetName => t[:targetName],:view => v[:view]}) if not t[:records].empty?
286
- i = i + 1
284
+ record_info.push({ :id => v[:id],:targetName => t[:targetName],:view => v[:view]})
287
285
  end
288
286
  end
289
- record_info_table = table do |t|
287
+ if record_info.empty?
288
+ err"No dns record"
289
+ else
290
+ record_info_table = table do |t|
290
291
  t.headings = 'Record ID', 'Target Name', 'View Name'
291
292
  record_info.each do |s|
292
293
  t << [s[:id],s[:targetName], s[:view]]
293
294
  end
294
295
  end
295
296
  display record_info_table
297
+ end
296
298
  end
297
299
 
298
300
  private
@@ -189,6 +189,7 @@ module PI::Cli::Command
189
189
  end
190
190
 
191
191
  if version
192
+ err "Invalid version name length. The max length of name is 30" unless check_version_name_valid?(version)
192
193
  tmp = client.project_binary_existed(projectid, version)
193
194
  err "Version '#{version}' already exists." if tmp.include?("true")
194
195
  end
@@ -209,6 +210,7 @@ module PI::Cli::Command
209
210
  unless version
210
211
  loop{
211
212
  version = ask "Please enter the version"
213
+ err "Invalid version name length. The max length of version name is 30" unless check_version_name_valid?(version)
212
214
  tmp = client.project_binary_existed(projectid, version)
213
215
  if tmp.include?("true")
214
216
  display "Version '#{version}' already exists."
@@ -130,7 +130,7 @@ module PI::Cli
130
130
 
131
131
  while true
132
132
  prompt(question, options)
133
- ok, res = new_answered(read_line(options), options)
133
+ ok, res = multi_answered(read_line(options), options)
134
134
  return res if ok
135
135
  end
136
136
  end
@@ -191,7 +191,7 @@ module PI::Cli
191
191
  end
192
192
  end
193
193
 
194
- def new_answered(ans, options)
194
+ def multi_answered(ans, options)
195
195
  print "\n"
196
196
 
197
197
  if ans.empty?
@@ -231,10 +231,16 @@ module PI::Cli
231
231
  matches_list = matches.collect { |m|
232
232
  show_choice(m, options)
233
233
  }.join " or "
234
-
235
- puts "Please disambiguate: #{matches_list}?"
236
-
237
- [false, nil]
234
+ matches = matches.collect { |m|
235
+ show_choice(m, options)
236
+ }
237
+ if matches.include?(ans)
238
+ [true, ans]
239
+ else
240
+ puts "Please disambiguate: #{matches_list}?"
241
+ [false, nil]
242
+ end
243
+
238
244
  else
239
245
  puts "Unknown answer, please try again!"
240
246
  [false, nil]
data/lib/cli/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module PI
2
2
  module Cli
3
- VERSION = '0.1.29'
3
+ VERSION = '0.1.30'
4
4
  end
5
5
  end
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: 33
4
+ hash: 39
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 29
10
- version: 0.1.29
9
+ - 30
10
+ version: 0.1.30
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-09-09 00:00:00 Z
18
+ date: 2012-09-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json_pure
@@ -55,14 +55,14 @@ dependencies:
55
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
58
- - - ~>
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
- hash: 15
60
+ hash: 1
61
61
  segments:
62
62
  - 0
63
63
  - 4
64
- - 0
65
- version: 0.4.0
64
+ - 7
65
+ version: 0.4.7
66
66
  type: :runtime
67
67
  version_requirements: *id003
68
68
  - !ruby/object:Gem::Dependency