hydra_attribute 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -7,4 +7,4 @@ gemfile:
7
7
  env:
8
8
  - DB=sqlite
9
9
  - DB=mysql
10
- - DB=postgresql
10
+ - DB=postgresql
data/README.md CHANGED
@@ -1,6 +1,14 @@
1
- # hydra_attribute [![Gem Version](https://fury-badge.herokuapp.com/rb/hydra_attribute.png)](http://badge.fury.io/rb/hydra_attribute) [![Build Status](https://travis-ci.org/kostyantyn/hydra_attribute.png?branch=value_model_optimization)](https://travis-ci.org/kostyantyn/hydra_attribute)
1
+ # hydra_attribute
2
+ [![Gem Version](http://img.shields.io/gem/v/hydra_attribute.svg)](http://rubygems.org/gems/hydra_attribute)
3
+ [![Build Status](http://img.shields.io/travis/kostyantyn/hydra_attribute.svg)](https://travis-ci.org/kostyantyn/hydra_attribute)
4
+ [![Coverage Status](http://img.shields.io/coveralls/kostyantyn/hydra_attribute.svg)](https://coveralls.io/r/kostyantyn/hydra_attribute?branch=master)
5
+ [![Code Climate](http://img.shields.io/codeclimate/github/kostyantyn/hydra_attribute.svg)](https://codeclimate.com/github/kostyantyn/hydra_attribute)
6
+ [![Dependency Status](http://img.shields.io/gemnasium/kostyantyn/hydra_attribute.svg)](https://gemnasium.com/kostyantyn/hydra_attribute)
7
+ [![Inline docs](http://inch-pages.github.io/github/kostyantyn/hydra_attribute.png)](http://inch-pages.github.io/github/kostyantyn/hydra_attribute)
2
8
 
3
- [Wiki](https://github.com/kostyantyn/hydra_attribute/wiki) | [RDoc](http://rdoc.info/github/kostyantyn/hydra_attribute)
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 ~> 3.2
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
 
@@ -2,4 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'activerecord', '~> 3.2.0'
4
4
 
5
- gemspec path: '../'
5
+ if ENV['CI']
6
+ gem 'coveralls', require: false
7
+ end
8
+
9
+ gemspec path: '../'
@@ -21,4 +21,5 @@ Gem::Specification.new do |gem|
21
21
  gem.add_development_dependency('mysql2')
22
22
  gem.add_development_dependency('pg')
23
23
  gem.add_development_dependency('rake')
24
+ gem.add_development_dependency('simplecov')
24
25
  end
@@ -8,8 +8,8 @@ module HydraAttribute
8
8
  def call(env)
9
9
  @app.call(env)
10
10
  ensure
11
- HydraAttribute.identity_map.clear
11
+ ::HydraAttribute.identity_map.clear
12
12
  end
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module HydraAttribute
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -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
@@ -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.0
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-02-16 00:00:00.000000000 Z
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: 674176034611536681
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