hydra_attribute 0.5.0 → 0.5.1
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.
- data/.coveralls.yml +1 -0
- data/.travis.yml +1 -1
- data/README.md +13 -3
- data/gemfiles/activerecord-3.2.gemfile +5 -1
- data/hydra_attribute.gemspec +1 -0
- data/lib/hydra_attribute/middleware/identity_map.rb +2 -2
- data/lib/hydra_attribute/version.rb +1 -1
- data/spec/hydra_attribute/middleware/identity_map_spec.rb +21 -0
- data/spec/spec_helper.rb +13 -1
- metadata +22 -3
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
# hydra_attribute
|
1
|
+
# hydra_attribute
|
2
|
+
[](http://rubygems.org/gems/hydra_attribute)
|
3
|
+
[](https://travis-ci.org/kostyantyn/hydra_attribute)
|
4
|
+
[](https://coveralls.io/r/kostyantyn/hydra_attribute?branch=master)
|
5
|
+
[](https://codeclimate.com/github/kostyantyn/hydra_attribute)
|
6
|
+
[](https://gemnasium.com/kostyantyn/hydra_attribute)
|
7
|
+
[](http://inch-pages.github.io/github/kostyantyn/hydra_attribute)
|
2
8
|
|
3
|
-
|
9
|
+
|
10
|
+
|
11
|
+
[Demo](http://ec2-54-229-138-34.eu-west-1.compute.amazonaws.com) | [Wiki](https://github.com/kostyantyn/hydra_attribute/wiki) | [RDoc](http://rdoc.info/github/kostyantyn/hydra_attribute)
|
4
12
|
|
5
13
|
hydra_attribute is an implementation of
|
6
14
|
[EAV (Entity-Attribute-Value) pattern](http://en.wikipedia.org/wiki/Entity–attribute–value_model) for ActiveRecord models. It allows to create or remove attributes in runtime. Also each record may have different sets of attributes, for example: Product with ID 1 can have different set of attributes than Product with ID 2.
|
@@ -11,13 +19,15 @@ Until the first major version is released:
|
|
11
19
|
|
12
20
|
## Requirements
|
13
21
|
* ruby >= 1.9.2
|
14
|
-
* active_record
|
22
|
+
* active_record >= 3.2
|
15
23
|
|
16
24
|
## Installation
|
17
25
|
|
18
26
|
Add the following line to Gemfile:
|
19
27
|
```ruby
|
20
28
|
gem 'hydra_attribute'
|
29
|
+
# or for rails 4
|
30
|
+
# gem 'hydra_attribute', github: 'kostyantyn/hydra_attribute', branch: 'rails4'
|
21
31
|
```
|
22
32
|
and run `bundle install` from your shell.
|
23
33
|
|
data/hydra_attribute.gemspec
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'hydra_attribute/middleware/identity_map'
|
3
|
+
|
4
|
+
describe HydraAttribute::Middleware::IdentityMap do
|
5
|
+
describe '#call' do
|
6
|
+
let(:app) do
|
7
|
+
lambda do |*|
|
8
|
+
::HydraAttribute.identity_map[:key2] = :value2
|
9
|
+
expect(::HydraAttribute.identity_map).to eq(key: :value, key2: :value2)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
before { ::HydraAttribute.identity_map[:key] = :value }
|
14
|
+
|
15
|
+
it 'should clear identity map after request' do
|
16
|
+
expect(app).to receive(:call).and_call_original
|
17
|
+
HydraAttribute::Middleware::IdentityMap.new(app).call(nil)
|
18
|
+
expect(::HydraAttribute.identity_map).to eq({})
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
if ENV['CI']
|
2
|
+
require 'coveralls'
|
3
|
+
Coveralls.wear! do
|
4
|
+
add_filter 'spec'
|
5
|
+
end
|
6
|
+
else
|
7
|
+
require 'simplecov'
|
8
|
+
SimpleCov.start do
|
9
|
+
add_filter 'spec'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
1
13
|
require 'hydra_attribute'
|
2
14
|
|
3
15
|
ActiveSupport.on_load(:active_record) do
|
@@ -21,4 +33,4 @@ RSpec.configure do |config|
|
|
21
33
|
config.before do
|
22
34
|
Thread.current[:hydra_attribute] = nil
|
23
35
|
end
|
24
|
-
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra_attribute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -107,6 +107,22 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: simplecov
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
110
126
|
description: hydra_attribute is an implementation of EAV pattern for ActiveRecord
|
111
127
|
models.
|
112
128
|
email: kostya.stepanyuk@gmail.com
|
@@ -114,6 +130,7 @@ executables: []
|
|
114
130
|
extensions: []
|
115
131
|
extra_rdoc_files: []
|
116
132
|
files:
|
133
|
+
- .coveralls.yml
|
117
134
|
- .gitignore
|
118
135
|
- .rspec
|
119
136
|
- .travis.yml
|
@@ -175,6 +192,7 @@ files:
|
|
175
192
|
- spec/hydra_attribute/hydra_set_spec.rb
|
176
193
|
- spec/hydra_attribute/hydra_value_spec.rb
|
177
194
|
- spec/hydra_attribute/identity_map_spec.rb
|
195
|
+
- spec/hydra_attribute/middleware/identity_map_spec.rb
|
178
196
|
- spec/hydra_attribute/migrator_spec.rb
|
179
197
|
- spec/hydra_attribute/model/cacheable_spec.rb
|
180
198
|
- spec/hydra_attribute/model/has_many_through_spec.rb
|
@@ -204,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
222
|
version: '0'
|
205
223
|
segments:
|
206
224
|
- 0
|
207
|
-
hash:
|
225
|
+
hash: 71879805353342866
|
208
226
|
requirements: []
|
209
227
|
rubyforge_project:
|
210
228
|
rubygems_version: 1.8.25
|
@@ -230,6 +248,7 @@ test_files:
|
|
230
248
|
- spec/hydra_attribute/hydra_set_spec.rb
|
231
249
|
- spec/hydra_attribute/hydra_value_spec.rb
|
232
250
|
- spec/hydra_attribute/identity_map_spec.rb
|
251
|
+
- spec/hydra_attribute/middleware/identity_map_spec.rb
|
233
252
|
- spec/hydra_attribute/migrator_spec.rb
|
234
253
|
- spec/hydra_attribute/model/cacheable_spec.rb
|
235
254
|
- spec/hydra_attribute/model/has_many_through_spec.rb
|