hydra_attribute 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gitignore +20 -0
  2. data/.rspec +2 -0
  3. data/Appraisals +7 -0
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +22 -0
  7. data/README.md +122 -0
  8. data/Rakefile +12 -0
  9. data/features/attribute_methods.feature +151 -0
  10. data/features/define_attributes.feature +61 -0
  11. data/features/load_associations.feature +45 -0
  12. data/features/order_conditions.feature +93 -0
  13. data/features/select_attributes.feature +56 -0
  14. data/features/step_definitions/class_steps.rb +32 -0
  15. data/features/step_definitions/model_steps.rb +31 -0
  16. data/features/step_definitions/record_steps.rb +103 -0
  17. data/features/support/env.rb +24 -0
  18. data/features/support/schema.rb +51 -0
  19. data/features/support/world.rb +31 -0
  20. data/features/typecast_attributes.feature +29 -0
  21. data/features/where_conditions.feature +77 -0
  22. data/gemfiles/3.1.gemfile +7 -0
  23. data/gemfiles/3.1.gemfile.lock +60 -0
  24. data/gemfiles/3.2.gemfile +7 -0
  25. data/gemfiles/3.2.gemfile.lock +60 -0
  26. data/hydra_attribute.gemspec +24 -0
  27. data/lib/generators/hydra_attribute/install/USAGE +8 -0
  28. data/lib/generators/hydra_attribute/install/install_generator.rb +11 -0
  29. data/lib/generators/hydra_attribute/install/templates/hydra_attribute.txt +11 -0
  30. data/lib/hydra_attribute.rb +31 -0
  31. data/lib/hydra_attribute/active_record.rb +7 -0
  32. data/lib/hydra_attribute/active_record/attribute_methods.rb +72 -0
  33. data/lib/hydra_attribute/active_record/attribute_methods/before_type_cast.rb +16 -0
  34. data/lib/hydra_attribute/active_record/attribute_methods/read.rb +13 -0
  35. data/lib/hydra_attribute/active_record/relation.rb +44 -0
  36. data/lib/hydra_attribute/active_record/relation/query_methods.rb +162 -0
  37. data/lib/hydra_attribute/active_record/scoping.rb +15 -0
  38. data/lib/hydra_attribute/association_builder.rb +40 -0
  39. data/lib/hydra_attribute/attribute_builder.rb +57 -0
  40. data/lib/hydra_attribute/attribute_proxy.rb +16 -0
  41. data/lib/hydra_attribute/builder.rb +25 -0
  42. data/lib/hydra_attribute/configuration.rb +47 -0
  43. data/lib/hydra_attribute/migration.rb +27 -0
  44. data/lib/hydra_attribute/railtie.rb +9 -0
  45. data/lib/hydra_attribute/version.rb +3 -0
  46. data/spec/hydra_attribute/active_record/relation/query_methods_spec.rb +286 -0
  47. data/spec/hydra_attribute/active_record/relation_spec.rb +93 -0
  48. data/spec/hydra_attribute/active_record/scoping_spec.rb +19 -0
  49. data/spec/hydra_attribute/active_record_spec.rb +20 -0
  50. data/spec/hydra_attribute/association_builder_spec.rb +95 -0
  51. data/spec/hydra_attribute/attribute_builder_spec.rb +70 -0
  52. data/spec/hydra_attribute/attribute_helpers_spec.rb +70 -0
  53. data/spec/hydra_attribute/builder_spec.rb +39 -0
  54. data/spec/hydra_attribute/configuration_spec.rb +96 -0
  55. data/spec/hydra_attribute_spec.rb +20 -0
  56. data/spec/spec_helper.rb +17 -0
  57. metadata +196 -0
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe HydraAttribute do
4
+ describe '.config' do
5
+ it 'should return and instance of HydraAttribute::Configuration' do
6
+ HydraAttribute.config.should be_a_kind_of(HydraAttribute::Configuration)
7
+ end
8
+
9
+ it 'should cache config object' do
10
+ HydraAttribute.config.should be_equal(HydraAttribute.config)
11
+ end
12
+ end
13
+
14
+ describe '.setup' do
15
+ it 'should allow to change default configuration' do
16
+ HydraAttribute.setup { |config| config.table_prefix = 'custom_table_prefix' }
17
+ HydraAttribute.config.table_prefix.should == 'custom_table_prefix'
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ require 'active_record'
2
+ require 'hydra_attribute'
3
+
4
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
5
+ ActiveRecord::Base.extend(HydraAttribute::ActiveRecord)
6
+
7
+ require 'database_cleaner'
8
+ RSpec.configure do |config|
9
+ config.before do
10
+ HydraAttribute.instance_variable_set(:@config, nil)
11
+ DatabaseCleaner.start
12
+ end
13
+
14
+ config.after do
15
+ DatabaseCleaner.clean
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,196 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hydra_attribute
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Kostyantyn Stepanyuk
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-05 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activerecord
16
+ requirement: &2156374640 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2156374640
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &2156374240 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2156374240
36
+ - !ruby/object:Gem::Dependency
37
+ name: cucumber
38
+ requirement: &2156373780 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2156373780
47
+ - !ruby/object:Gem::Dependency
48
+ name: sqlite3
49
+ requirement: &2156373340 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2156373340
58
+ - !ruby/object:Gem::Dependency
59
+ name: database_cleaner
60
+ requirement: &2156372920 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2156372920
69
+ - !ruby/object:Gem::Dependency
70
+ name: appraisal
71
+ requirement: &2156372500 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2156372500
80
+ description: hydra_attribute allows to use EAV database structure for ActiveRecord
81
+ models.
82
+ email: kostya.stepanyuk@gmail.com
83
+ executables: []
84
+ extensions: []
85
+ extra_rdoc_files: []
86
+ files:
87
+ - .gitignore
88
+ - .rspec
89
+ - Appraisals
90
+ - CHANGELOG.md
91
+ - Gemfile
92
+ - LICENSE
93
+ - README.md
94
+ - Rakefile
95
+ - features/attribute_methods.feature
96
+ - features/define_attributes.feature
97
+ - features/load_associations.feature
98
+ - features/order_conditions.feature
99
+ - features/select_attributes.feature
100
+ - features/step_definitions/class_steps.rb
101
+ - features/step_definitions/model_steps.rb
102
+ - features/step_definitions/record_steps.rb
103
+ - features/support/env.rb
104
+ - features/support/schema.rb
105
+ - features/support/world.rb
106
+ - features/typecast_attributes.feature
107
+ - features/where_conditions.feature
108
+ - gemfiles/3.1.gemfile
109
+ - gemfiles/3.1.gemfile.lock
110
+ - gemfiles/3.2.gemfile
111
+ - gemfiles/3.2.gemfile.lock
112
+ - hydra_attribute.gemspec
113
+ - lib/generators/hydra_attribute/install/USAGE
114
+ - lib/generators/hydra_attribute/install/install_generator.rb
115
+ - lib/generators/hydra_attribute/install/templates/hydra_attribute.txt
116
+ - lib/hydra_attribute.rb
117
+ - lib/hydra_attribute/active_record.rb
118
+ - lib/hydra_attribute/active_record/attribute_methods.rb
119
+ - lib/hydra_attribute/active_record/attribute_methods/before_type_cast.rb
120
+ - lib/hydra_attribute/active_record/attribute_methods/read.rb
121
+ - lib/hydra_attribute/active_record/relation.rb
122
+ - lib/hydra_attribute/active_record/relation/query_methods.rb
123
+ - lib/hydra_attribute/active_record/scoping.rb
124
+ - lib/hydra_attribute/association_builder.rb
125
+ - lib/hydra_attribute/attribute_builder.rb
126
+ - lib/hydra_attribute/attribute_proxy.rb
127
+ - lib/hydra_attribute/builder.rb
128
+ - lib/hydra_attribute/configuration.rb
129
+ - lib/hydra_attribute/migration.rb
130
+ - lib/hydra_attribute/railtie.rb
131
+ - lib/hydra_attribute/version.rb
132
+ - spec/hydra_attribute/active_record/relation/query_methods_spec.rb
133
+ - spec/hydra_attribute/active_record/relation_spec.rb
134
+ - spec/hydra_attribute/active_record/scoping_spec.rb
135
+ - spec/hydra_attribute/active_record_spec.rb
136
+ - spec/hydra_attribute/association_builder_spec.rb
137
+ - spec/hydra_attribute/attribute_builder_spec.rb
138
+ - spec/hydra_attribute/attribute_helpers_spec.rb
139
+ - spec/hydra_attribute/builder_spec.rb
140
+ - spec/hydra_attribute/configuration_spec.rb
141
+ - spec/hydra_attribute_spec.rb
142
+ - spec/spec_helper.rb
143
+ homepage: ''
144
+ licenses: []
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: 1.9.2
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 1.8.10
164
+ signing_key:
165
+ specification_version: 3
166
+ summary: hydra_attribute allows to use EAV database structure for ActiveRecord models.
167
+ test_files:
168
+ - Appraisals
169
+ - features/attribute_methods.feature
170
+ - features/define_attributes.feature
171
+ - features/load_associations.feature
172
+ - features/order_conditions.feature
173
+ - features/select_attributes.feature
174
+ - features/step_definitions/class_steps.rb
175
+ - features/step_definitions/model_steps.rb
176
+ - features/step_definitions/record_steps.rb
177
+ - features/support/env.rb
178
+ - features/support/schema.rb
179
+ - features/support/world.rb
180
+ - features/typecast_attributes.feature
181
+ - features/where_conditions.feature
182
+ - gemfiles/3.1.gemfile
183
+ - gemfiles/3.1.gemfile.lock
184
+ - gemfiles/3.2.gemfile
185
+ - gemfiles/3.2.gemfile.lock
186
+ - spec/hydra_attribute/active_record/relation/query_methods_spec.rb
187
+ - spec/hydra_attribute/active_record/relation_spec.rb
188
+ - spec/hydra_attribute/active_record/scoping_spec.rb
189
+ - spec/hydra_attribute/active_record_spec.rb
190
+ - spec/hydra_attribute/association_builder_spec.rb
191
+ - spec/hydra_attribute/attribute_builder_spec.rb
192
+ - spec/hydra_attribute/attribute_helpers_spec.rb
193
+ - spec/hydra_attribute/builder_spec.rb
194
+ - spec/hydra_attribute/configuration_spec.rb
195
+ - spec/hydra_attribute_spec.rb
196
+ - spec/spec_helper.rb