sonar-client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sonar/cli/cli.rb +30 -1
- data/lib/sonar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dd2ef2da6cb21be5643f246fb559a984400639b
|
4
|
+
data.tar.gz: 1304d5edaaab17637bcbe18362d14b2c23a65581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf3270d0d080e0f39b09501ce6c104a029ea1fa140314af14f6e44a3ed26988edc1b4ae0848fef793887127b67ab25b3975fa394695a15685148c547e779ced2
|
7
|
+
data.tar.gz: 2df2543baa5d5bb6a0e87c52f7f1663392f4cd0cbc16904e26ce814d2b14859c6527c18dc090624d19c2eb1cba2759a06069f639f523bcfcac9fd9e5674b8b20
|
data/Gemfile.lock
CHANGED
data/lib/sonar/cli/cli.rb
CHANGED
@@ -33,7 +33,7 @@ module Sonar
|
|
33
33
|
@query[type.to_sym] = term
|
34
34
|
@query[:limit] = options['record_limit']
|
35
35
|
@client.search(@query).each do |data|
|
36
|
-
print_json(data, options['format'])
|
36
|
+
print_json(cleanup_data(data), options['format'])
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -60,6 +60,35 @@ module Sonar
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
# Clean up whitespace and parse JSON values in responses
|
64
|
+
def cleanup_data(data)
|
65
|
+
ndata = {}
|
66
|
+
if data[0] != 'collection'
|
67
|
+
return data
|
68
|
+
end
|
69
|
+
|
70
|
+
ncoll = []
|
71
|
+
|
72
|
+
data[1].each do |item|
|
73
|
+
nitem = {}
|
74
|
+
item.each_pair do |k,v|
|
75
|
+
|
76
|
+
# Purge whitespace within values
|
77
|
+
nval = v.kind_of?(::String) ? v.strip : v
|
78
|
+
nkey = k.strip
|
79
|
+
|
80
|
+
# Parse JSON values
|
81
|
+
if nval && nval.index('{') == 0
|
82
|
+
nval = JSON.parse(nval) rescue nval
|
83
|
+
end
|
84
|
+
|
85
|
+
nitem[nkey] = nval
|
86
|
+
end
|
87
|
+
ncoll << nitem
|
88
|
+
end
|
89
|
+
[ data[0], ncoll ]
|
90
|
+
end
|
91
|
+
|
63
92
|
# Merge Thor options with those stored in sonar.rc file
|
64
93
|
# where all default options are set.
|
65
94
|
def options
|
data/lib/sonar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonar-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Deardorff & HD Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|