rom-yaml 0.4.0 → 1.0.0.beta1
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/.travis.yml +15 -11
- data/CHANGELOG.md +13 -0
- data/Gemfile +2 -0
- data/README.md +3 -3
- data/lib/rom/yaml/relation.rb +4 -3
- data/lib/rom/yaml/version.rb +1 -1
- data/rom-yaml.gemspec +1 -1
- data/spec/integration/adapter_spec.rb +22 -5
- data/spec/spec_helper.rb +19 -3
- data/spec/unit/dataset_spec.rb +1 -1
- data/spec/unit/{repository_spec.rb → gateway_spec.rb} +1 -1
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 553c008fde88ee3c9ba6bbd9532f4146c74b16c0
|
4
|
+
data.tar.gz: e2668f054350d34a039e1b7f82710c7cb95d93a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52eba46a03299672bd71b13029fc7463403cc8f867e85af74d8a224f247c2d0842ce82103941f88a6595a9a43b04603f125c4c2682632605e6747f69cfb26e32
|
7
|
+
data.tar.gz: fda2fa185ad08c34b8ac0de2b79dbc4249db3649523841806fc27d160748da6015cefa2d9c3d569ba31a96155454a447500e3fdccb4a527f0e59ae05224abcb2
|
data/.travis.yml
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
language: ruby
|
2
|
+
dist: trusty
|
3
|
+
sudo: required
|
4
|
+
cache: bundler
|
2
5
|
bundler_args: --without tools
|
3
|
-
env:
|
4
|
-
- CODECLIMATE_REPO_TOKEN=ef69eb6a9e19987527e5010a02bbf71cd4ddc8a5137ba308f299817f56d06e7f
|
5
6
|
script: "bundle exec rake spec"
|
7
|
+
after_success:
|
8
|
+
- '[ -d coverage ] && bundle exec codeclimate-test-reporter'
|
6
9
|
rvm:
|
7
|
-
- 2.
|
8
|
-
- 2.
|
9
|
-
- 2.
|
10
|
-
- rbx-
|
11
|
-
- jruby-
|
12
|
-
|
10
|
+
- 2.2.6
|
11
|
+
- 2.3.3
|
12
|
+
- 2.4.0
|
13
|
+
- rbx-3
|
14
|
+
- jruby-9.1.5.0
|
15
|
+
env:
|
16
|
+
global:
|
17
|
+
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
18
|
+
- COVERAGE='true'
|
13
19
|
matrix:
|
14
20
|
allow_failures:
|
15
|
-
- rvm:
|
21
|
+
- rvm: rbx-3
|
16
22
|
notifications:
|
17
23
|
webhooks:
|
18
24
|
urls:
|
@@ -20,5 +26,3 @@ notifications:
|
|
20
26
|
on_success: change
|
21
27
|
on_failure: always
|
22
28
|
on_start: false
|
23
|
-
before_install:
|
24
|
-
- gem install bundler -v 1.10.6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## v1.0.0 to-be-released
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
* [BREAKING] Schema support in relations (you *must* define schemas now) (solnic)
|
6
|
+
* Support for rom-repository (solnic)
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
|
10
|
+
* `YAML` relations inherit now from `Memory::Relation` (solnic)
|
11
|
+
|
12
|
+
[Compare v0.4.0...v1.0.0](https://github.com/rom-rb/rom-yaml/compare/v0.4.0...v1.0.0)
|
13
|
+
|
1
14
|
## v0.4.0
|
2
15
|
|
3
16
|
### Changed
|
data/Gemfile
CHANGED
@@ -6,6 +6,8 @@ group :test do
|
|
6
6
|
gem 'byebug', platform: :mri
|
7
7
|
gem 'inflecto'
|
8
8
|
gem 'rom', git: 'https://github.com/rom-rb/rom.git', branch: 'master'
|
9
|
+
gem 'rom-mapper', git: 'https://github.com/rom-rb/rom-mapper.git', branch: 'master'
|
10
|
+
gem 'rom-repository', git: 'https://github.com/rom-rb/rom-repository.git', branch: 'master'
|
9
11
|
gem 'rspec', '~> 3.1'
|
10
12
|
gem 'codeclimate-test-reporter', require: false
|
11
13
|
gem 'virtus'
|
data/README.md
CHANGED
@@ -4,16 +4,16 @@
|
|
4
4
|
[codeclimate]: https://codeclimate.com/github/rom-rb/rom-yaml
|
5
5
|
[inchpages]: http://inch-ci.org/github/rom-rb/rom-yaml
|
6
6
|
|
7
|
-
#
|
7
|
+
# rom-yaml
|
8
8
|
|
9
9
|
[][gem]
|
10
10
|
[][travis]
|
11
|
-
[][gemnasium]
|
12
12
|
[][codeclimate]
|
13
13
|
[][codeclimate]
|
14
14
|
[][inchpages]
|
15
15
|
|
16
|
-
YAML support for [
|
16
|
+
YAML support for [rom-rb](https://github.com/rom-rb/rom)
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
data/lib/rom/yaml/relation.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
require 'rom/
|
1
|
+
require 'rom/memory'
|
2
|
+
require 'rom/plugins/relation/key_inference'
|
2
3
|
|
3
4
|
module ROM
|
4
5
|
module YAML
|
5
6
|
# YAML-specific relation subclass
|
6
7
|
#
|
7
8
|
# @api private
|
8
|
-
class Relation < ROM::Relation
|
9
|
+
class Relation < ROM::Memory::Relation
|
9
10
|
adapter :yaml
|
10
|
-
|
11
|
+
use :key_inference
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
data/lib/rom/yaml/version.rb
CHANGED
data/rom-yaml.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "rom", "~>
|
21
|
+
spec.add_runtime_dependency "rom", "~> 3.0.0.beta"
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler'
|
24
24
|
spec.add_development_dependency 'rake'
|
@@ -1,16 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
require 'rom/lint/spec'
|
4
|
+
require 'rom/repository'
|
4
5
|
|
5
|
-
describe 'YAML adapter' do
|
6
|
+
RSpec.describe 'YAML adapter' do
|
6
7
|
let(:configuration) do
|
7
8
|
ROM::Configuration.new( :yaml, path )
|
8
9
|
end
|
9
10
|
|
10
11
|
let(:root) { Pathname(__FILE__).dirname.join('..') }
|
11
12
|
|
12
|
-
|
13
|
-
|
14
13
|
let(:path) { "#{root}/fixtures/test_db.yml" }
|
15
14
|
let(:container) { ROM.container(configuration) }
|
16
15
|
|
@@ -29,7 +28,11 @@ describe 'YAML adapter' do
|
|
29
28
|
|
30
29
|
let(:users_relation) do
|
31
30
|
Class.new(ROM::YAML::Relation) do
|
32
|
-
|
31
|
+
schema(:users) do
|
32
|
+
attribute :name, ROM::Types::String
|
33
|
+
attribute :email, ROM::Types::String
|
34
|
+
attribute :roles, ROM::Types::Array
|
35
|
+
end
|
33
36
|
|
34
37
|
def by_name(name)
|
35
38
|
restrict(name: name)
|
@@ -42,7 +45,7 @@ describe 'YAML adapter' do
|
|
42
45
|
relation :users
|
43
46
|
register_as :entity
|
44
47
|
|
45
|
-
model name: 'User'
|
48
|
+
model name: 'Test::User'
|
46
49
|
|
47
50
|
attribute :name
|
48
51
|
attribute :email
|
@@ -70,6 +73,20 @@ describe 'YAML adapter' do
|
|
70
73
|
])
|
71
74
|
end
|
72
75
|
end
|
76
|
+
|
77
|
+
describe 'with a repository' do
|
78
|
+
let(:repo) do
|
79
|
+
Class.new(ROM::Repository[:users]).new(rom)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'auto-maps to structs' do
|
83
|
+
user = repo.users.first
|
84
|
+
|
85
|
+
expect(user.name).to eql('Jane')
|
86
|
+
expect(user.email).to eql('jane@doe.org')
|
87
|
+
expect(user.roles.size).to be(2)
|
88
|
+
end
|
89
|
+
end
|
73
90
|
end
|
74
91
|
|
75
92
|
describe 'multi-file setup' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
if RUBY_ENGINE == '
|
4
|
-
require
|
5
|
-
|
3
|
+
if RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '2.4.0' && ENV['CI'] == 'true'
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter '/spec/'
|
7
|
+
end
|
6
8
|
end
|
7
9
|
|
8
10
|
require 'rom-yaml'
|
@@ -15,3 +17,17 @@ end
|
|
15
17
|
root = Pathname(__FILE__).dirname
|
16
18
|
|
17
19
|
Dir[root.join('shared/*.rb').to_s].each { |f| require f }
|
20
|
+
|
21
|
+
module Test
|
22
|
+
def self.remove_constants
|
23
|
+
constants.each(&method(:remove_const))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
config.after do
|
29
|
+
Test.remove_constants
|
30
|
+
end
|
31
|
+
|
32
|
+
config.disable_monkey_patching!
|
33
|
+
end
|
data/spec/unit/dataset_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rom
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0.beta
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.0.beta
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,7 +97,7 @@ files:
|
|
97
97
|
- spec/integration/adapter_spec.rb
|
98
98
|
- spec/spec_helper.rb
|
99
99
|
- spec/unit/dataset_spec.rb
|
100
|
-
- spec/unit/
|
100
|
+
- spec/unit/gateway_spec.rb
|
101
101
|
homepage: http://rom-rb.org
|
102
102
|
licenses:
|
103
103
|
- MIT
|
@@ -113,12 +113,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - "
|
116
|
+
- - ">"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
118
|
+
version: 1.3.1
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.6.3
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: YAML support for Ruby Object Mapper
|
@@ -129,5 +129,4 @@ test_files:
|
|
129
129
|
- spec/integration/adapter_spec.rb
|
130
130
|
- spec/spec_helper.rb
|
131
131
|
- spec/unit/dataset_spec.rb
|
132
|
-
- spec/unit/
|
133
|
-
has_rdoc:
|
132
|
+
- spec/unit/gateway_spec.rb
|