ar_pg_array 0.10.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Sokolov Yura aka funny_falcon
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,15 +1,15 @@
1
1
  require 'rake'
2
- require 'rdoc/task'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
3
4
 
4
- desc 'Test the postgres_arrays plugin.'
5
- task :test do
6
- Dir.chdir(File.dirname(__FILE__)) do
7
- Process.wait2 spawn('rspec spec')
8
- end
9
- end
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
10
7
 
11
- task :default do
12
- # nothing
8
+ desc 'Test the postgres_arrays plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
13
  end
14
14
 
15
15
  desc 'Generate documentation for the postgres_arrays plugin.'
@@ -20,3 +20,24 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('README')
21
21
  rdoc.rdoc_files.include('lib/**/*.rb')
22
22
  end
23
+
24
+ begin
25
+ require 'jeweler'
26
+ Jeweler::Tasks.new do |gemspec|
27
+ gemspec.name = "ar_pg_array"
28
+ gemspec.summary = "Use power of PostgreSQL Arrays in ActiveRecord"
29
+ gemspec.description = "ar_pg_array includes support of PostgreSQL's int[], float[], text[], timestamptz[] etc. into ActiveRecord. You could define migrations for array columns, query on array columns."
30
+ gemspec.email = "funny.falcon@gmail.com"
31
+ gemspec.homepage = "http://github.com/funny-falcon/activerecord-postgresql-arrays"
32
+ gemspec.authors = ["Sokolov Yura aka funny_falcon"]
33
+ gemspec.add_dependency('activerecord', '>= 3.0.6', '<4.0')
34
+ gemspec.rubyforge_project = 'ar-pg-array'
35
+ end
36
+ Jeweler::GemcutterTasks.new
37
+ Jeweler::RubyforgeTasks.new do |rubyforge|
38
+
39
+ end
40
+ rescue LoadError
41
+ puts "Jeweler not available. Install it with: gem install jeweler"
42
+ end
43
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.11.0
data/lib/ar_pg_array.rb CHANGED
@@ -7,4 +7,5 @@ require 'ar_pg_array/schema_cacheable'
7
7
  require 'ar_pg_array/querying'
8
8
  require 'ar_pg_array/allways_save'
9
9
  require 'ar_pg_array/references_by'
10
- require 'ar_pg_array/schema_fix_will_change'
10
+ require 'ar_pg_array/schema_arel'
11
+ require 'ar_pg_array/querying_arel'
@@ -1,21 +1,37 @@
1
1
  module ActiveRecord
2
- module CheckArrayBeforeUpdate
3
- def mark_arrays_for_update
4
- @attributes_cache.each do |name, value|
5
- attribute_will_change!(name) if Array === value && _read_attribute(name) != value
2
+ module CheckArrayBeforeUpdate
3
+ def mark_arrays_for_update
4
+ @attributes_cache.each do |name, value|
5
+ attribute_will_change!(name) if Array === value && _read_attribute(name) != value
6
+ end
6
7
  end
7
8
  end
8
- end
9
+ if VERSION::MAJOR < 3
10
+ module CheckArrayBeforeUpdate
11
+ def self.included(base)
12
+ base.alias_method_chain :update, :check_array
13
+ base.send(:alias_method, :_read_attribute, :read_attribute)
14
+ end
9
15
 
10
- module CheckArrayBeforeUpdate
11
- def self.included(base)
12
- base.alias_method_chain :update, :check_array
13
- base.send(:alias_method, :_read_attribute, :read_attribute)
16
+ def update_with_check_array
17
+ mark_arrays_for_update
18
+ update_without_check_array
19
+ end
14
20
  end
21
+ else
22
+ module CheckArrayBeforeUpdate
23
+ include ActiveSupport::Concern
15
24
 
