elasticrepo 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/lib/elasticrepo/indexer.rb +1 -1
- data/lib/elasticrepo/version.rb +1 -1
- data/spec/elasticrepo/indexer_spec.rb +24 -54
- 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: b27a7c15f78466f02c2b2b117beaf7ed865d69f8
|
4
|
+
data.tar.gz: d1d654a66b39aaa4e12084bbb923b095b4856e3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5a00b7158acd0c3f3cd3450747e52a4272738f1a0c9283d8f04f85a7f72d7d679dbbbcfa7f4ca1bec55fca464fe78bdcafee16bc2f7f8bebf7c57efc0d5eb89
|
7
|
+
data.tar.gz: ae49d66407189500ade52c7d9b8458aef0649c8f4f830ba46e1d57270f4a7a557e0e3c1adae068cb40bfd693b7bc89d8e732af343685f2b99a92867e7ec65dcb
|
data/lib/elasticrepo/indexer.rb
CHANGED
data/lib/elasticrepo/version.rb
CHANGED
@@ -1,31 +1,22 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Elasticrepo::Indexer do
|
4
|
-
let(:
|
5
|
-
subject(:
|
4
|
+
let(:elastic_repo) { Elasticrepo::Indexer.new("lapaty") }
|
5
|
+
subject(:import) { elastic_repo.import }
|
6
6
|
|
7
|
-
context "print Elasticrepo::
|
8
|
-
its("
|
9
|
-
its("
|
10
|
-
its("
|
11
|
-
|
12
|
-
its("repos.extracted") { print "#{repos.extracted} \n \n" }
|
13
|
-
its("repos.extracted.class") { print "#{repos.extracted.class} \n \n" }
|
14
|
-
its("repos.extracted.inspect") { print "#{repos.extracted.inspect} \n \n" }
|
7
|
+
context "print Elasticrepo::import instantiation for debugging purposes" do
|
8
|
+
its("elastic_repo") { print "#{elastic_repo} \n \n" }
|
9
|
+
its("elastic_repo.class") { print "#{elastic_repo.class} \n \n" }
|
10
|
+
its("elastic_repo.inspect") { print "#{elastic_repo.inspect} \n \n" }
|
15
11
|
end
|
16
12
|
|
17
13
|
context "print before instance import for debugging purposes" do
|
18
|
-
its("
|
19
|
-
its("
|
20
|
-
its("
|
14
|
+
its("import") { print "import: #{import} \n \n" }
|
15
|
+
its("import.class") { print "import.class: #{import.class} \n \n" }
|
16
|
+
its("import.inspect") { print "import.inspect: #{import.inspect} \n \n" }
|
21
17
|
end
|
22
18
|
|
23
|
-
|
24
|
-
#it { subject.to_json.should include(5392501,"cainlevy","photor") }
|
25
|
-
# its("imported") { print "imported #{imported} \n \n" }
|
26
|
-
#end
|
27
|
-
|
28
|
-
#[{"id":5392501,"owner":"cainlevy","name":"photor","url":"https://api.github.com/repos/cainlevy/photor","description":"Photo Organizer (in Ruby)","created_at":"2012-08-12T22:26:08Z","pushed_at":"2013-02-19T03:11:10Z","organization":"User","full_name":"cainlevy/photor","language":"Ruby","updated_at":"2013-03-13T02:05:33Z"},{"id":612595,"owner":"aino","name":"galleria","url":"https://api.github.com/repos/aino/galleria","description":"The JavaScript Image Gallery","created_at":"2010-04-15T21:11:51Z","pushed_at":"2013-03-01T20:16:55Z","organization":"Organization","full_name":"aino/galleria","language":"JavaScript","updated_at":"2013-04-18T06:30:41Z"}]
|
19
|
+
#[{"id":5392501,"owner":"cainlevy","name":"photor","url":"https://api.github.com/elastic_repo/cainlevy/photor","description":"Photo Organizer (in Ruby)","created_at":"2012-08-12T22:26:08Z","pushed_at":"2013-02-19T03:11:10Z","organization":"User","full_name":"cainlevy/photor","language":"Ruby","updated_at":"2013-03-13T02:05:33Z"},{"id":612595,"owner":"aino","name":"galleria","url":"https://api.github.com/elastic_repo/aino/galleria","description":"The JavaScript Image Gallery","created_at":"2010-04-15T21:11:51Z","pushed_at":"2013-03-01T20:16:55Z","organization":"Organization","full_name":"aino/galleria","language":"JavaScript","updated_at":"2013-04-18T06:30:41Z"}]
|
29
20
|
|
30
21
|
# describe "GET index" do
|
31
22
|
# it "assigns all reports as @reports" do
|
@@ -34,42 +25,21 @@ describe Elasticrepo::Indexer do
|
|
34
25
|
# assigns(:reports).should include(report)
|
35
26
|
# end
|
36
27
|
# end
|
37
|
-
end
|
38
28
|
|
29
|
+
describe "#import" do
|
30
|
+
context "searching" do
|
31
|
+
# see also: https://github.com/ferpetrelli/elasticsearch_tire_test
|
32
|
+
subject { elastic_repo.delete }
|
33
|
+
subject { import }
|
34
|
+
let(:search) { Tire::Search::Search.new("repositories") }
|
39
35
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# @repo_1 = @elasticrepo.create({
|
46
|
-
# :name => "test user",
|
47
|
-
# :age => 25
|
48
|
-
# })
|
49
|
-
# @repo_2 = @elasticrepo.create({
|
50
|
-
# :name => "another name in the spec",
|
51
|
-
# :age => 23
|
52
|
-
# })
|
53
|
-
#
|
54
|
-
# @elasticrepo.all.each do |s|
|
55
|
-
# s.tire.update_index
|
56
|
-
# end
|
57
|
-
# @elasticrepo.tire.index.refresh
|
58
|
-
# end
|
36
|
+
it "find one repo matching" do
|
37
|
+
search.query { string('description:*mage Gall') }
|
38
|
+
search.results.count.should == 1
|
39
|
+
end
|
59
40
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# result = @elasticrepo.user_search(:name => "user")
|
64
|
-
# result.count.should == 1
|
65
|
-
# result.first.name.should == @user_1.name
|
66
|
-
# end
|
41
|
+
its("print search results: ") { print "#{search.results}" }
|
42
|
+
end
|
43
|
+
end
|
67
44
|
|
68
|
-
|
69
|
-
# result = @elasticrepo.user_search(:age => 23)
|
70
|
-
# result.count.should == 1
|
71
|
-
# result.first.age.should == @user_2.age
|
72
|
-
# end
|
73
|
-
# end
|
74
|
-
# end
|
75
|
-
# end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticrepo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca G. Soave
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Feed me.
|