rom-git 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +6 -5
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -1
- data/lib/rom/git/gateway.rb +21 -16
- data/lib/rom/git/relation.rb +0 -5
- data/lib/rom/git/version.rb +1 -1
- data/rom-git.gemspec +1 -1
- data/spec/integration/gateway_spec.rb +8 -8
- data/spec/spec_helper.rb +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 77ab5fc6800244554a0c0a58677eb018a603e6418c702fec5518111ef35d567f
|
4
|
+
data.tar.gz: 44358d9aa4a07a3b185d89d4f62dd9544b26a45a4d6cd16f8fe5ccef7eb4693b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efe88b058be1e2299d5017cb09a1bc19751af984dafc113c1d09aeb7aac918de280cfb0974344edef00921b31bb5d910a14d046a40d13b2306af184728f0d2be
|
7
|
+
data.tar.gz: 4550de32a33e82666ab392453cf21c8e791bc26d3078c0175d7d55b22484f144b49c865031272585d18829d5e227e5934913cc6b554c176d5959657bd429b4ae
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
language: ruby
|
2
2
|
bundler_args: --without tools
|
3
|
+
after_success:
|
4
|
+
- '[ "$TRAVIS_RUBY_VERSION" = "2.5.0" ] && [ "$TRAVIS_BRANCH" = "master" ] && bundle exec codeclimate-test-reporter'
|
3
5
|
script: "bundle exec rake spec"
|
4
6
|
rvm:
|
5
|
-
- 2.
|
6
|
-
- 2.1
|
7
|
-
- 2.
|
7
|
+
- 2.3.4
|
8
|
+
- 2.4.1
|
9
|
+
- 2.5.0
|
8
10
|
- rbx-2
|
9
|
-
- jruby-9.0.5.0
|
10
11
|
- ruby-head
|
11
12
|
matrix:
|
12
13
|
allow_failures:
|
13
14
|
- rvm: ruby-head
|
14
|
-
- rvm:
|
15
|
+
- rvm: rbx-2
|
15
16
|
notifications:
|
16
17
|
webhooks:
|
17
18
|
urls:
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/lib/rom/git/gateway.rb
CHANGED
@@ -1,37 +1,42 @@
|
|
1
|
-
require 'rom/
|
2
|
-
require 'rom/support/constants'
|
3
|
-
|
1
|
+
require 'rom/constants'
|
4
2
|
require 'rom/gateway'
|
3
|
+
require 'rom/initializer'
|
4
|
+
|
5
5
|
require 'rom/git/dataset'
|
6
6
|
|
7
7
|
module ROM
|
8
8
|
module Git
|
9
9
|
class Gateway < ROM::Gateway
|
10
|
-
|
11
|
-
include Options
|
12
|
-
|
13
|
-
option :path, accept: String, reader: true
|
10
|
+
extend Initializer
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
attr_reader :datasets
|
18
|
-
|
19
|
-
attr_reader :repo
|
12
|
+
DEFAULT_BRANCH = 'refs/heads/master'.freeze
|
20
13
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
# @!attribute [r] path
|
15
|
+
# @return [String]
|
16
|
+
param :path, Types::Coercible::String
|
17
|
+
# @!attribute [r] branch
|
18
|
+
# @return [String]
|
19
|
+
option :branch, Types::Coercible::String, default: proc { DEFAULT_BRANCH }
|
20
|
+
# @!attribute [r] repo
|
21
|
+
# @return [Rugged::Repository]
|
22
|
+
option :repo, Types.Instance(Rugged::Repository), default: proc { Rugged::Repository.new(path) }
|
23
|
+
|
24
|
+
# @return [Hash]
|
25
|
+
def datasets
|
26
|
+
@datasets ||= {}
|
25
27
|
end
|
26
28
|
|
29
|
+
# @return [Dataset]
|
27
30
|
def [](name)
|
28
31
|
datasets[name]
|
29
32
|
end
|
30
33
|
|
34
|
+
# @return [Dataset]
|
31
35
|
def dataset(name)
|
32
36
|
datasets[name] = Dataset.new(repo.references[branch].log)
|
33
37
|
end
|
34
38
|
|
39
|
+
# @return [Boolean]
|
35
40
|
def dataset?(name)
|
36
41
|
datasets.key?(name)
|
37
42
|
end
|
data/lib/rom/git/relation.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'rom/relation'
|
2
|
-
require 'rom/plugins/relation/key_inference'
|
3
|
-
require 'rom/plugins/relation/view'
|
4
2
|
|
5
3
|
module ROM
|
6
4
|
module Git
|
@@ -9,9 +7,6 @@ module ROM
|
|
9
7
|
|
10
8
|
forward :join, :project, :restrict, :order
|
11
9
|
|
12
|
-
use :view
|
13
|
-
use :key_inference
|
14
|
-
|
15
10
|
def count
|
16
11
|
dataset.count
|
17
12
|
end
|
data/lib/rom/git/version.rb
CHANGED
data/rom-git.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.test_files = spec.files.grep(%r{^test/})
|
18
18
|
|
19
|
-
spec.add_runtime_dependency "rom", "~>
|
19
|
+
spec.add_runtime_dependency "rom", "~> 4.0"
|
20
20
|
spec.add_runtime_dependency "rugged", "~> 0.24"
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler"
|
@@ -7,7 +7,6 @@ RSpec.describe 'Git gateway' do
|
|
7
7
|
let(:rom) do
|
8
8
|
ROM.container(:git, path) do |conf|
|
9
9
|
conf.relation(:commits) do
|
10
|
-
|
11
10
|
def by_sha1(sha1)
|
12
11
|
restrict(sha1: sha1)
|
13
12
|
end
|
@@ -28,9 +27,6 @@ RSpec.describe 'Git gateway' do
|
|
28
27
|
|
29
28
|
shared_context 'a mapped relation tuple' do
|
30
29
|
it 'returns restricted and mapped object' do
|
31
|
-
commit = rom.relation(:commits)
|
32
|
-
.as(:entity).by_sha1('101868c4ce62b7e96a1f7c3b64fa40285ee00d5e').one
|
33
|
-
|
34
30
|
expect(commit.sha1).to eql('101868c4ce62b7e96a1f7c3b64fa40285ee00d5e')
|
35
31
|
expect(commit.message).to eql('commit (initial): Initial commit')
|
36
32
|
expect(commit.committer).to eql('Franck Verrot')
|
@@ -39,8 +35,8 @@ RSpec.describe 'Git gateway' do
|
|
39
35
|
|
40
36
|
describe 'using a relation with a custom mapper' do
|
41
37
|
let(:commit) do
|
42
|
-
rom.
|
43
|
-
|
38
|
+
rom.relations[:commits]
|
39
|
+
.map_with(:entity).by_sha1('101868c4ce62b7e96a1f7c3b64fa40285ee00d5e').one
|
44
40
|
end
|
45
41
|
|
46
42
|
include_context 'a mapped relation tuple'
|
@@ -48,10 +44,14 @@ RSpec.describe 'Git gateway' do
|
|
48
44
|
|
49
45
|
describe 'using a repository' do
|
50
46
|
let(:repo) do
|
51
|
-
Class.new(ROM::Repository[:commits])
|
47
|
+
Class.new(ROM::Repository[:commits]) do
|
48
|
+
def find(sha1)
|
49
|
+
root.by_sha1(sha1).one
|
50
|
+
end
|
51
|
+
end.new(rom)
|
52
52
|
end
|
53
53
|
|
54
|
-
let(:
|
54
|
+
let(:commit) { repo.find('101868c4ce62b7e96a1f7c3b64fa40285ee00d5e') }
|
55
55
|
|
56
56
|
include_context 'a mapped relation tuple'
|
57
57
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franck Verrot
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rom
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '4.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '4.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rugged
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.6.14
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Git adapter for the rom-rb
|