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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dc7c7847111033dcda9033ead9ae4d8c9181ed41
4
- data.tar.gz: 60278f7a76878300cced492b235021a591a51ccf
2
+ SHA256:
3
+ metadata.gz: 77ab5fc6800244554a0c0a58677eb018a603e6418c702fec5518111ef35d567f
4
+ data.tar.gz: 44358d9aa4a07a3b185d89d4f62dd9544b26a45a4d6cd16f8fe5ccef7eb4693b
5
5
  SHA512:
6
- metadata.gz: dbc659a12eab3caf1e9d79994313ee7292965d6bea104fe8aa2bd719858e2b5e0a6e25c36187dcb2823130d825d3b7fc322a1f26429bc5c2794f4e40435cf06c
7
- data.tar.gz: 8254494552c97aec04ed92b82751a447713faad2f114eabc832fb28e77527b358f985b249ef315d280ec96c174ecda230f5c7b741394befc1aca4834ca3d8dc9
6
+ metadata.gz: efe88b058be1e2299d5017cb09a1bc19751af984dafc113c1d09aeb7aac918de280cfb0974344edef00921b31bb5d910a14d046a40d13b2306af184728f0d2be
7
+ data.tar.gz: 4550de32a33e82666ab392453cf21c8e791bc26d3078c0175d7d55b22484f144b49c865031272585d18829d5e227e5934913cc6b554c176d5959657bd429b4ae
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  Gemfile.lock
2
+ coverage
@@ -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.0
6
- - 2.1
7
- - 2.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: jruby-9.0.5.0
15
+ - rvm: rbx-2
15
16
  notifications:
16
17
  webhooks:
17
18
  urls:
@@ -1,3 +1,7 @@
1
+ # v3.0.0
2
+
3
+ Update to work with rom 4.0.0. Thanks @alsemyonov !
4
+
1
5
  # v2.1.0 2016-08-01
2
6
 
3
7
  Update to work with rom 2.0.0 and rom-repository
data/Gemfile CHANGED
@@ -4,5 +4,6 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem 'rom-repository'
7
- gem 'codeclimate-test-reporter'
7
+ gem 'simplecov', require: false
8
+ gem 'codeclimate-test-reporter', require: false
8
9
  end
@@ -1,37 +1,42 @@
1
- require 'rom/support/options'
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
- DEFAULT_BRANCH = 'refs/heads/master'.freeze
11
- include Options
12
-
13
- option :path, accept: String, reader: true
10
+ extend Initializer
14
11
 
15
- option :branch, accept: String, reader: true, default: DEFAULT_BRANCH
16
-
17
- attr_reader :datasets
18
-
19
- attr_reader :repo
12
+ DEFAULT_BRANCH = 'refs/heads/master'.freeze
20
13
 
21
- def initialize(path, options = EMPTY_HASH)
22
- super
23
- @datasets = {}
24
- @repo = Rugged::Repository.new(path)
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  module Git
3
- VERSION = '2.1.0'.freeze
3
+ VERSION = '3.0.0'.freeze
4
4
  end
5
5
  end
@@ -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", "~> 2.0"
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.relation(:commits)
43
- .as(:entity).by_sha1('101868c4ce62b7e96a1f7c3b64fa40285ee00d5e').one
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]).new(rom)
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(:commits) { repo.commits.one }
54
+ let(:commit) { repo.find('101868c4ce62b7e96a1f7c3b64fa40285ee00d5e') }
55
55
 
56
56
  include_context 'a mapped relation tuple'
57
57
  end
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  if RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '2.3.1'
4
- require "codeclimate-test-reporter"
5
- CodeClimate::TestReporter.start
4
+ require "simplecov"
5
+ SimpleCov.start
6
6
  end
7
7
 
8
8
  require 'rom-git'
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: 2.1.0
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: 2016-07-31 00:00:00.000000000 Z
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: '2.0'
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: '2.0'
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.5.1
146
+ rubygems_version: 2.6.14
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Git adapter for the rom-rb