16
- def update_with_check_array
17
- mark_arrays_for_update
18
- update_without_check_array
25
+ if VERSION::MAJOR == 3 && VERSION::MINOR >= 2
26
+ def _read_attribute(attr_name)
27
+ column_for_attribute(attr_name).type_cast(@attributes[attr_name])
28
+ end
29
+ end
30
+
31
+ def update(*)
32
+ mark_arrays_for_update
33
+ super
34
+ end
19
35
  end
20
36
  end
21
37
  Base.__send__ :include, CheckArrayBeforeUpdate
@@ -69,7 +69,7 @@ module PgArrayParser
69
69
  values << ar
70
70
  if rest =~ /^\}\s*/
71
71
  return values, $'
72
- elsif rest =~ /^,\s*\{\s*/
72
+ elsif rest =~ /^,\s*{\s*/
73
73
  rest = $'
74
74
  else
75
75
  raise "Mailformed postgres array"
@@ -97,28 +97,15 @@ module PgArrayParser
97
97
  end
98
98
  end
99
99
 
100
- def _remap_array(array, &block)
101
- array.map{|v|
102
- case v
103
- when Array
104
- _remap_array(v, &block)
105
- when nil
106
- nil
107
- else
108
- yield v
109
- end
110
- }
111
- end
112
-
113
100
  def prepare_pg_integer_array(value)
114
- val = _remap_array(value){|v| v.to_i}.inspect
101
+ val = value.map{|v| v.nil? ? nil : v.to_i}.inspect
115
102
  val.gsub!(NIL, NULL)
116
103
  val.tr!(SQUARE_BRACKETS, CURLY_BRACKETS)
117
104
  val
118
105
  end
119
106
 
120
107
  def prepare_pg_float_array(value)
121
- val = _remap_array(value){|v| v.to_f}.inspect
108
+ val = value.map{|v| v.nil? ? nil : v.to_f}.inspect
122
109
  val.gsub!(NIL, NULL)
123
110
  val.tr!(SQUARE_BRACKETS, CURLY_BRACKETS)
124
111
  val
@@ -152,11 +139,11 @@ module PgArrayParser
152
139
  "{#{value}}"
153
140
  end
154
141
 
155
- def _prepare_pg_string_array(value, &block)
142
+ def prepare_pg_string_array(value, &block)
156
143
  value = value.map{|val|
157
144
  case val
158
145
  when Array
159
- _prepare_pg_string_array(val, &block)
146
+ prepare_pg_string_array(val, &block)
160
147
  when nil
161
148
  NULL
162
149
  else
@@ -170,5 +157,4 @@ module PgArrayParser
170
157
  }.join(',')
171
158
  "{#{value}}"
172
159
  end
173
- alias prepare_pg_string_array _prepare_pg_string_array
174
160
  end
@@ -1,25 +1,11 @@
1
1
  module ActiveRecord
2
2
  class Base
3
3
  class << self
4
- def attribute_condition_with_postgresql_arrays(quoted_column_name, argument)
5
- if ::PGArrays::PgArray === argument
6
- case argument
7
- when ::PGArrays::PgAny then "#{quoted_column_name} && ?"
8
- when ::PGArrays::PgAll then "#{quoted_column_name} @> ?"
9
- when ::PGArrays::PgIncludes then "#{quoted_column_name} <@ ?"
10
- else "#{quoted_column_name} = ?"
11
- end
12
- else
13
- attribute_condition_without_postgresql_arrays(quoted_column_name, argument)
14
- end
15
- end
16
- alias_method_chain :attribute_condition, :postgresql_arrays
17
-
18
- def quote_bound_value_with_postgresql_arrays(value)
4
+ def quote_bound_value_with_postgresql_arrays(value, c = connection)
19
5
  if ::PGArrays::PgArray === value
20
- connection.quote_array_by_base_type(value, value.base_type)
6
+ c.quote_array_by_base_type(value, value.base_type)
21
7
  else
22
- quote_bound_value_without_postgresql_arrays(value)
8
+ quote_bound_value_without_postgresql_arrays(value, c)
23
9
  end
24
10
  end
25
11
  alias_method_chain :quote_bound_value, :postgresql_arrays
@@ -0,0 +1,168 @@
1
+ module Arel
2
+ module Nodes
3
+ class ArrayAny < Arel::Nodes::Binary
4
+ end
5
+
6
+ class ArrayAll < Arel::Nodes::Binary
7
+ end
8
+
9
+ class ArrayIncluded < Arel::Nodes::Binary
10
+ end
11
+ end
12
+
13
+ module Predications
14
+ def ar_any other
15
+ Nodes::ArrayAny.new self, other
16
+ end
17
+
18
+ def ar_all other
19
+ Nodes::ArrayAll.new self, other
20
+ end
21
+
22
+ def ar_included other
23
+ Nodes::ArrayIncluded.new self, other
24
+ end
25
+ end
26
+
27
+ module Visitors
28
+ class PostgreSQL
29
+ def visit_Arel_Nodes_ArrayAny o
30
+ "#{visit o.left} && #{visit o.right}"
31
+ end
32
+
33
+ def visit_Arel_Nodes_ArrayAll o
34
+ "#{visit o.left} @> #{visit o.right}"
35
+ end
36
+
37
+ def visit_Arel_Nodes_ArrayIncluded o
38
+ "#{visit o.left} <@ #{visit o.right}"
39
+ end
40
+
41
+ def visit_PGArrays_PgArray o
42
+ @connection.quote_array_by_base_type(o, o.base_type)
43
+ end
44
+
45
+ alias :visit_PGArrays_PgAny :visit_PGArrays_PgArray
46
+ alias :visit_PGArrays_PgAll :visit_PGArrays_PgArray
47
+ alias :visit_PGArrays_PgIncluded :visit_PGArrays_PgArray
48
+ end
49
+ end
50
+ end
51
+
52
+ if ActiveRecord::VERSION::STRING < '3.1'
53
+ module ActiveRecord
54
+ class PredicateBuilder
55
+ def build_from_hash(attributes, default_table)
56
+ predicates = attributes.map do |column, value|
57
+ table = default_table
58
+
59
+ if value.is_a?(Hash)
60
+ table = Arel::Table.new(column, :engine => @engine)
61
+ build_from_hash(value, table)
62
+ else
63
+ column = column.to_s
64
+
65
+ if column.include?('.')
66
+ table_name, column = column.split('.', 2)
67
+ table = Arel::Table.new(table_name, :engine => @engine)
68
+ end
69
+
70
+ attribute = table[column] || Arel::Attribute.new(table, column)
71
+
72
+ case value
73
+ when PGArrays::PgAny
74
+ attribute.ar_any(value)
75
+ when PGArrays::PgAll
76
+ attribute.ar_all(value)
77
+ when PGArrays::PgIncludes
78
+ attribute.ar_included(value)
79
+ when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation
80
+ values = value.to_a.map { |x|
81
+ x.is_a?(ActiveRecord::Base) ? x.id : x
82
+ }
83
+ attribute.in(values)
84
+ when Range, Arel::Relation
85
+ attribute.in(value)
86
+ when ActiveRecord::Base
87
+ attribute.eq(value.id)
88
+ when Class
89
+ # FIXME: I think we need to deprecate this behavior
90
+ attribute.eq(value.name)
91
+ else
92
+ attribute.eq(value)
93
+ end
94
+ end
95
+ end
96
+
97
+ predicates.flatten
98
+ end
99
+ end
100
+ end
101
+ else
102
+ module ActiveRecord
103
+ class PredicateBuilder
104
+ def self.build_from_hash(engine, attributes, default_table)
105
+ predicates = attributes.map do |column, value|
106
+ table = default_table
107
+
108
+ if value.is_a?(Hash)
109
+ table = Arel::Table.new(column, engine)
110
+ build_from_hash(engine, value, table)
111
+ else
112
+ column = column.to_s
113
+
114
+ if column.include?('.')
115
+ table_name, column = column.split('.', 2)
116
+ table = Arel::Table.new(table_name, engine)
117
+ end
118
+
119
+ attribute = table[column.to_sym]
120
+
121
+ case value
122
+ when PGArrays::PgAny
123
+ attribute.ar_any(value)
124
+ when PGArrays::PgAll
125
+ attribute.ar_all(value)
126
+ when PGArrays::PgIncludes
127
+ attribute.ar_included(value)
128
+ when ActiveRecord::Relation
129
+ value = value.select(value.klass.arel_table[value.klass.primary_key]) if value.select_values.empty?
130
+ attribute.in(value.arel.ast)
131
+ when Array, ActiveRecord::Associations::CollectionProxy
132
+ values = value.to_a.map { |x|
133
+ x.is_a?(ActiveRecord::Base) ? x.id : x
134
+ }
135
+
136
+ ranges, values = values.partition{|v| v.is_a?(Range) || v.is_a?(Arel::Relation)}
137
+ predicates = ranges.map{|range| attribute.in(range)}
138
+
139
+ predicates << if values.include?(nil)
140
+ values = values.compact
141
+ if values.empty?
142
+ attribute.eq nil
143
+ else
144
+ attribute.in(values.compact).or attribute.eq(nil)
145
+ end
146
+ else
147
+ attribute.in(values)
148
+ end
149
+
150
+ predicates.inject{|composite, predicate| composite.or(predicate)}
151
+ when Range, Arel::Relation
152
+ attribute.in(value)
153
+ when ActiveRecord::Base
154
+ attribute.eq(value.id)
155
+ when Class
156
+ # FIXME: I think we need to deprecate this behavior
157
+ attribute.eq(value.name)
158
+ else
159
+ attribute.eq(value)
160
+ end
161
+ end
162
+ end
163
+
164
+ predicates.flatten
165
+ end
166
+ end
167
+ end
168
+ end
@@ -181,7 +181,7 @@ module ActiveRecord
181
181
  else
182
182
  PostgreSQLColumn::BASE_TYPE_COLUMNS[base_type.to_sym]
183
183
  end
184
- _prepare_pg_string_array(value){|v| quote_without_postgresql_arrays(v, base_column)}
184
+ super(value){|v| quote_without_postgresql_arrays(v, base_column)}
185
185
  end
186
186
 
187
187
  NATIVE_DATABASE_TYPES.keys.each do |key|
@@ -0,0 +1,47 @@
1
+ module Arel
2
+ module Attributes
3
+ %w{Integer Float Decimal Boolean String Time}.each do |basetype|
4
+ module_eval <<-"END"
5
+ class #{basetype}Array < Attribute
6
+ end
7
+ END
8
+ end
9
+ end
10
+
11
+ module Attributes
12
+ class << self
13
+ def for_with_postgresql_arrays(column)
14
+ if column.type.to_s =~ /^(.+)_array$/
15
+ ('Arel::Attributes::' + for_without_postgresql_arrays(column.base_column).name.split('::').last + 'Array').constantize
16
+ else
17
+ for_without_postgresql_arrays(column)
18
+ end
19
+ end
20
+ alias_method_chain :for, :postgresql_arrays
21
+ end
22
+ end
23
+ end
24
+
25
+ module ActiveRecord
26
+ class << Base
27
+ if method_defined?(:column_defaults)
28
+ alias column_defaults_without_extradup column_defaults
29
+ def column_defaults_with_extradup
30
+ res = {}
31
+ column_defaults_without_extradup.each{|k, v|
32
+ res[k] = Array === v ? v.dup : v
33
+ }
34
+ res
35
+ end
36
+ def column_defaults
37
+ defaults = column_defaults_without_extradup
38
+ if defaults.values.grep(Array).empty?
39
+ alias column_defaults column_defaults_without_extradup
40
+ else
41
+ alias column_defaults column_defaults_with_extradup
42
+ end
43
+ column_defaults
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,4 +1,4 @@
1
- atcbd = ActiveRecord::AttributeMethods::ATTRIBUTE_TYPES_CACHED_BY_DEFAULT
1
+ atcbd = ActiveRecord::AttributeMethods::Read::ATTRIBUTE_TYPES_CACHED_BY_DEFAULT
2
2
 
3
3
  atcbd << /_array$/
4
4
  def atcbd.include?(val)
@@ -1,5 +1,2 @@
1
1
  class Bulk < ActiveRecord::Base
2
2
  end
3
-
4
- class Bulk1 < Bulk
5
- end
@@ -28,7 +28,6 @@ fourth:
28
28
  decimals: [ ]
29
29
  fifth:
30
30
  id: 5
31
- type: "Bulk1"
32
31
  ints: [ 10 ]
33
32
  strings: [ "#{1+1}", "\\#{1+1}\"'\\z\x01", "\t\n" ]
34
33
  times: [ ]
@@ -12,7 +12,6 @@ ActiveRecord::Schema.define do
12
12
  end
13
13
 
14
14
  create_table "bulks", :force => true do |t|
15
- t.string :type, :default => "Bulk"
16
15
  t.string :value, :default => "'"
17
16
  t.integer_array :ints, :default => [1, 2]
18
17
  t.string_array :strings, :default => %w{as so}
@@ -20,7 +19,6 @@ ActiveRecord::Schema.define do
20
19
  t.float_array :floats, :default => [1.0, 1.2]
21
20
  t.decimal_array :decimals, :default => [1.0, 1.2]
22
21
  t.text_array :texts, :default => [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
23
- t.integer_array :empty_def, :default => []
24
22
  end
25
23
 
26
24
  create_table "unrelateds", :force => true do |t|
@@ -72,7 +72,7 @@ describe "PgArray" do
72
72
  bulk.floats.should == [1.0, 2.3]
73
73
  bulk.decimals.should == [1.0, 2.3]
74
74
  end
75
-
75
+
76
76
  it "should be created with defaults" do
77
77
  bulk = Bulk.new
78
78
  bulk.ints.should == [1, 2]
@@ -82,22 +82,6 @@ describe "PgArray" do
82
82
  bulk.texts.should == [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
83
83
  map_times(bulk.times).should ==
84
84
  map_times(parse_times(%w{2010-01-01 2010-02-01}))
85
- bulk.empty_def.should == []
86
- end
87
-
88
- it "should be able to insert" do
89
- bulki = Bulk.new
90
- bulki.save
91
- bulk = Bulk.find(bulki.id)
92
- bulk.ints.should == [1, 2]
93
- bulk.strings.should == %w{as so}
94
- bulk.floats.should == [1.0, 1.2]
95
- bulk.decimals.should == [1.0, 1.2]
96
- bulk.texts.should == [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !"\\', 'nil']
97
- map_times(bulk.times).should ==
98
- map_times(parse_times(%w{2010-01-01 2010-02-01}))
99
- bulk.empty_def.should == []
100
- bulk.destroy
101
85
  end
102
86
 
103
87
  it "should not alter defaults" do
@@ -123,40 +107,11 @@ describe "PgArray" do
123
107
 
124
108
  it "should save right text" do
125
109
  bulk = Bulk.find(5)
126
- bulk.texts = ['Text with , nil, !\x01\\\'"',"Text with , nil, !\x01\n\\\'\""]
110
+ bulk.texts = ['Text with , nil, !\x01\\\'"',"Text with , nil, !\x01\\\'\""]
127
111
  bulk.save!
128
112
  bulk.texts = []
129
113
  bulk = Bulk.find(:first, :conditions=>'5 = id')
130
- bulk.texts.should == ['Text with , nil, !\x01\\\'"',"Text with , nil, !\x01\n\\\'\""]
131
- end
132
-
133
- it "should save nested arrays" do
134
- Bulk.transaction do
135
- bulk = Bulk.find(3)
136
- bulk.ints = [[1,2],[3,4]]
137
- bulk.floats = [[1.0, 2.3e34],[3.43,6.21]]
138
- bulk.times = [parse_times(%w{2010-04-01 2011-04-01}), parse_times(%w{2011-05-01 2010-05-01})]
139
- bulk.save!
140
- bulk = Bulk.find(:first, :conditions=>'3 = id')
141
- bulk.ints.should == [[1,2],[3,4]]
142
- bulk.floats.should == [[1.0, 2.3e34],[3.43,6.21]]
143
- bulk.times.map{|ts| map_times(ts)}.should == [
144
- map_times(parse_times(%w{2010-04-01 2011-04-01})),
145
- map_times(parse_times(%w{2011-05-01 2010-05-01}))]
146
- raise ActiveRecord::Rollback
147
- end
148
- end
149
-
150
- it "should save right nested text" do
151
- Bulk.transaction do
152
- bulk = Bulk.find(5)
153
- bulk.texts = [['Text with , nil, !\x01\\\'"',"Text with , nil, !\x01\n\\\'\""], ['asdf', 'fdsa']]
154
- bulk.save!
155
- bulk.texts = []
156
- bulk = Bulk.find(:first, :conditions=>'5 = id')
157
- bulk.texts.should == [['Text with , nil, !\x01\\\'"',"Text with , nil, !\x01\n\\\'\""], ['asdf', 'fdsa']]
158
- raise ActiveRecord::Rollback
159
- end
114
+ bulk.texts.should == ['Text with , nil, !\x01\\\'"',"Text with , nil, !\x01\\\'\""]
160
115
  end
161
116
 
162
117
  it "should be safe for eval" do
@@ -237,19 +192,6 @@ describe "PgArray" do
237
192
  model2.for_custom_serialize.to_yaml.should == obj.to_yaml
238
193
  end
239
194
 
240
- it 'should be workable with sti' do
241
- obj = Bulk1.where(:ints => [10].pg).first
242
- obj.should be_instance_of Bulk1
243
- obj.floats = [1.1, 2.2]
244
- obj.save
245
- obj1 = Bulk.find(obj.id)
246
- obj1.should be_instance_of Bulk1
247
- obj1.floats.should == [1.1, 2.2]
248
- obj2 = Bulk1.new
249
- obj2.save
250
- obj2.destroy
251
- end
252
-
253
195
  def map_times(times)
254
196
  times.map{|t| t.strftime("%F %T")}
255
197
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_pg_array
3
3
  version: !ruby/object:Gem::Version
4
+ version: 0.11.0
4
5
  prerelease:
5
- version: 0.10.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sokolov Yura aka funny_falcon
@@ -12,7 +12,7 @@ cert_chain: []
12
12
  date: 2012-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- type: :runtime
15
+ name: activerecord
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
@@ -22,6 +22,7 @@ dependencies:
22
22
  - - ! '>='
23
23
  - !ruby/object:Gem::Version
24
24
  version: 3.0.6
25
+ type: :runtime
25
26
  prerelease: false
26
27
  version_requirements: !ruby/object:Gem::Requirement
27
28
  none: false
@@ -32,7 +33,6 @@ dependencies:
32
33
  - - ! '>='
33
34
  - !ruby/object:Gem::Version
34
35
  version: 3.0.6
35
- name: activerecord
36
36
  description: ar_pg_array includes support of PostgreSQL's int[], float[], text[],
37
37
  timestamptz[] etc. into ActiveRecord. You could define migrations for array columns,
38
38
  query on array columns.
@@ -42,31 +42,33 @@ extensions: []
42
42
  extra_rdoc_files:
43
43
  - README
44
44
  files:
45
+ - MIT-LICENSE
46
+ - README
47
+ - Rakefile
48
+ - VERSION
49
+ - init.rb
45
50
  - lib/ar_pg_array.rb
46
- - lib/ar_pg_array/schema_cacheable.rb
47
- - lib/ar_pg_array/references_by.rb
48
- - lib/ar_pg_array/querying.rb
49
51
  - lib/ar_pg_array/allways_save.rb
50
- - lib/ar_pg_array/schema_fix_will_change.rb
51
52
  - lib/ar_pg_array/parser.rb
53
+ - lib/ar_pg_array/querying.rb
54
+ - lib/ar_pg_array/querying_arel.rb
55
+ - lib/ar_pg_array/references_by.rb
52
56
  - lib/ar_pg_array/schema.rb
53
- - spec/spec_helper.rb
54
- - spec/spec.opts
57
+ - lib/ar_pg_array/schema_arel.rb
58
+ - lib/ar_pg_array/schema_cacheable.rb
59
+ - lib/ar_pg_array/schema_fix_will_change.rb
60
+ - spec/fixtures/bulk.rb
55
61
  - spec/fixtures/bulks.yml
56
- - spec/fixtures/tags.yml
57
- - spec/fixtures/unrelateds.yml
58
- - spec/fixtures/tag.rb
59
- - spec/fixtures/items.yml
60
62
  - spec/fixtures/item.rb
63
+ - spec/fixtures/items.yml
61
64
  - spec/fixtures/schema.rb
62
- - spec/fixtures/bulk.rb
65
+ - spec/fixtures/tag.rb
66
+ - spec/fixtures/tags.yml
63
67
  - spec/fixtures/unrelated.rb
68
+ - spec/fixtures/unrelateds.yml
64
69
  - spec/pg_array_spec.rb
65
- - Gemfile
66
- - init.rb
67
- - README
68
- - Rakefile
69
- - ar_pg_array.gemspec
70
+ - spec/spec.opts
71
+ - spec/spec_helper.rb
70
72
  homepage: http://github.com/funny-falcon/activerecord-postgresql-arrays
71
73
  licenses: []
72
74
  post_install_message:
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "activerecord", ">= 2.3.5", "< 3.0"
4
- group :development, :test do
5
- gem "fake_arel"
6
- gem "cancan"
7
- gem "pg"
8
- gem "rspec"
9
- end
data/ar_pg_array.gemspec DELETED
@@ -1,34 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "ar_pg_array"
8
- s.version = "0.10.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Sokolov Yura aka funny_falcon"]
12
- s.date = "2012-06-03"
13
- s.description = "ar_pg_array includes support of PostgreSQL's int[], float[], text[], timestamptz[] etc. into ActiveRecord. You could define migrations for array columns, query on array columns."
14
- s.email = "funny.falcon@gmail.com"
15
- s.extra_rdoc_files = [ "README" ]
16
- s.files = (Dir['lib/**/*']+Dir['spec/**/*']+%w{Gemfile init.rb MIT_LICENSE README Rakefile ar_pg_array.gemspec}).find_all{|f| File.file?(f)}
17
- s.homepage = "http://github.com/funny-falcon/activerecord-postgresql-arrays"
18
- s.require_paths = ["lib"]
19
- s.rubyforge_project = "ar-pg-array"
20
- s.summary = "Use power of PostgreSQL Arrays in ActiveRecord"
21
-
22
- if s.respond_to? :specification_version then
23
- s.specification_version = 3
24
-
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<activerecord>, ["< 4.0", ">= 3.0.6"])
27
- else
28
- s.add_dependency(%q<activerecord>, ["< 4.0", ">= 3.0.6"])
29
- end
30
- else
31
- s.add_dependency(%q<activerecord>, ["< 4.0", ">= 3.0.6"])
32
- end
33
- end
34
-