elasticrepo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/elasticrepo/extractor.rb +20 -0
- data/lib/elasticrepo/indexer.rb +45 -0
- data/lib/elasticrepo/repo_subset.rb +19 -0
- data/lib/elasticrepo/version.rb +3 -0
- data/lib/elasticrepo.rb +17 -0
- data/lib/elasticsearch.log +0 -0
- data/spec/elasticrepo/extractor_spec.rb +48 -0
- data/spec/elasticrepo/indexer_spec.rb +84 -0
- data/spec/elasticrepo/repo_subset_spec.rb +25 -0
- data/spec/elasticrepo_spec.rb +15 -0
- data/spec/fixtures/repositories.json +170 -0
- data/spec/fixtures/repository.json +105 -0
- data/spec/spec_helper.rb +27 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8b757b4619457708dd825292994a1a71a1d75e05
|
4
|
+
data.tar.gz: 348e2ef8c2e9db818445267dfc48509c2871863d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 37b440592b2d52686ed66b7355be190448389dbfb4d0cdd9c656f7a2910b20a2f5c032cd18d062ea4a0bfb2ff130c5074482936aaa197f3bc61685fcfcb4d078
|
7
|
+
data.tar.gz: a919fb005ac00870648a08325e496c90f0054117f415f2a291dc8d25bb768740f61a77543e50ad012556506f17abdfe7083b077679648304320bbca6daca1ce5
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Elasticrepo
|
2
|
+
class Extractor
|
3
|
+
|
4
|
+
# GET /users/:user/starred
|
5
|
+
# ex: /users/lapaty/starred --> array of hashes
|
6
|
+
|
7
|
+
# ex:
|
8
|
+
# results = Elasticrepo::Extractor.new("lapaty")
|
9
|
+
# results.extract
|
10
|
+
|
11
|
+
def initialize(owner)
|
12
|
+
@repos = Octokit.starred(owner)
|
13
|
+
end
|
14
|
+
|
15
|
+
def extract
|
16
|
+
@repos.map!{|repo|Elasticrepo::RepoSubset.new(repo)}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Elasticrepo
|
2
|
+
class Indexer
|
3
|
+
attr_reader :results
|
4
|
+
|
5
|
+
def initialize owner
|
6
|
+
extractor = Elasticrepo::Extractor.new(owner)
|
7
|
+
@results = extractor.extract
|
8
|
+
end
|
9
|
+
|
10
|
+
def import
|
11
|
+
Tire.index 'repository' do
|
12
|
+
|
13
|
+
#its(:full_name) { should eq("twitter/bootstrap") }
|
14
|
+
|
15
|
+
# Create the index with proper mapping (if not exists already)
|
16
|
+
#
|
17
|
+
create :mappings => {
|
18
|
+
:question => {
|
19
|
+
:properties => {
|
20
|
+
:id => { :type => 'integer', :analyzer => 'keyword' },
|
21
|
+
:owner => { :type => 'string', :analyzer => 'keyword' },
|
22
|
+
:name => { :type => 'string', :analyzer => 'keyword' },
|
23
|
+
#:full_name => { :type => 'string', :analyzer => 'keyword' },
|
24
|
+
:url => { :type => 'string', :analyzer => 'snowball' },
|
25
|
+
:description => { :type => 'string', :analyzer => 'snowball' },
|
26
|
+
:organization => { :type => 'string', :analyzer => 'keyword' },
|
27
|
+
:language => { :type => 'string', :analyzer => 'keyword' },
|
28
|
+
:created_at => { :type => 'date', :analyzer => 'keyword' },
|
29
|
+
:pushed_at => { :type => 'date', :analyzer => 'keyword' },
|
30
|
+
:updated_at => { :type => 'date', :analyzer => 'keyword' }
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
# Import documents
|
36
|
+
import @results
|
37
|
+
|
38
|
+
# Refresh the index for immediate searching
|
39
|
+
#
|
40
|
+
refresh
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Elasticrepo
|
2
|
+
class RepoSubset
|
3
|
+
attr_reader :id, :owner, :name, :url, :description, :created_at, :pushed_at,
|
4
|
+
:organization, :full_name, :language, :updated_at
|
5
|
+
def initialize(attributes)
|
6
|
+
@id = attributes["id"]
|
7
|
+
@owner = attributes["owner"]["login"]
|
8
|
+
@name = attributes["name"]
|
9
|
+
@url = attributes["url"]
|
10
|
+
@description = attributes["description"]
|
11
|
+
@created_at = attributes["created_at"]
|
12
|
+
@pushed_at = attributes["pushed_at"]
|
13
|
+
@organization = attributes["owner"]["type"]
|
14
|
+
@full_name = attributes["full_name"]
|
15
|
+
@language = attributes["language"]
|
16
|
+
@updated_at = attributes["updated_at"]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/elasticrepo.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require "yajl"
|
2
|
+
require "tire"
|
3
|
+
|
4
|
+
module Elasticrepo
|
5
|
+
|
6
|
+
autoload :RepoSubset, "elasticrepo/repo_subset"
|
7
|
+
autoload :Extractor, "elasticrepo/extractor"
|
8
|
+
autoload :Indexer, "elasticrepo/indexer"
|
9
|
+
autoload :Version, "elasticrepo/version"
|
10
|
+
|
11
|
+
Tire::Configuration.url "http://localhost:9200"
|
12
|
+
Tire::Configuration.logger 'elasticsearch.log', :level => 'debug'
|
13
|
+
|
14
|
+
#class ElasticrepoError < StandardError
|
15
|
+
#end
|
16
|
+
|
17
|
+
end
|
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
# API ref.: GET /users/:user/starred
|
3
|
+
# http://developer.github.com/v3/repos/
|
4
|
+
# https://github.com/pengwynn/octokit/blob/master/lib/octokit/client/users.rb
|
5
|
+
|
6
|
+
describe Elasticrepo::Extractor do
|
7
|
+
let(:fixture_repos) { Yajl::Parser.parse(fixture("repositories.json").read) }
|
8
|
+
# when online, works with "live" GitrHub V3 APIs ( uncomment following line )
|
9
|
+
# subject(:live_repos) { Elasticrepo::Extractor.new("lapaty").repositories }
|
10
|
+
|
11
|
+
# when offline, works with local fixtures ( uncomment following line )
|
12
|
+
subject(:live_repos) { fixture_repos }
|
13
|
+
|
14
|
+
describe "#new" do
|
15
|
+
context "get a list of two repos starred by user" do
|
16
|
+
its(:size) { should eq(2) }
|
17
|
+
end
|
18
|
+
context "compare 'fixtures' with 'live github APIs'" do
|
19
|
+
# check well forming data set
|
20
|
+
it { fixture_repos.should be_a(Array) }
|
21
|
+
it { live_repos.should be_a(Array) }
|
22
|
+
it { fixture_repos.should_not be_empty }
|
23
|
+
it { live_repos.should_not be_empty }
|
24
|
+
# compare fixture to live API V3
|
25
|
+
its(["id"]) { "#{live_repos[1]['id']}".should eq("#{fixture_repos[1]['id']}") }
|
26
|
+
its(["owner"]) { "#{live_repos[1]['id']}".should eq("#{fixture_repos[1]['id']}") }
|
27
|
+
its(["name"]) { "#{live_repos[1]['id']}".should eq("#{fixture_repos[1]['id']}") }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#extract" do
|
32
|
+
subject(:subset) { Elasticrepo::Extractor.new("lapaty").extract }
|
33
|
+
|
34
|
+
context "get list of repos starred by user" do
|
35
|
+
its("checks extracted id field") { "#{live_repos[0]['id']}".should eq("#{subset[0].id}") }
|
36
|
+
its("checks extracted id field") { "#{live_repos[1]['id']}".should eq("#{subset[1].id}") }
|
37
|
+
|
38
|
+
its("checks extracted owner field") { "#{live_repos[0]['owner']['login']}".should eq("#{subset[0].owner}") }
|
39
|
+
its("checks extracted owner field") { "#{live_repos[1]['owner']['login']}".should eq("#{subset[1].owner}") }
|
40
|
+
|
41
|
+
its("checks extracted name field") { "#{live_repos[0]['name']}".should eq("#{subset[0].name}") }
|
42
|
+
its("checks extracted name field") { "#{live_repos[1]['name']}".should eq("#{subset[1].name}") }
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Elasticrepo::Indexer do
|
4
|
+
|
5
|
+
let(:indexer) { Elasticrepo::Indexer.new("lapaty") }
|
6
|
+
|
7
|
+
describe "#import" do
|
8
|
+
subject { indexer.import }
|
9
|
+
|
10
|
+
it { print "indexer.inspect : #{indexer.inspect}" }
|
11
|
+
it { print "indexer.results : #{indexer.results}" }
|
12
|
+
end
|
13
|
+
|
14
|
+
# describe "GET index" do
|
15
|
+
# it "assigns all reports as @reports" do
|
16
|
+
# report = Report.create! valid_attributes
|
17
|
+
# get :index, {}, valid_session
|
18
|
+
# assigns(:reports).should include(report)
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# describe "#search" do
|
25
|
+
# before(:each) do
|
26
|
+
# @elasticrepo = Elasticrepo::Indexer.tire.index.delete
|
27
|
+
# @elasticrepo = Elasticrepo::Indexer.create_elasticsearch_index
|
28
|
+
|
29
|
+
# @repo_1 = @elasticrepo.create({
|
30
|
+
# :name => "test user",
|
31
|
+
# :age => 25
|
32
|
+
# })
|
33
|
+
# @repo_2 = @elasticrepo.create({
|
34
|
+
# :name => "another name in the spec",
|
35
|
+
# :age => 23
|
36
|
+
# })
|
37
|
+
#
|
38
|
+
# @elasticrepo.all.each do |s|
|
39
|
+
# s.tire.update_index
|
40
|
+
# end
|
41
|
+
# @elasticrepo.tire.index.refresh
|
42
|
+
# end
|
43
|
+
|
44
|
+
# context "Searching" do
|
45
|
+
# describe "users" do
|
46
|
+
# it "should filter users by name" do
|
47
|
+
# result = @elasticrepo.user_search(:name => "user")
|
48
|
+
# result.count.should == 1
|
49
|
+
# result.first.name.should == @user_1.name
|
50
|
+
# end
|
51
|
+
|
52
|
+
# it "should filter users by age" do
|
53
|
+
# result = @elasticrepo.user_search(:age => 23)
|
54
|
+
# result.count.should == 1
|
55
|
+
# result.first.age.should == @user_2.age
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
# end
|
60
|
+
#end
|
61
|
+
|
62
|
+
#--------------------------------------------------------------------------------
|
63
|
+
# context "get list of repos starred by a user" do
|
64
|
+
# describe "#new" do # Elasticrepo::Extractor.new("lapaty").repositories
|
65
|
+
# let(:parsed ) { Yajl::Parser.parse(fixture("repositories.json").read) }
|
66
|
+
# subject(:ockto_get) { Elasticrepo::Extractor.new("lapaty").repositories }
|
67
|
+
|
68
|
+
# # just to show the content while rspec'ing
|
69
|
+
# it "print" do
|
70
|
+
# print "parsed: #{parsed[1]["id"]} \n + \n +\n"
|
71
|
+
# print "ockto_get: #{ockto_get[1]["id"]} \n + \n +\n"
|
72
|
+
# end
|
73
|
+
|
74
|
+
# it { parsed.should be_a(Array) }
|
75
|
+
# it { ockto_get.should be_a(Array) }
|
76
|
+
# it { parsed.should_not be_empty }
|
77
|
+
# it { ockto_get.should_not be_empty }
|
78
|
+
|
79
|
+
# its(:size) { should eq(2) }
|
80
|
+
# its(["id"]) { "#{ockto_get[1]['id']}".should eq("#{parsed[1]['id']}") }
|
81
|
+
# its(["owner"]) { "#{ockto_get[1]['id']}".should eq("#{parsed[1]['id']}") }
|
82
|
+
# its(["name"]) { "#{ockto_get[1]['id']}".should eq("#{parsed[1]['id']}") }
|
83
|
+
# end
|
84
|
+
# end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
# API ref.: GET /repos/:owner/:repo
|
4
|
+
# http://developer.github.com/v3/repos/
|
5
|
+
|
6
|
+
describe Elasticrepo::RepoSubset do
|
7
|
+
let(:parsed) { Yajl::Parser.parse(fixture("repository.json").read) }
|
8
|
+
subject { Elasticrepo::RepoSubset.new(parsed) }
|
9
|
+
|
10
|
+
context "checks extracted fields" do
|
11
|
+
its(:id) { should eq(2126244) }
|
12
|
+
its(:owner) { should eq("twitter") }
|
13
|
+
its(:name) { should eq("bootstrap") }
|
14
|
+
its(:url){ should eq("https://api.github.com/repos/twitter/bootstrap") }
|
15
|
+
its(:description) { should eq("Sleek, intuitive, and powerful front-end framework for faster and easier web development.") }
|
16
|
+
its(:created_at) { should eq("2011-07-29T21:19:00Z") }
|
17
|
+
its(:pushed_at) { should eq("2013-04-13T03:56:36Z") }
|
18
|
+
its(:organization) { should eq("Organization") }
|
19
|
+
its(:full_name) { should eq("twitter/bootstrap") }
|
20
|
+
its(:language) { should eq("JavaScript") }
|
21
|
+
its(:updated_at) { should eq("2013-04-13T19:12:09Z") }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Elasticrepo do
|
4
|
+
|
5
|
+
# describe "#starred_repos_by_user" do
|
6
|
+
# # https://github.com/pengwynn/octokit/blob/master/lib/octokit/client/users.rb
|
7
|
+
# # GET /users/:user/starred
|
8
|
+
# let(:parsed) { Yajl::Parser.parse(fixture("repositories.json").read) }
|
9
|
+
# subject { Elasticrepo.starred_repos_by_user(owner) }
|
10
|
+
#
|
11
|
+
# end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,170 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 5392501,
|
4
|
+
"name": "photor",
|
5
|
+
"full_name": "cainlevy/photor",
|
6
|
+
"owner": {
|
7
|
+
"login": "cainlevy",
|
8
|
+
"id": 4449,
|
9
|
+
"avatar_url": "https://secure.gravatar.com/avatar/2573ddee29779e76b7da7d3c2c9ff18d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
|
10
|
+
"gravatar_id": "2573ddee29779e76b7da7d3c2c9ff18d",
|
11
|
+
"url": "https://api.github.com/users/cainlevy",
|
12
|
+
"html_url": "https://github.com/cainlevy",
|
13
|
+
"followers_url": "https://api.github.com/users/cainlevy/followers",
|
14
|
+
"following_url": "https://api.github.com/users/cainlevy/following",
|
15
|
+
"gists_url": "https://api.github.com/users/cainlevy/gists{/gist_id}",
|
16
|
+
"starred_url": "https://api.github.com/users/cainlevy/starred{/owner}{/repo}",
|
17
|
+
"subscriptions_url": "https://api.github.com/users/cainlevy/subscriptions",
|
18
|
+
"organizations_url": "https://api.github.com/users/cainlevy/orgs",
|
19
|
+
"repos_url": "https://api.github.com/users/cainlevy/repos",
|
20
|
+
"events_url": "https://api.github.com/users/cainlevy/events{/privacy}",
|
21
|
+
"received_events_url": "https://api.github.com/users/cainlevy/received_events",
|
22
|
+
"type": "User"
|
23
|
+
},
|
24
|
+
"private": false,
|
25
|
+
"html_url": "https://github.com/cainlevy/photor",
|
26
|
+
"description": "Photo Organizer (in Ruby)",
|
27
|
+
"fork": false,
|
28
|
+
"url": "https://api.github.com/repos/cainlevy/photor",
|
29
|
+
"forks_url": "https://api.github.com/repos/cainlevy/photor/forks",
|
30
|
+
"keys_url": "https://api.github.com/repos/cainlevy/photor/keys{/key_id}",
|
31
|
+
"collaborators_url": "https://api.github.com/repos/cainlevy/photor/collaborators{/collaborator}",
|
32
|
+
"teams_url": "https://api.github.com/repos/cainlevy/photor/teams",
|
33
|
+
"hooks_url": "https://api.github.com/repos/cainlevy/photor/hooks",
|
34
|
+
"issue_events_url": "https://api.github.com/repos/cainlevy/photor/issues/events{/number}",
|
35
|
+
"events_url": "https://api.github.com/repos/cainlevy/photor/events",
|
36
|
+
"assignees_url": "https://api.github.com/repos/cainlevy/photor/assignees{/user}",
|
37
|
+
"branches_url": "https://api.github.com/repos/cainlevy/photor/branches{/branch}",
|
38
|
+
"tags_url": "https://api.github.com/repos/cainlevy/photor/tags{/tag}",
|
39
|
+
"blobs_url": "https://api.github.com/repos/cainlevy/photor/git/blobs{/sha}",
|
40
|
+
"git_tags_url": "https://api.github.com/repos/cainlevy/photor/git/tags{/sha}",
|
41
|
+
"git_refs_url": "https://api.github.com/repos/cainlevy/photor/git/refs{/sha}",
|
42
|
+
"trees_url": "https://api.github.com/repos/cainlevy/photor/git/trees{/sha}",
|
43
|
+
"statuses_url": "https://api.github.com/repos/cainlevy/photor/statuses/{sha}",
|
44
|
+
"languages_url": "https://api.github.com/repos/cainlevy/photor/languages",
|
45
|
+
"stargazers_url": "https://api.github.com/repos/cainlevy/photor/stargazers",
|
46
|
+
"contributors_url": "https://api.github.com/repos/cainlevy/photor/contributors",
|
47
|
+
"subscribers_url": "https://api.github.com/repos/cainlevy/photor/subscribers",
|
48
|
+
"subscription_url": "https://api.github.com/repos/cainlevy/photor/subscription",
|
49
|
+
"commits_url": "https://api.github.com/repos/cainlevy/photor/commits{/sha}",
|
50
|
+
"git_commits_url": "https://api.github.com/repos/cainlevy/photor/git/commits{/sha}",
|
51
|
+
"comments_url": "https://api.github.com/repos/cainlevy/photor/comments{/number}",
|
52
|
+
"issue_comment_url": "https://api.github.com/repos/cainlevy/photor/issues/comments/{number}",
|
53
|
+
"contents_url": "https://api.github.com/repos/cainlevy/photor/contents/{+path}",
|
54
|
+
"compare_url": "https://api.github.com/repos/cainlevy/photor/compare/{base}...{head}",
|
55
|
+
"merges_url": "https://api.github.com/repos/cainlevy/photor/merges",
|
56
|
+
"archive_url": "https://api.github.com/repos/cainlevy/photor/{archive_format}{/ref}",
|
57
|
+
"downloads_url": "https://api.github.com/repos/cainlevy/photor/downloads",
|
58
|
+
"issues_url": "https://api.github.com/repos/cainlevy/photor/issues{/number}",
|
59
|
+
"pulls_url": "https://api.github.com/repos/cainlevy/photor/pulls{/number}",
|
60
|
+
"milestones_url": "https://api.github.com/repos/cainlevy/photor/milestones{/number}",
|
61
|
+
"notifications_url": "https://api.github.com/repos/cainlevy/photor/notifications{?since,all,participating}",
|
62
|
+
"labels_url": "https://api.github.com/repos/cainlevy/photor/labels{/name}",
|
63
|
+
"created_at": "2012-08-12T22:26:08Z",
|
64
|
+
"updated_at": "2013-03-13T02:05:33Z",
|
65
|
+
"pushed_at": "2013-02-19T03:11:10Z",
|
66
|
+
"git_url": "git://github.com/cainlevy/photor.git",
|
67
|
+
"ssh_url": "git@github.com:cainlevy/photor.git",
|
68
|
+
"clone_url": "https://github.com/cainlevy/photor.git",
|
69
|
+
"svn_url": "https://github.com/cainlevy/photor",
|
70
|
+
"homepage": null,
|
71
|
+
"size": 312,
|
72
|
+
"watchers_count": 4,
|
73
|
+
"language": "Ruby",
|
74
|
+
"has_issues": true,
|
75
|
+
"has_downloads": true,
|
76
|
+
"has_wiki": true,
|
77
|
+
"forks_count": 0,
|
78
|
+
"mirror_url": null,
|
79
|
+
"open_issues_count": 0,
|
80
|
+
"forks": 0,
|
81
|
+
"open_issues": 0,
|
82
|
+
"watchers": 4,
|
83
|
+
"master_branch": "master",
|
84
|
+
"default_branch": "master"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"id": 612595,
|
88
|
+
"name": "galleria",
|
89
|
+
"full_name": "aino/galleria",
|
90
|
+
"owner": {
|
91
|
+
"login": "aino",
|
92
|
+
"id": 245015,
|
93
|
+
"avatar_url": "https://secure.gravatar.com/avatar/e7269063b056757594eea1e8f4c8bcb1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png",
|
94
|
+
"gravatar_id": "e7269063b056757594eea1e8f4c8bcb1",
|
95
|
+
"url": "https://api.github.com/users/aino",
|
96
|
+
"html_url": "https://github.com/aino",
|
97
|
+
"followers_url": "https://api.github.com/users/aino/followers",
|
98
|
+
"following_url": "https://api.github.com/users/aino/following",
|
99
|
+
"gists_url": "https://api.github.com/users/aino/gists{/gist_id}",
|
100
|
+
"starred_url": "https://api.github.com/users/aino/starred{/owner}{/repo}",
|
101
|
+
"subscriptions_url": "https://api.github.com/users/aino/subscriptions",
|
102
|
+
"organizations_url": "https://api.github.com/users/aino/orgs",
|
103
|
+
"repos_url": "https://api.github.com/users/aino/repos",
|
104
|
+
"events_url": "https://api.github.com/users/aino/events{/privacy}",
|
105
|
+
"received_events_url": "https://api.github.com/users/aino/received_events",
|
106
|
+
"type": "Organization"
|
107
|
+
},
|
108
|
+
"private": false,
|
109
|
+
"html_url": "https://github.com/aino/galleria",
|
110
|
+
"description": "The JavaScript Image Gallery",
|
111
|
+
"fork": false,
|
112
|
+
"url": "https://api.github.com/repos/aino/galleria",
|
113
|
+
"forks_url": "https://api.github.com/repos/aino/galleria/forks",
|
114
|
+
"keys_url": "https://api.github.com/repos/aino/galleria/keys{/key_id}",
|
115
|
+
"collaborators_url": "https://api.github.com/repos/aino/galleria/collaborators{/collaborator}",
|
116
|
+
"teams_url": "https://api.github.com/repos/aino/galleria/teams",
|
117
|
+
"hooks_url": "https://api.github.com/repos/aino/galleria/hooks",
|
118
|
+
"issue_events_url": "https://api.github.com/repos/aino/galleria/issues/events{/number}",
|
119
|
+
"events_url": "https://api.github.com/repos/aino/galleria/events",
|
120
|
+
"assignees_url": "https://api.github.com/repos/aino/galleria/assignees{/user}",
|
121
|
+
"branches_url": "https://api.github.com/repos/aino/galleria/branches{/branch}",
|
122
|
+
"tags_url": "https://api.github.com/repos/aino/galleria/tags{/tag}",
|
123
|
+
"blobs_url": "https://api.github.com/repos/aino/galleria/git/blobs{/sha}",
|
124
|
+
"git_tags_url": "https://api.github.com/repos/aino/galleria/git/tags{/sha}",
|
125
|
+
"git_refs_url": "https://api.github.com/repos/aino/galleria/git/refs{/sha}",
|
126
|
+
"trees_url": "https://api.github.com/repos/aino/galleria/git/trees{/sha}",
|
127
|
+
"statuses_url": "https://api.github.com/repos/aino/galleria/statuses/{sha}",
|
128
|
+
"languages_url": "https://api.github.com/repos/aino/galleria/languages",
|
129
|
+
"stargazers_url": "https://api.github.com/repos/aino/galleria/stargazers",
|
130
|
+
"contributors_url": "https://api.github.com/repos/aino/galleria/contributors",
|
131
|
+
"subscribers_url": "https://api.github.com/repos/aino/galleria/subscribers",
|
132
|
+
"subscription_url": "https://api.github.com/repos/aino/galleria/subscription",
|
133
|
+
"commits_url": "https://api.github.com/repos/aino/galleria/commits{/sha}",
|
134
|
+
"git_commits_url": "https://api.github.com/repos/aino/galleria/git/commits{/sha}",
|
135
|
+
"comments_url": "https://api.github.com/repos/aino/galleria/comments{/number}",
|
136
|
+
"issue_comment_url": "https://api.github.com/repos/aino/galleria/issues/comments/{number}",
|
137
|
+
"contents_url": "https://api.github.com/repos/aino/galleria/contents/{+path}",
|
138
|
+
"compare_url": "https://api.github.com/repos/aino/galleria/compare/{base}...{head}",
|
139
|
+
"merges_url": "https://api.github.com/repos/aino/galleria/merges",
|
140
|
+
"archive_url": "https://api.github.com/repos/aino/galleria/{archive_format}{/ref}",
|
141
|
+
"downloads_url": "https://api.github.com/repos/aino/galleria/downloads",
|
142
|
+
"issues_url": "https://api.github.com/repos/aino/galleria/issues{/number}",
|
143
|
+
"pulls_url": "https://api.github.com/repos/aino/galleria/pulls{/number}",
|
144
|
+
"milestones_url": "https://api.github.com/repos/aino/galleria/milestones{/number}",
|
145
|
+
"notifications_url": "https://api.github.com/repos/aino/galleria/notifications{?since,all,participating}",
|
146
|
+
"labels_url": "https://api.github.com/repos/aino/galleria/labels{/name}",
|
147
|
+
"created_at": "2010-04-15T21:11:51Z",
|
148
|
+
"updated_at": "2013-04-14T14:16:08Z",
|
149
|
+
"pushed_at": "2013-03-01T20:16:55Z",
|
150
|
+
"git_url": "git://github.com/aino/galleria.git",
|
151
|
+
"ssh_url": "git@github.com:aino/galleria.git",
|
152
|
+
"clone_url": "https://github.com/aino/galleria.git",
|
153
|
+
"svn_url": "https://github.com/aino/galleria",
|
154
|
+
"homepage": "galleria.io",
|
155
|
+
"size": 404,
|
156
|
+
"watchers_count": 1184,
|
157
|
+
"language": "JavaScript",
|
158
|
+
"has_issues": true,
|
159
|
+
"has_downloads": false,
|
160
|
+
"has_wiki": false,
|
161
|
+
"forks_count": 216,
|
162
|
+
"mirror_url": null,
|
163
|
+
"open_issues_count": 58,
|
164
|
+
"forks": 216,
|
165
|
+
"open_issues": 58,
|
166
|
+
"watchers": 1184,
|
167
|
+
"master_branch": "master",
|
168
|
+
"default_branch": "master"
|
169
|
+
}
|
170
|
+
]
|
@@ -0,0 +1,105 @@
|
|
1
|
+
{
|
2
|
+
|
3
|
+
"id": 2126244,
|
4
|
+
"name": "bootstrap",
|
5
|
+
"full_name": "twitter/bootstrap",
|
6
|
+
"owner": {
|
7
|
+
"login": "twitter",
|
8
|
+
"id": 50278,
|
9
|
+
"avatar_url": "https://secure.gravatar.com/avatar/2f4a8254d032a8ec5e4c48d461e54fcc?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png",
|
10
|
+
"gravatar_id": "2f4a8254d032a8ec5e4c48d461e54fcc",
|
11
|
+
"url": "https://api.github.com/users/twitter",
|
12
|
+
"html_url": "https://github.com/twitter",
|
13
|
+
"followers_url": "https://api.github.com/users/twitter/followers",
|
14
|
+
"following_url": "https://api.github.com/users/twitter/following",
|
15
|
+
"gists_url": "https://api.github.com/users/twitter/gists{/gist_id}",
|
16
|
+
"starred_url": "https://api.github.com/users/twitter/starred{/owner}{/repo}",
|
17
|
+
"subscriptions_url": "https://api.github.com/users/twitter/subscriptions",
|
18
|
+
"organizations_url": "https://api.github.com/users/twitter/orgs",
|
19
|
+
"repos_url": "https://api.github.com/users/twitter/repos",
|
20
|
+
"events_url": "https://api.github.com/users/twitter/events{/privacy}",
|
21
|
+
"received_events_url": "https://api.github.com/users/twitter/received_events",
|
22
|
+
"type": "Organization"
|
23
|
+
},
|
24
|
+
"private": false,
|
25
|
+
"html_url": "https://github.com/twitter/bootstrap",
|
26
|
+
"description": "Sleek, intuitive, and powerful front-end framework for faster and easier web development.",
|
27
|
+
"fork": false,
|
28
|
+
"url": "https://api.github.com/repos/twitter/bootstrap",
|
29
|
+
"forks_url": "https://api.github.com/repos/twitter/bootstrap/forks",
|
30
|
+
"keys_url": "https://api.github.com/repos/twitter/bootstrap/keys{/key_id}",
|
31
|
+
"collaborators_url": "https://api.github.com/repos/twitter/bootstrap/collaborators{/collaborator}",
|
32
|
+
"teams_url": "https://api.github.com/repos/twitter/bootstrap/teams",
|
33
|
+
"hooks_url": "https://api.github.com/repos/twitter/bootstrap/hooks",
|
34
|
+
"issue_events_url": "https://api.github.com/repos/twitter/bootstrap/issues/events{/number}",
|
35
|
+
"events_url": "https://api.github.com/repos/twitter/bootstrap/events",
|
36
|
+
"assignees_url": "https://api.github.com/repos/twitter/bootstrap/assignees{/user}",
|
37
|
+
"branches_url": "https://api.github.com/repos/twitter/bootstrap/branches{/branch}",
|
38
|
+
"tags_url": "https://api.github.com/repos/twitter/bootstrap/tags{/tag}",
|
39
|
+
"blobs_url": "https://api.github.com/repos/twitter/bootstrap/git/blobs{/sha}",
|
40
|
+
"git_tags_url": "https://api.github.com/repos/twitter/bootstrap/git/tags{/sha}",
|
41
|
+
"git_refs_url": "https://api.github.com/repos/twitter/bootstrap/git/refs{/sha}",
|
42
|
+
"trees_url": "https://api.github.com/repos/twitter/bootstrap/git/trees{/sha}",
|
43
|
+
"statuses_url": "https://api.github.com/repos/twitter/bootstrap/statuses/{sha}",
|
44
|
+
"languages_url": "https://api.github.com/repos/twitter/bootstrap/languages",
|
45
|
+
"stargazers_url": "https://api.github.com/repos/twitter/bootstrap/stargazers",
|
46
|
+
"contributors_url": "https://api.github.com/repos/twitter/bootstrap/contributors",
|
47
|
+
"subscribers_url": "https://api.github.com/repos/twitter/bootstrap/subscribers",
|
48
|
+
"subscription_url": "https://api.github.com/repos/twitter/bootstrap/subscription",
|
49
|
+
"commits_url": "https://api.github.com/repos/twitter/bootstrap/commits{/sha}",
|
50
|
+
"git_commits_url": "https://api.github.com/repos/twitter/bootstrap/git/commits{/sha}",
|
51
|
+
"comments_url": "https://api.github.com/repos/twitter/bootstrap/comments{/number}",
|
52
|
+
"issue_comment_url": "https://api.github.com/repos/twitter/bootstrap/issues/comments/{number}",
|
53
|
+
"contents_url": "https://api.github.com/repos/twitter/bootstrap/contents/{+path}",
|
54
|
+
"compare_url": "https://api.github.com/repos/twitter/bootstrap/compare/{base}...{head}",
|
55
|
+
"merges_url": "https://api.github.com/repos/twitter/bootstrap/merges",
|
56
|
+
"archive_url": "https://api.github.com/repos/twitter/bootstrap/{archive_format}{/ref}",
|
57
|
+
"downloads_url": "https://api.github.com/repos/twitter/bootstrap/downloads",
|
58
|
+
"issues_url": "https://api.github.com/repos/twitter/bootstrap/issues{/number}",
|
59
|
+
"pulls_url": "https://api.github.com/repos/twitter/bootstrap/pulls{/number}",
|
60
|
+
"milestones_url": "https://api.github.com/repos/twitter/bootstrap/milestones{/number}",
|
61
|
+
"notifications_url": "https://api.github.com/repos/twitter/bootstrap/notifications{?since,all,participating}",
|
62
|
+
"labels_url": "https://api.github.com/repos/twitter/bootstrap/labels{/name}",
|
63
|
+
"created_at": "2011-07-29T21:19:00Z",
|
64
|
+
"updated_at": "2013-04-13T19:12:09Z",
|
65
|
+
"pushed_at": "2013-04-13T03:56:36Z",
|
66
|
+
"git_url": "git://github.com/twitter/bootstrap.git",
|
67
|
+
"ssh_url": "git@github.com:twitter/bootstrap.git",
|
68
|
+
"clone_url": "https://github.com/twitter/bootstrap.git",
|
69
|
+
"svn_url": "https://github.com/twitter/bootstrap",
|
70
|
+
"homepage": "http://twitter.github.com/bootstrap",
|
71
|
+
"size": 2944,
|
72
|
+
"watchers_count": 48398,
|
73
|
+
"language": "JavaScript",
|
74
|
+
"has_issues": true,
|
75
|
+
"has_downloads": true,
|
76
|
+
"has_wiki": true,
|
77
|
+
"forks_count": 14503,
|
78
|
+
"mirror_url": null,
|
79
|
+
"open_issues_count": 167,
|
80
|
+
"forks": 14503,
|
81
|
+
"open_issues": 167,
|
82
|
+
"watchers": 48398,
|
83
|
+
"master_branch": "master",
|
84
|
+
"default_branch": "master",
|
85
|
+
"network_count": 14503,
|
86
|
+
"organization": {
|
87
|
+
"login": "twitter",
|
88
|
+
"id": 50278,
|
89
|
+
"avatar_url": "https://secure.gravatar.com/avatar/2f4a8254d032a8ec5e4c48d461e54fcc?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png",
|
90
|
+
"gravatar_id": "2f4a8254d032a8ec5e4c48d461e54fcc",
|
91
|
+
"url": "https://api.github.com/users/twitter",
|
92
|
+
"html_url": "https://github.com/twitter",
|
93
|
+
"followers_url": "https://api.github.com/users/twitter/followers",
|
94
|
+
"following_url": "https://api.github.com/users/twitter/following",
|
95
|
+
"gists_url": "https://api.github.com/users/twitter/gists{/gist_id}",
|
96
|
+
"starred_url": "https://api.github.com/users/twitter/starred{/owner}{/repo}",
|
97
|
+
"subscriptions_url": "https://api.github.com/users/twitter/subscriptions",
|
98
|
+
"organizations_url": "https://api.github.com/users/twitter/orgs",
|
99
|
+
"repos_url": "https://api.github.com/users/twitter/repos",
|
100
|
+
"events_url": "https://api.github.com/users/twitter/events{/privacy}",
|
101
|
+
"received_events_url": "https://api.github.com/users/twitter/received_events",
|
102
|
+
"type": "Organization"
|
103
|
+
}
|
104
|
+
|
105
|
+
}
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
|
4
|
+
require 'fakeweb'
|
5
|
+
require 'elasticrepo'
|
6
|
+
require 'octokit'
|
7
|
+
require 'tire'
|
8
|
+
require 'yajl'
|
9
|
+
|
10
|
+
def fixture_path
|
11
|
+
File.expand_path("../fixtures", __FILE__)
|
12
|
+
end
|
13
|
+
|
14
|
+
def fixture(file)
|
15
|
+
File.new(fixture_path + '/' + file)
|
16
|
+
end
|
17
|
+
|
18
|
+
#require 'rspec'
|
19
|
+
#Dir["./spec/support/**/*.rb"].each { |file| require file }
|
20
|
+
|
21
|
+
#RSpec.configure do |config|
|
22
|
+
# config.before :each do
|
23
|
+
# FakeWeb.allow_net_connect = false
|
24
|
+
# FakeWeb.register_uri(:any, %r|\Ahttp://localhost:9200|, :body => "{}")
|
25
|
+
# # http://stackoverflow.com/questions/10403951/elasticsearch-tire-good-strategy-to-mock-es
|
26
|
+
# end
|
27
|
+
#end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: elasticrepo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Luca G. Soave
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |2
|
14
|
+
Feed me.
|
15
|
+
email: luca.soave@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/elasticrepo.rb
|
21
|
+
- lib/elasticrepo/repo_subset.rb
|
22
|
+
- lib/elasticrepo/version.rb
|
23
|
+
- lib/elasticrepo/indexer.rb
|
24
|
+
- lib/elasticrepo/extractor.rb
|
25
|
+
- lib/elasticsearch.log
|
26
|
+
- spec/elasticrepo/extractor_spec.rb
|
27
|
+
- spec/elasticrepo/repo_subset_spec.rb
|
28
|
+
- spec/elasticrepo/indexer_spec.rb
|
29
|
+
- spec/fixtures/repositories.json
|
30
|
+
- spec/fixtures/repository.json
|
31
|
+
- spec/elasticrepo_spec.rb
|
32
|
+
- spec/spec_helper.rb
|
33
|
+
homepage: http://github.com/lgs/elasticrepo
|
34
|
+
licenses: []
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.0.2
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Feed me.
|
56
|
+
test_files: []
|