gitlab-elasticsearch-git 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/CHANGELOG +9 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +97 -0
- data/LICENSE.txt +22 -0
- data/README.md +345 -0
- data/Rakefile +10 -0
- data/gitlab-elasticsearch-git.gemspec +28 -0
- data/lib/elasticsearch/git.rb +9 -0
- data/lib/elasticsearch/git/encoder_helper.rb +43 -0
- data/lib/elasticsearch/git/lite_blob.rb +25 -0
- data/lib/elasticsearch/git/model.rb +92 -0
- data/lib/elasticsearch/git/repository.rb +570 -0
- data/lib/elasticsearch/git/version.rb +5 -0
- data/test/lib/repository_test.rb +43 -0
- data/test/support/repo_info.rb +3 -0
- data/test/support/repository.rb +9 -0
- data/test/support/seed_helper.rb +6 -0
- data/test/test_helper.rb +29 -0
- metadata +169 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
|
4
|
+
class RepositoryTest < TestCase
|
5
|
+
def setup
|
6
|
+
@repository = Repository.new
|
7
|
+
@repository.repository_for_indexing(TEST_REPO_PATH)
|
8
|
+
Repository.__elasticsearch__.create_index! force: true
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_index_commits
|
12
|
+
commit_count = @repository.index_commits
|
13
|
+
assert { commit_count == RepoInfo::COMMIT_COUNT }
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_index_commits_after_first_push
|
17
|
+
commit_count = @repository.index_commits(
|
18
|
+
from_rev: "0000000000000000000000000000000000000000",
|
19
|
+
to_rev: @repository.repository_for_indexing.head.target.oid)
|
20
|
+
|
21
|
+
assert { commit_count == RepoInfo::COMMIT_COUNT }
|
22
|
+
end
|
23
|
+
|
24
|
+
#TODO write better assertions
|
25
|
+
def test_index_all_blobs_from_head
|
26
|
+
blob_count = @repository.index_blobs
|
27
|
+
Repository.__elasticsearch__.refresh_index!
|
28
|
+
|
29
|
+
result = @repository.search('def project_name_regex')
|
30
|
+
assert { result[:blobs][:total_count] == 1 }
|
31
|
+
end
|
32
|
+
|
33
|
+
#TODO write better assertions
|
34
|
+
def test_index_blobs_after_first_push
|
35
|
+
commit_count = @repository.index_blobs(
|
36
|
+
from_rev: "0000000000000000000000000000000000000000",
|
37
|
+
to_rev: @repository.repository_for_indexing.head.target.oid)
|
38
|
+
Repository.__elasticsearch__.refresh_index!
|
39
|
+
|
40
|
+
result = @repository.search('def project_name_regex')
|
41
|
+
assert { result[:blobs][:total_count] == 1 }
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
unless File.exists?(TEST_REPO_PATH)
|
2
|
+
puts 'Prepare seeds'
|
3
|
+
FileUtils.mkdir_p(SUPPORT_PATH)
|
4
|
+
system(*%W(git clone --bare https://gitlab.com/gitlab-org/gitlab-test.git), chdir: SUPPORT_PATH)
|
5
|
+
system(*%W(git checkout 5937ac0a7beb003549fc5fd26fc247adbce4a52e), chdir: SUPPORT_PATH)
|
6
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'pry'
|
4
|
+
require 'elasticsearch/git'
|
5
|
+
|
6
|
+
SUPPORT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), '../support')
|
7
|
+
TEST_REPO_PATH = File.join(SUPPORT_PATH, 'testme.git')
|
8
|
+
|
9
|
+
require_relative 'support/seed_helper'
|
10
|
+
require_relative 'support/repository'
|
11
|
+
require_relative 'support/repo_info'
|
12
|
+
|
13
|
+
Bundler.require
|
14
|
+
|
15
|
+
require 'wrong/adapters/minitest'
|
16
|
+
|
17
|
+
PROJECT_ROOT = File.join(Dir.pwd)
|
18
|
+
|
19
|
+
Wrong.config.color
|
20
|
+
|
21
|
+
Minitest.autorun
|
22
|
+
|
23
|
+
class TestCase < Minitest::Test
|
24
|
+
include Wrong
|
25
|
+
|
26
|
+
def fixtures_path
|
27
|
+
@path ||= File.expand_path(File.join(__FILE__, "../fixtures"))
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitlab-elasticsearch-git
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrey Kumanyaev
|
8
|
+
- Evgeniy Sokovikov
|
9
|
+
- GitLab B.V.
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2016-01-15 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: elasticsearch-model
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: elasticsearch-api
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.4.0
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.4.0
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rugged
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.23.3
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.23.3
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: charlock_holmes
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.7.3
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.7.3
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: github-linguist
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 4.7.0
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 4.7.0
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: activemodel
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 4.2.0
|
92
|
+
type: :runtime
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 4.2.0
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: activesupport
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 4.2.0
|
106
|
+
type: :runtime
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 4.2.0
|
113
|
+
description: Elasticsearch integrations for indexing git repositories.
|
114
|
+
email:
|
115
|
+
- me@zzet.org
|
116
|
+
- skv-headless@yandex.ru
|
117
|
+
executables: []
|
118
|
+
extensions: []
|
119
|
+
extra_rdoc_files: []
|
120
|
+
files:
|
121
|
+
- ".gitignore"
|
122
|
+
- CHANGELOG
|
123
|
+
- Gemfile
|
124
|
+
- Gemfile.lock
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- gitlab-elasticsearch-git.gemspec
|
129
|
+
- lib/elasticsearch/git.rb
|
130
|
+
- lib/elasticsearch/git/encoder_helper.rb
|
131
|
+
- lib/elasticsearch/git/lite_blob.rb
|
132
|
+
- lib/elasticsearch/git/model.rb
|
133
|
+
- lib/elasticsearch/git/repository.rb
|
134
|
+
- lib/elasticsearch/git/version.rb
|
135
|
+
- test/lib/repository_test.rb
|
136
|
+
- test/support/repo_info.rb
|
137
|
+
- test/support/repository.rb
|
138
|
+
- test/support/seed_helper.rb
|
139
|
+
- test/test_helper.rb
|
140
|
+
homepage: https://gitlab.com/gitlab-org/gitlab-elasticsearch-git
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 2.4.3
|
161
|
+
signing_key:
|
162
|
+
specification_version: 4
|
163
|
+
summary: Elasticsearch integrations for git repositories.
|
164
|
+
test_files:
|
165
|
+
- test/lib/repository_test.rb
|
166
|
+
- test/support/repo_info.rb
|
167
|
+
- test/support/repository.rb
|
168
|
+
- test/support/seed_helper.rb
|
169
|
+
- test/test_helper.rb
|