niffler 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 +8 -8
- data/doc/TODO.md +3 -0
- data/lib/niffler.rb +5 -0
- data/lib/niffler/maven.rb +9 -5
- data/lib/niffler/version.rb +1 -1
- data/niffler-0.0.2.gem +0 -0
- data/spec/lib/niffler/maven_spec.rb +75 -23
- metadata +3 -3
- data/niffler-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjNjMmQwMTE4MDhkYmIwMmZlYmRkOTk3Y2ZmNmQ3MjE1ZTQ1Y2QwMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGE5NWQ0MzVmY2FmMmNhZDUxOTIyOTIyM2MzZmQ1ZmQxZjc3MTU3NQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjcwNmM4Zjk4MTc0MDdiYzE4MTRlZTc3M2FmNDQwMjkxODQwYjZiMDlmMTAx
|
10
|
+
NWZlNjgyOTgyMjQ4ZjU0YThlYmQyYjUwMDYyZjBkZDJjNjA0OGU3YjVhNTY1
|
11
|
+
M2M1NDM2MDlkZTU0MTM4NjEwY2FiMzZjNmI4M2NkOTI2Y2VlN2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjNmMGE5NTg3OTAzMWE0YjFhZTcwYjhhMDkxMGU0MGI2MjFiODQyZGI1Yjdl
|
14
|
+
MDBlMzc1MGM0ODUwMzljOWUyYmFjNjYyYzg0Yzc3NDliNGI4ZjBkYWVmOWI4
|
15
|
+
MTk0MjQ1NTA1ZWYzZGEwYWMxMWRiMjhmOWQ4ZmIyZjBlYWQyYzA=
|
data/doc/TODO.md
CHANGED
data/lib/niffler.rb
CHANGED
data/lib/niffler/maven.rb
CHANGED
@@ -80,9 +80,11 @@ class Niffler
|
|
80
80
|
results = []
|
81
81
|
# response docs refers to the portion of the response with the software metadata for each result
|
82
82
|
for r in json["response"]["docs"]
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
unless r.nil?
|
84
|
+
result = Niffler::Maven.new(group: r["g"], artifact: r["a"], version: r["latestVersion"],
|
85
|
+
repository: r["repositoryId"], packaging: r["p"])
|
86
|
+
results << result
|
87
|
+
end # unless r.nil?
|
86
88
|
end # for result
|
87
89
|
|
88
90
|
return results
|
@@ -93,8 +95,10 @@ class Niffler
|
|
93
95
|
# {"responseHeader"=>{"status"=>0, "QTime"=>1, "params"=>{"spellcheck"=>"true", "fl"=>"id,g,a,latestVersion,p,ec,repositoryId,text,timestamp,versionCount", "sort"=>"score desc,timestamp desc,g asc,a asc", "indent"=>"off", "q"=>"guice", "qf"=>"text^20 g^5 a^10", "spellcheck.count"=>"5", "wt"=>"json", "rows"=>"20", "version"=>"2.2", "defType"=>"dismax"}}, "response"=>{"numFound"=>234, "start"=>0, "docs"=>[{"id"=>"com.jolira:guice", "g"=>"com.jolira", "a"=>"guice", "latestVersion"=>"3.0.0", "repositoryId"=>"central", "p"=>"jar", "timestamp"=>1301724755000, "versionCount"=>8, "text"=>["com.jolira", "guice", "-javadoc.jar", "-sources.jar", ".jar", ".pom"], "ec"=>["-javadoc.jar", "-sources.jar", ".jar", ".pom"]}
|
94
96
|
# response docs refers to the portion of the response with the software metadata for each result
|
95
97
|
r = json["response"]["docs"].last
|
96
|
-
|
97
|
-
|
98
|
+
unless r.nil?
|
99
|
+
result = Niffler::Maven.new(group: r["g"], artifact: r["a"], version: r["v"],
|
100
|
+
repository: r["repositoryId"], packaging: r["p"])
|
101
|
+
end
|
98
102
|
return result
|
99
103
|
end # def parse_response
|
100
104
|
end # class Maven
|
data/lib/niffler/version.rb
CHANGED
data/niffler-0.0.2.gem
ADDED
Binary file
|
@@ -3,34 +3,46 @@ require 'json'
|
|
3
3
|
require 'niffler/maven'
|
4
4
|
|
5
5
|
describe Niffler::Maven do
|
6
|
-
describe '#group_query' do
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
describe '#group_query' do
|
7
|
+
context 'with a valid group name' do
|
8
|
+
before do
|
9
|
+
@result = Niffler::Maven.group_query("guice")
|
10
|
+
end # before
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
it 'returns a Niffler::Maven object' do
|
13
|
+
@result.should be_kind_of(Niffler::Maven)
|
14
|
+
end # it
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
it 'returns the group name' do
|
17
|
+
@result.group.should eq("org.apache.servicemix.bundles")
|
18
|
+
end # it
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
it 'returns the artifact name' do
|
21
|
+
@result.artifact.should eq("org.apache.servicemix.bundles.guice")
|
22
|
+
end # it
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
it 'returns the latest version' do
|
25
|
+
@result.version.should eq("3.0_1")
|
26
|
+
end # it
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
it 'returns the repository' do
|
29
|
+
@result.repository.should eq("central")
|
30
|
+
end # it
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
it 'returns the packaging' do
|
33
|
+
@result.packaging.should eq("bundle")
|
34
|
+
end # it
|
35
|
+
end # context
|
36
|
+
|
37
|
+
context 'with a fake group name' do
|
38
|
+
before do
|
39
|
+
@result = Niffler::Maven.group_query("thisisafakegroupname")
|
40
|
+
end # before
|
41
|
+
|
42
|
+
it 'returns nil for a fake name' do
|
43
|
+
@result.should be_nil
|
44
|
+
end # it
|
45
|
+
end # context
|
34
46
|
end # describe
|
35
47
|
|
36
48
|
describe '#groups_query' do
|
@@ -46,6 +58,16 @@ describe Niffler::Maven do
|
|
46
58
|
end # it
|
47
59
|
end # context
|
48
60
|
|
61
|
+
context 'with a fake groups name' do
|
62
|
+
before do
|
63
|
+
@result = Niffler::Maven.groups_query("thisisafakegroupsname")
|
64
|
+
end # before
|
65
|
+
|
66
|
+
it 'returns an empty array for a fake name' do
|
67
|
+
@result.should be_empty
|
68
|
+
end # it
|
69
|
+
end # context
|
70
|
+
|
49
71
|
context 'with a group AND version' do
|
50
72
|
pending "returns correctly when a version is also specified"
|
51
73
|
end # context
|
@@ -70,6 +92,16 @@ describe Niffler::Maven do
|
|
70
92
|
@results.last.should be_kind_of(Niffler::Maven)
|
71
93
|
end # it
|
72
94
|
end # context
|
95
|
+
|
96
|
+
context 'with a fake artifacts name' do
|
97
|
+
before do
|
98
|
+
@result = Niffler::Maven.artifacts_query("thisisafakeartifactsname")
|
99
|
+
end # before
|
100
|
+
|
101
|
+
it 'returns an empty array for a fake name' do
|
102
|
+
@result.should be_empty
|
103
|
+
end # it
|
104
|
+
end # context
|
73
105
|
end # describe
|
74
106
|
|
75
107
|
describe '#artifact_query' do
|
@@ -87,7 +119,7 @@ describe Niffler::Maven do
|
|
87
119
|
end # it
|
88
120
|
|
89
121
|
it 'returns the latest version' do
|
90
|
-
@result.version.should eq("2.
|
122
|
+
@result.version.should eq("2.11.0")
|
91
123
|
end # it
|
92
124
|
|
93
125
|
it 'returns the repository' do
|
@@ -98,6 +130,16 @@ describe Niffler::Maven do
|
|
98
130
|
@result.packaging.should eq("maven-plugin")
|
99
131
|
end # it
|
100
132
|
end # context
|
133
|
+
|
134
|
+
context 'with a fake artifact name' do
|
135
|
+
before do
|
136
|
+
@result = Niffler::Maven.artifact_query("thisisafakeartifactname")
|
137
|
+
end # before
|
138
|
+
|
139
|
+
it 'returns nil for a fake name' do
|
140
|
+
@result.should be_nil
|
141
|
+
end # it
|
142
|
+
end # context
|
101
143
|
end # describe
|
102
144
|
|
103
145
|
describe '#hash_query' do
|
@@ -122,5 +164,15 @@ describe Niffler::Maven do
|
|
122
164
|
@result.packaging.should eq("jar")
|
123
165
|
end # it
|
124
166
|
end # context
|
167
|
+
|
168
|
+
context 'with a fake hash' do
|
169
|
+
before do
|
170
|
+
@result = Niffler::Maven.hash_query("ffffffffffffffffffffffffffffffffffffffff")
|
171
|
+
end
|
172
|
+
|
173
|
+
it "returns empty if it doesn't exist" do
|
174
|
+
@result.should be_nil
|
175
|
+
end # it
|
176
|
+
end # context
|
125
177
|
end # describe hash
|
126
178
|
end # describe Niffler
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: niffler
|
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
|
- Michael Carlson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-client
|
@@ -137,7 +137,7 @@ files:
|
|
137
137
|
- lib/niffler.rb
|
138
138
|
- lib/niffler/maven.rb
|
139
139
|
- lib/niffler/version.rb
|
140
|
-
- niffler-0.0.
|
140
|
+
- niffler-0.0.2.gem
|
141
141
|
- niffler.gemspec
|
142
142
|
- spec/lib/niffler/maven_spec.rb
|
143
143
|
- spec/lib/niffler_spec.rb
|
data/niffler-0.0.1.gem
DELETED
Binary file
|