rom 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -8
- data/CHANGELOG.md +28 -1
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +2 -2
- data/lib/rom.rb +1 -1
- data/lib/rom/command.rb +7 -5
- data/lib/rom/command_registry.rb +1 -1
- data/lib/rom/commands.rb +0 -2
- data/lib/rom/commands/abstract.rb +55 -25
- data/lib/rom/commands/composite.rb +13 -1
- data/lib/rom/commands/delete.rb +0 -8
- data/lib/rom/commands/graph.rb +102 -0
- data/lib/rom/commands/graph/class_interface.rb +69 -0
- data/lib/rom/commands/lazy.rb +87 -0
- data/lib/rom/constants.rb +22 -0
- data/lib/rom/env.rb +48 -18
- data/lib/rom/gateway.rb +132 -0
- data/lib/rom/global.rb +19 -19
- data/lib/rom/header.rb +42 -16
- data/lib/rom/header/attribute.rb +37 -15
- data/lib/rom/lint/gateway.rb +94 -0
- data/lib/rom/lint/spec.rb +15 -3
- data/lib/rom/lint/test.rb +45 -14
- data/lib/rom/mapper.rb +23 -10
- data/lib/rom/mapper/attribute_dsl.rb +157 -18
- data/lib/rom/memory.rb +1 -1
- data/lib/rom/memory/commands.rb +10 -8
- data/lib/rom/memory/dataset.rb +22 -2
- data/lib/rom/memory/{repository.rb → gateway.rb} +10 -10
- data/lib/rom/pipeline.rb +2 -1
- data/lib/rom/processor/transproc.rb +105 -14
- data/lib/rom/relation.rb +4 -4
- data/lib/rom/relation/class_interface.rb +19 -13
- data/lib/rom/relation/graph.rb +22 -0
- data/lib/rom/relation/lazy.rb +5 -3
- data/lib/rom/repository.rb +9 -118
- data/lib/rom/setup.rb +21 -14
- data/lib/rom/setup/finalize.rb +19 -19
- data/lib/rom/setup_dsl/relation.rb +10 -1
- data/lib/rom/support/deprecations.rb +21 -3
- data/lib/rom/support/enumerable_dataset.rb +1 -1
- data/lib/rom/version.rb +1 -1
- data/rom.gemspec +2 -4
- data/spec/integration/commands/delete_spec.rb +6 -0
- data/spec/integration/commands/graph_spec.rb +235 -0
- data/spec/integration/mappers/combine_spec.rb +14 -5
- data/spec/integration/mappers/definition_dsl_spec.rb +6 -1
- data/spec/integration/mappers/exclude_spec.rb +28 -0
- data/spec/integration/mappers/fold_spec.rb +16 -0
- data/spec/integration/mappers/group_spec.rb +0 -22
- data/spec/integration/mappers/prefix_separator_spec.rb +54 -0
- data/spec/integration/mappers/prefix_spec.rb +50 -0
- data/spec/integration/mappers/reusing_mappers_spec.rb +21 -0
- data/spec/integration/mappers/step_spec.rb +120 -0
- data/spec/integration/mappers/unfold_spec.rb +93 -0
- data/spec/integration/mappers/ungroup_spec.rb +127 -0
- data/spec/integration/mappers/unwrap_spec.rb +2 -2
- data/spec/integration/multi_repo_spec.rb +11 -11
- data/spec/integration/repositories/setting_logger_spec.rb +2 -2
- data/spec/integration/setup_spec.rb +11 -1
- data/spec/shared/command_behavior.rb +18 -0
- data/spec/shared/materializable.rb +4 -2
- data/spec/shared/users_and_tasks.rb +3 -3
- data/spec/test/memory_repository_lint_test.rb +4 -4
- data/spec/unit/rom/commands/graph_spec.rb +198 -0
- data/spec/unit/rom/commands/lazy_spec.rb +88 -0
- data/spec/unit/rom/commands_spec.rb +2 -2
- data/spec/unit/rom/env_spec.rb +26 -0
- data/spec/unit/rom/gateway_spec.rb +90 -0
- data/spec/unit/rom/global_spec.rb +4 -3
- data/spec/unit/rom/mapper/dsl_spec.rb +42 -1
- data/spec/unit/rom/mapper_spec.rb +4 -1
- data/spec/unit/rom/memory/commands/create_spec.rb +21 -0
- data/spec/unit/rom/memory/commands/delete_spec.rb +21 -0
- data/spec/unit/rom/memory/commands/update_spec.rb +21 -0
- data/spec/unit/rom/memory/relation_spec.rb +42 -10
- data/spec/unit/rom/memory/repository_spec.rb +3 -3
- data/spec/unit/rom/processor/transproc_spec.rb +75 -0
- data/spec/unit/rom/relation/lazy/combine_spec.rb +33 -4
- data/spec/unit/rom/relation/lazy_spec.rb +9 -1
- data/spec/unit/rom/repository_spec.rb +4 -63
- data/spec/unit/rom/setup_spec.rb +19 -5
- metadata +28 -38
- data/.ruby-version +0 -1
- data/lib/rom/lint/repository.rb +0 -94
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.5
|
data/lib/rom/lint/repository.rb
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'rom/lint/linter'
|
2
|
-
|
3
|
-
module ROM
|
4
|
-
module Lint
|
5
|
-
# Ensures that a [ROM::Repository] extension provides datasets through the
|
6
|
-
# expected methods
|
7
|
-
#
|
8
|
-
# @api public
|
9
|
-
class Repository < ROM::Lint::Linter
|
10
|
-
# The repository identifier e.g. +:memory+
|
11
|
-
#
|
12
|
-
# @api public
|
13
|
-
attr_reader :identifier
|
14
|
-
|
15
|
-
# The repository class
|
16
|
-
#
|
17
|
-
# @api public
|
18
|
-
attr_reader :repository
|
19
|
-
|
20
|
-
# The optional URI
|
21
|
-
#
|
22
|
-
# @api public
|
23
|
-
attr_reader :uri
|
24
|
-
|
25
|
-
# Repository instance used in lint tests
|
26
|
-
#
|
27
|
-
# @api private
|
28
|
-
attr_reader :repository_instance
|
29
|
-
|
30
|
-
# Create a repository linter
|
31
|
-
#
|
32
|
-
# @param [Symbol] identifier
|
33
|
-
# @param [Class] repository
|
34
|
-
# @param [String] uri optional
|
35
|
-
def initialize(identifier, repository, uri = nil)
|
36
|
-
@identifier = identifier
|
37
|
-
@repository = repository
|
38
|
-
@uri = uri
|
39
|
-
@repository_instance = setup_repository_instance
|
40
|
-
end
|
41
|
-
|
42
|
-
# Lint: Ensure that +repository+ setups up its instance
|
43
|
-
#
|
44
|
-
# @api public
|
45
|
-
def lint_repository_setup
|
46
|
-
return if repository_instance.instance_of? repository
|
47
|
-
|
48
|
-
complain <<-STRING
|
49
|
-
#{repository}.setup must return a repository instance but
|
50
|
-
returned #{repository_instance.inspect}
|
51
|
-
STRING
|
52
|
-
end
|
53
|
-
|
54
|
-
# Lint: Ensure that +repository_instance+ responds to +[]+
|
55
|
-
#
|
56
|
-
# @api public
|
57
|
-
def lint_dataset_reader
|
58
|
-
return if repository_instance.respond_to? :[]
|
59
|
-
|
60
|
-
complain "#{repository_instance} must respond to []"
|
61
|
-
end
|
62
|
-
|
63
|
-
# Lint: Ensure that +repository_instance+ responds to +dataset?+
|
64
|
-
#
|
65
|
-
# @api public
|
66
|
-
def lint_dataset_predicate
|
67
|
-
return if repository_instance.respond_to? :dataset?
|
68
|
-
|
69
|
-
complain "#{repository_instance} must respond to dataset?"
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
|
74
|
-
# Setup repository instance
|
75
|
-
#
|
76
|
-
# @api private
|
77
|
-
def setup_repository_instance
|
78
|
-
if uri
|
79
|
-
ROM::Repository.setup(identifier, uri)
|
80
|
-
else
|
81
|
-
ROM::Repository.setup(identifier)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
# Run Repository#disconnect
|
86
|
-
#
|
87
|
-
# @api private
|
88
|
-
def after_lint
|
89
|
-
super
|
90
|
-
repository_instance.disconnect
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|