locomotivecms_models 0.0.1.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +4 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +5 -0
  6. data/Gemfile +19 -0
  7. data/Gemfile.lock +53 -0
  8. data/README.md +29 -0
  9. data/Rakefile +12 -0
  10. data/example.rb +76 -0
  11. data/lib/locomotive/adapters/memory/command.rb +35 -0
  12. data/lib/locomotive/adapters/memory/condition.rb +98 -0
  13. data/lib/locomotive/adapters/memory/dataset.rb +75 -0
  14. data/lib/locomotive/adapters/memory/query.rb +106 -0
  15. data/lib/locomotive/adapters/memory/wrapper.rb +23 -0
  16. data/lib/locomotive/adapters/memory_adapter.rb +72 -0
  17. data/lib/locomotive/core_ext.rb +2 -0
  18. data/lib/locomotive/core_ext/hash.rb +44 -0
  19. data/lib/locomotive/core_ext/string.rb +13 -0
  20. data/lib/locomotive/decorators.rb +1 -0
  21. data/lib/locomotive/decorators/i18n_decorator.rb +45 -0
  22. data/lib/locomotive/entity.rb +28 -0
  23. data/lib/locomotive/fields/i18n_field.rb +62 -0
  24. data/lib/locomotive/mapper.rb +47 -0
  25. data/lib/locomotive/mapping.rb +16 -0
  26. data/lib/locomotive/mapping/coercer.rb +64 -0
  27. data/lib/locomotive/mapping/collection.rb +68 -0
  28. data/lib/locomotive/mapping/dereferencer.rb +40 -0
  29. data/lib/locomotive/mapping/referencer.rb +66 -0
  30. data/lib/locomotive/mapping/virtual_proxy.rb +30 -0
  31. data/lib/locomotive/models.rb +57 -0
  32. data/lib/locomotive/models/configuration.rb +13 -0
  33. data/lib/locomotive/models/version.rb +10 -0
  34. data/lib/locomotive/repository.rb +51 -0
  35. data/locomotive_models.gemspec +28 -0
  36. data/non_persisted_example.rb +70 -0
  37. data/presenter_example.rb +49 -0
  38. data/relation_example.rb +119 -0
  39. data/spec/fixtures/example_entities.rb +23 -0
  40. data/spec/fixtures/example_mapper.rb +40 -0
  41. data/spec/fixtures/example_repositories.rb +19 -0
  42. data/spec/integration/criteria_spec.rb +67 -0
  43. data/spec/integration/persistence_entity_spec.rb +75 -0
  44. data/spec/integration/relations_spec.rb +114 -0
  45. data/spec/spec_helper.rb +22 -0
  46. data/spec/support/adapters/memory.rb +39 -0
  47. data/spec/unit/adapters/memory/condition_spec.rb +120 -0
  48. data/spec/unit/adapters/memory/dataset_spec.rb +71 -0
  49. data/spec/unit/adapters/memory/query_spec.rb +69 -0
  50. data/spec/unit/decorators/i18n_decorator_spec.rb +133 -0
  51. data/spec/unit/entity_spec.rb +30 -0
  52. data/spec/unit/fields/i18n_field_spec.rb +60 -0
  53. data/spec/unit/mapper_spec.rb +60 -0
  54. data/spec/unit/mapping/coercer_spec.rb +30 -0
  55. data/spec/unit/mapping/collection_spec.rb +32 -0
  56. data/spec/unit/models_spec.rb +14 -0
  57. metadata +190 -0
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ module Locomotive
4
+
5
+ describe Mapping::Collection do
6
+ let(:mapper) { double }
7
+
8
+ module Example
9
+ class Foo
10
+ include Locomotive::Entity
11
+ end
12
+ end
13
+
14
+ subject do
15
+ Mapping::Collection.new(mapper, :site, Mapping::Coercer) do
16
+ entity Example::Foo
17
+ end
18
+ end
19
+
20
+ describe '#deserialize' do
21
+ let(:records) { [{name: 'foo'}] }
22
+
23
+ specify do
24
+ expect(subject.deserialize(records).size).to eq(1)
25
+ end
26
+
27
+ specify do
28
+ expect(subject.deserialize(records).first).to be_instance_of(Example::Foo)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ module Locomotive
4
+ describe Models do
5
+
6
+ include_context 'memory'
7
+
8
+ describe '#[]' do
9
+ it 'is a shortcut to the repository' do
10
+ Locomotive::Models[:articles].should be_a Locomotive::Example::ArticlesRepository
11
+ end
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: locomotivecms_models
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre.alpha
5
+ platform: ruby
6
+ authors:
7
+ - Didier Lafforgue
8
+ - Arnaud Sellenet
9
+ - Joel Azemar
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2014-06-24 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: 4.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: 4.1.0
29
+ - !ruby/object:Gem::Dependency
30
+ name: i18n
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: 0.6.9
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: 0.6.9
43
+ - !ruby/object:Gem::Dependency
44
+ name: locomotivecms_common
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 0.0.1
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: 0.0.1
57
+ - !ruby/object:Gem::Dependency
58
+ name: rake
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: 10.3.1
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: 10.3.1
71
+ - !ruby/object:Gem::Dependency
72
+ name: rspec
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: 2.14.1
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: 2.14.1
85
+ description: 'Persistence framework for LocomotiveCMS. Default adapters: YAML'
86
+ email:
87
+ - did@locomotivecms.com
88
+ - arnaud@sellenet.fr
89
+ - joel.azemar@gmail.com
90
+ executables: []
91
+ extensions: []
92
+ extra_rdoc_files: []
93
+ files:
94
+ - ".coveralls.yml"
95
+ - ".gitignore"
96
+ - ".rspec"
97
+ - ".travis.yml"
98
+ - Gemfile
99
+ - Gemfile.lock
100
+ - README.md
101
+ - Rakefile
102
+ - example.rb
103
+ - lib/locomotive/adapters/memory/command.rb
104
+ - lib/locomotive/adapters/memory/condition.rb
105
+ - lib/locomotive/adapters/memory/dataset.rb
106
+ - lib/locomotive/adapters/memory/query.rb
107
+ - lib/locomotive/adapters/memory/wrapper.rb
108
+ - lib/locomotive/adapters/memory_adapter.rb
109
+ - lib/locomotive/core_ext.rb
110
+ - lib/locomotive/core_ext/hash.rb
111
+ - lib/locomotive/core_ext/string.rb
112
+ - lib/locomotive/decorators.rb
113
+ - lib/locomotive/decorators/i18n_decorator.rb
114
+ - lib/locomotive/entity.rb
115
+ - lib/locomotive/fields/i18n_field.rb
116
+ - lib/locomotive/mapper.rb
117
+ - lib/locomotive/mapping.rb
118
+ - lib/locomotive/mapping/coercer.rb
119
+ - lib/locomotive/mapping/collection.rb
120
+ - lib/locomotive/mapping/dereferencer.rb
121
+ - lib/locomotive/mapping/referencer.rb
122
+ - lib/locomotive/mapping/virtual_proxy.rb
123
+ - lib/locomotive/models.rb
124
+ - lib/locomotive/models/configuration.rb
125
+ - lib/locomotive/models/version.rb
126
+ - lib/locomotive/repository.rb
127
+ - locomotive_models.gemspec
128
+ - non_persisted_example.rb
129
+ - presenter_example.rb
130
+ - relation_example.rb
131
+ - spec/fixtures/example_entities.rb
132
+ - spec/fixtures/example_mapper.rb
133
+ - spec/fixtures/example_repositories.rb
134
+ - spec/integration/criteria_spec.rb
135
+ - spec/integration/persistence_entity_spec.rb
136
+ - spec/integration/relations_spec.rb
137
+ - spec/spec_helper.rb
138
+ - spec/support/adapters/memory.rb
139
+ - spec/unit/adapters/memory/condition_spec.rb
140
+ - spec/unit/adapters/memory/dataset_spec.rb
141
+ - spec/unit/adapters/memory/query_spec.rb
142
+ - spec/unit/decorators/i18n_decorator_spec.rb
143
+ - spec/unit/entity_spec.rb
144
+ - spec/unit/fields/i18n_field_spec.rb
145
+ - spec/unit/mapper_spec.rb
146
+ - spec/unit/mapping/coercer_spec.rb
147
+ - spec/unit/mapping/collection_spec.rb
148
+ - spec/unit/models_spec.rb
149
+ homepage: http://www.locomotivecms.com
150
+ licenses: []
151
+ metadata: {}
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: 1.3.6
166
+ requirements: []
167
+ rubyforge_project: locomotivecms_models
168
+ rubygems_version: 2.2.2
169
+ signing_key:
170
+ specification_version: 4
171
+ summary: LocomotiveCMS Models
172
+ test_files:
173
+ - spec/fixtures/example_entities.rb
174
+ - spec/fixtures/example_mapper.rb
175
+ - spec/fixtures/example_repositories.rb
176
+ - spec/integration/criteria_spec.rb
177
+ - spec/integration/persistence_entity_spec.rb
178
+ - spec/integration/relations_spec.rb
179
+ - spec/spec_helper.rb
180
+ - spec/support/adapters/memory.rb
181
+ - spec/unit/adapters/memory/condition_spec.rb
182
+ - spec/unit/adapters/memory/dataset_spec.rb
183
+ - spec/unit/adapters/memory/query_spec.rb
184
+ - spec/unit/decorators/i18n_decorator_spec.rb
185
+ - spec/unit/entity_spec.rb
186
+ - spec/unit/fields/i18n_field_spec.rb
187
+ - spec/unit/mapper_spec.rb
188
+ - spec/unit/mapping/coercer_spec.rb
189
+ - spec/unit/mapping/collection_spec.rb
190
+ - spec/unit/models_spec.rb