postgres_ext 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.travis.yml +4 -1
- data/CHANGELOG.md +7 -1
- data/README.md +107 -2
- data/Rakefile +0 -9
- data/lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb +9 -2
- data/lib/postgres_ext/arel/nodes/contained_within.rb +4 -2
- data/lib/postgres_ext/arel/predications.rb +5 -1
- data/lib/postgres_ext/arel/visitors/to_sql.rb +20 -0
- data/lib/postgres_ext/version.rb +1 -1
- data/postgres_ext.gemspec +6 -3
- data/spec/arel/array_spec.rb +39 -0
- data/spec/arel/inet_spec.rb +33 -0
- data/spec/models/array_spec.rb +51 -33
- data/spec/models/inet_spec.rb +79 -0
- data/spec/spec_helper.rb +7 -0
- metadata +12 -22
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
## 0.0.7
|
2
|
+
|
3
|
+
Adds Arel predicate functions for array overlap operator (`&&`) and
|
4
|
+
INET/CIDR contained within operator (`<<`)
|
5
|
+
|
1
6
|
## 0.0.6
|
2
7
|
|
3
8
|
Lots of array related fixes:
|
4
9
|
* Model creation should no longer fail when not assigning a value to an
|
5
10
|
array column
|
6
11
|
* Array columns follow database defaults
|
7
|
-
|
12
|
+
|
13
|
+
Migration fix (rn0 and gilltots)
|
8
14
|
Typos in README (bcardarella)
|
data/README.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
Adds support for missing PostgreSQL data types to ActiveRecord.
|
4
4
|
|
5
|
-
|
5
|
+
[![Build Status](https://secure.travis-ci.org/dockyard/postgres_ext.png?branch=master)](http://travis-ci.org/dockyard/postgres_ext)
|
6
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/dockyard/postgres_ext)
|
6
7
|
|
7
8
|
## Roadmap
|
8
9
|
|
@@ -25,11 +26,20 @@ Or install it yourself as:
|
|
25
26
|
|
26
27
|
## Usage
|
27
28
|
|
28
|
-
Just `require 'postgres_ext'` and use ActiveRecord as you normally would!
|
29
|
+
Just `require 'postgres_ext'` and use ActiveRecord as you normally would! postgres\_ext extends
|
29
30
|
ActiveRecord's data type handling.
|
30
31
|
|
31
32
|
* [Migration/Schema.rb support](#migrationschemarb-support)
|
32
33
|
* [Type Casting support](#type-casting-support)
|
34
|
+
* [Querying PostgreSQL datatypes](#querying-postgresql-datatypes)
|
35
|
+
|
36
|
+
### Usage Notes
|
37
|
+
Take care when dealing with arrays and other types that allow you to
|
38
|
+
update their value in place. In place changes are not currently tracked
|
39
|
+
in Rails (see [this issue](https://github.com/rails/rails/issues/6954)).
|
40
|
+
To track changes that happen via `#<<` or other instance methods, be
|
41
|
+
sure to call `<attribute>_will_change!` so that Active Record knows to
|
42
|
+
persist the change.
|
33
43
|
|
34
44
|
## Migration/Schema.rb support
|
35
45
|
|
@@ -148,6 +158,101 @@ person_2.favorite_numbers.first.class
|
|
148
158
|
# => Fixnum
|
149
159
|
```
|
150
160
|
|
161
|
+
## Querying PostgreSQL datatypes
|
162
|
+
|
163
|
+
* [Arrays](#arrays-2)
|
164
|
+
* [INET/CIDR](#inetcidr)
|
165
|
+
|
166
|
+
### Arrays
|
167
|
+
|
168
|
+
* [&& - Array Overlap operator](#---array-overlap-operator)
|
169
|
+
* [ANY or ALL functions](#any-or-all-functions)
|
170
|
+
|
171
|
+
#### && - Array Overlap operator
|
172
|
+
|
173
|
+
PostgreSQL implements the `&&` operator, known as the overlap operator,
|
174
|
+
for arrays. The overlap operator returns `t` (true) when two arrays have
|
175
|
+
one or more elements in common.
|
176
|
+
|
177
|
+
```sql
|
178
|
+
ARRAY[1,2,3] && ARRAY[4,5,6]
|
179
|
+
-- f
|
180
|
+
|
181
|
+
ARRAY[1,2,3] && ARRAY[3,5,6]
|
182
|
+
-- t
|
183
|
+
```
|
184
|
+
|
185
|
+
Postgres\_ext defines `array_overlap`, an [Arel](https://github.com/rails/arel)
|
186
|
+
predicate for the `&&` operator.
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
user_arel = User.arel_table
|
190
|
+
|
191
|
+
User.where(user_arel[:tags].array_overlap(['one','two'])).to_sql
|
192
|
+
# => SELECT \"users\".* FROM \"users\" WHERE \"users\".\"tags\" && '{one,two}'
|
193
|
+
```
|
194
|
+
|
195
|
+
#### ANY or ALL functions
|
196
|
+
|
197
|
+
When querying array columns, you have the ability to see if a predicate
|
198
|
+
apply's to either *any* element in the array, or *all* elements of the
|
199
|
+
array. The syntax for these predicates are slightly different then the
|
200
|
+
normal `where` syntax in PostgreSQL. To see if an array contains the
|
201
|
+
string `'test'` in any location, you would write the following in SQL
|
202
|
+
|
203
|
+
```sql
|
204
|
+
SELECT *
|
205
|
+
FROM users
|
206
|
+
WHERE 'test' = ANY(users.tags)
|
207
|
+
```
|
208
|
+
|
209
|
+
Notice that the column is on the right hand side of the predicate,
|
210
|
+
instead of the left, because we have to call the `ANY` function on that
|
211
|
+
column.
|
212
|
+
|
213
|
+
We can generate the above query using [Arel](https://github.com/rails/arel)
|
214
|
+
and generating the Node manually. We would use the following to
|
215
|
+
accompish this:
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
user_arel = User.arel_table
|
219
|
+
|
220
|
+
any_tags_function = Arel::Nodes::NamedFunction.new('ANY', [user_arel[:tags]])
|
221
|
+
predicate = Arel::Nodes::Equality('test', any_tags_function)
|
222
|
+
|
223
|
+
User.where(predicate).to_sql
|
224
|
+
#=> SELECT \"users\".* FROM \"users\" WHERE 'test' = ANY(\"users\".\"tags\")
|
225
|
+
|
226
|
+
```
|
227
|
+
|
228
|
+
The ALL version of this same predicate can be generated by swap `'ANY'`
|
229
|
+
for `'ALL'` in the named function.
|
230
|
+
|
231
|
+
### INET/CIDR
|
232
|
+
|
233
|
+
#### `<<` -- Contained within operator
|
234
|
+
|
235
|
+
PostgreSQL defines the `<<`, or contained within operator for INET and
|
236
|
+
CIDR datatypes. The `<<` operator returns `t` (true) if a INET or CIDR
|
237
|
+
address is contained within the given subnet.
|
238
|
+
|
239
|
+
```sql
|
240
|
+
inet '192.168.1.6' << inet '10.0.0.0/24'
|
241
|
+
-- f
|
242
|
+
|
243
|
+
inet '192.168.1.6' << inet '192.168.1.0/24'
|
244
|
+
-- t
|
245
|
+
```
|
246
|
+
|
247
|
+
Postgres\_ext defines `contained_within`, an [Arel](https://github.com/rails/arel)
|
248
|
+
predicate for the `<<` operator.
|
249
|
+
|
250
|
+
```ruby
|
251
|
+
user_arel = User.arel_table
|
252
|
+
|
253
|
+
User.where(user_arel[:ip_address].contained_witin('127.0.0.1/24')).to_sql
|
254
|
+
# => SELECT \"users\".* FROM \"users\" WHERE \"users\".\"ip_address\" << '127.0.0.1/24'
|
255
|
+
```
|
151
256
|
## Authors
|
152
257
|
|
153
258
|
Dan McClain [twitter](http://twitter.com/_danmcclain) [github](http://github.com/danmcclain)
|
data/Rakefile
CHANGED
@@ -30,13 +30,4 @@ RSpec::Core::RakeTask.new(:spec) do |t|
|
|
30
30
|
t.pattern = 'spec/**/*_spec.rb'
|
31
31
|
end
|
32
32
|
|
33
|
-
require 'rvm-tester'
|
34
|
-
RVM::Tester::TesterTask.new(:suite) do |t|
|
35
|
-
t.bundle_install = true # updates Gemfile.lock, default is true
|
36
|
-
t.use_travis = true # looks for Rubies in .travis.yml (on by default)
|
37
|
-
t.command = "bundle exec rake spec" # runs plain "rake" by default
|
38
|
-
t.env = {"VERBOSE" => "1"} # set any ENV vars
|
39
|
-
t.verbose = true # shows more output, off by default
|
40
|
-
end
|
41
|
-
|
42
33
|
task :default => :spec
|
@@ -101,8 +101,6 @@ module ActiveRecord
|
|
101
101
|
:cidr
|
102
102
|
when 'macaddr'
|
103
103
|
:macaddr
|
104
|
-
when /(\[\])$/
|
105
|
-
"#{simplified_type field_type[0..field_type.length - 3]}_array".to_sym
|
106
104
|
else
|
107
105
|
simplified_type_without_extended_types field_type
|
108
106
|
end
|
@@ -205,6 +203,15 @@ module ActiveRecord
|
|
205
203
|
end
|
206
204
|
alias_method_chain :type_cast, :extended_types
|
207
205
|
|
206
|
+
def quote_with_extended_types(value, column = nil)
|
207
|
+
if [Array, IPAddr].include? value.class
|
208
|
+
"'#{type_cast(value, column)}'"
|
209
|
+
else
|
210
|
+
quote_without_extended_types(value, column)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
alias_method_chain :quote, :extended_types
|
214
|
+
|
208
215
|
private
|
209
216
|
|
210
217
|
def ipaddr_to_string(value)
|
@@ -2,8 +2,12 @@ require 'arel/predications'
|
|
2
2
|
|
3
3
|
module Arel
|
4
4
|
module Predications
|
5
|
-
def contained_within
|
5
|
+
def contained_within(other)
|
6
6
|
Nodes::ContainedWithin.new self, other
|
7
7
|
end
|
8
|
+
|
9
|
+
def array_overlap(other)
|
10
|
+
Nodes::ArrayOverlap.new self, other
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
@@ -7,6 +7,26 @@ module Arel
|
|
7
7
|
"#{visit o.left} << #{visit o.right}"
|
8
8
|
end
|
9
9
|
|
10
|
+
def visit_Arel_Nodes_ArrayOverlap o
|
11
|
+
if Array === o.right
|
12
|
+
right = "{#{o.right.map{|v| change_string(visit(v))}.join(',')}}"
|
13
|
+
"#{visit o.left} && '#{right}'"
|
14
|
+
else
|
15
|
+
"#{visit o.left} && #{visit o.right}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def visit_IPAddr value
|
20
|
+
"'#{value.to_s}/#{value.instance_variable_get(:@mask_addr).to_s(2).count('1')}'"
|
21
|
+
end
|
22
|
+
|
23
|
+
def change_string value
|
24
|
+
if value.match /"|,|\{/
|
25
|
+
value.gsub(/"/, "\"").gsub(/'/,'"')
|
26
|
+
else
|
27
|
+
value.gsub(/'/,'')
|
28
|
+
end
|
29
|
+
end
|
10
30
|
end
|
11
31
|
end
|
12
32
|
end
|
data/lib/postgres_ext/version.rb
CHANGED
data/postgres_ext.gemspec
CHANGED
@@ -16,13 +16,16 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = PostgresExt::VERSION
|
17
17
|
|
18
18
|
gem.add_dependency 'activerecord', '~> 3.2.0'
|
19
|
-
gem.add_dependency 'pg_array_parser', '~> 0.0.
|
19
|
+
gem.add_dependency 'pg_array_parser', '~> 0.0.3'
|
20
20
|
|
21
21
|
gem.add_development_dependency 'rails', '~> 3.2.0'
|
22
22
|
gem.add_development_dependency 'rspec-rails', '~> 2.9.0'
|
23
23
|
gem.add_development_dependency 'bourne', '~> 1.1.2'
|
24
|
-
|
24
|
+
if RUBY_PLATFORM =~ /java/
|
25
|
+
gem.add_development_dependency 'activerecord-jdbcpostgresql-adapter'
|
26
|
+
else
|
27
|
+
gem.add_development_dependency 'pg', '~> 0.13.2'
|
28
|
+
end
|
25
29
|
gem.add_development_dependency 'debugger', '~> 1.1.2' if RUBY_VERSION == '1.9.3'
|
26
30
|
gem.add_development_dependency 'fivemat'
|
27
|
-
gem.add_development_dependency 'rvm-tester'
|
28
31
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Array Column Predicates' do
|
4
|
+
let!(:adapter) { ActiveRecord::Base.connection }
|
5
|
+
|
6
|
+
before do
|
7
|
+
adapter.create_table :arel_arrays, :force => true do |t|
|
8
|
+
t.string :tags, :array => true
|
9
|
+
end
|
10
|
+
|
11
|
+
class ArelArray < ActiveRecord::Base
|
12
|
+
attr_accessible :tags
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
after do
|
17
|
+
adapter.drop_table :arel_arrays
|
18
|
+
Object.send(:remove_const, :ArelArray)
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'Array Overlap' do
|
22
|
+
it 'converts Arel array_overlap statment' do
|
23
|
+
arel_table = ArelArray.arel_table
|
24
|
+
|
25
|
+
arel_table.where(arel_table[:tags].array_overlap(['tag','tag 2'])).to_sql.should match /&& '\{tag,tag 2\}'/
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'returns matched records' do
|
29
|
+
one = ArelArray.create!(:tags => ['one'])
|
30
|
+
two = ArelArray.create!(:tags => ['two'])
|
31
|
+
arel_table = ArelArray.arel_table
|
32
|
+
|
33
|
+
ArelArray.where(arel_table[:tags].array_overlap(['one'])).should include(one)
|
34
|
+
ArelArray.where(arel_table[:tags].array_overlap(['two'])).should include(two)
|
35
|
+
ArelArray.where(arel_table[:tags].array_overlap(['two','one'])).should include(two)
|
36
|
+
ArelArray.where(arel_table[:tags].array_overlap(['two','one'])).should include(one)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'INET related AREL functions' do
|
4
|
+
let!(:adapter) { ActiveRecord::Base.connection }
|
5
|
+
before do
|
6
|
+
adapter.create_table :ip_addresses, :force => true do |t|
|
7
|
+
t.inet :address
|
8
|
+
end
|
9
|
+
|
10
|
+
class IpAddress < ActiveRecord::Base
|
11
|
+
attr_accessible :address
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
after do
|
16
|
+
adapter.drop_table :ip_addresses
|
17
|
+
Object.send(:remove_const, :IpAddress)
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'quoting IPAddr in sql statement' do
|
21
|
+
it 'properly converts IPAddr to quoted strings when passed as an argument to a where clause' do
|
22
|
+
IpAddress.where(:address => IPAddr.new('127.0.0.1')).to_sql.should include("'127.0.0.1/32'")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'cotained with (<<) operator' do
|
27
|
+
it 'converts Arel contained_within statemnts to <<' do
|
28
|
+
arel_table = IpAddress.arel_table
|
29
|
+
|
30
|
+
arel_table.where(arel_table[:address].contained_within(IPAddr.new('127.0.0.1/24'))).to_sql.should match /<< '127.0.0.0\/24'/
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/models/array_spec.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Models with array columns' do
|
4
|
-
|
5
|
-
let!(:adapter) { ActiveRecord::Base.connection }
|
4
|
+
let!(:adapter) { ActiveRecord::Base.connection }
|
6
5
|
|
6
|
+
context 'no default value, string array' do
|
7
7
|
before do
|
8
8
|
adapter.create_table :users, :force => true do |t|
|
9
9
|
t.string :nick_names, :array => true
|
@@ -18,29 +18,45 @@ describe 'Models with array columns' do
|
|
18
18
|
Object.send(:remove_const, :User)
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
context 'no default value, string array' do
|
22
|
+
describe '#create' do
|
23
|
+
it 'creates a user when there is no array assignment' do
|
24
|
+
u = User.create()
|
25
|
+
u.reload
|
26
|
+
u.nick_names.should eq nil
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
it 'creates a user with an empty array' do
|
30
|
+
u = User.create(:nick_names => [])
|
31
|
+
u.reload
|
32
|
+
u.nick_names.should eq []
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'creates a user with an array of some values' do
|
36
|
+
u = User.create(:nick_names => ['some', 'things'])
|
37
|
+
u.reload
|
38
|
+
u.nick_names.should eq ['some', 'things']
|
39
|
+
end
|
32
40
|
end
|
41
|
+
end
|
33
42
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
43
|
+
context 'Setting values' do
|
44
|
+
describe 'setting a new value' do
|
45
|
+
it 'returns the value set when the record is retrieved' do
|
46
|
+
u = User.create(:nick_names => ['some', 'things'])
|
47
|
+
u.reload
|
48
|
+
|
49
|
+
u.nick_names = ['different', 'values']
|
50
|
+
u.save
|
51
|
+
|
52
|
+
u.reload
|
53
|
+
u.nick_names.should eq ['different', 'values']
|
54
|
+
end
|
38
55
|
end
|
39
56
|
end
|
40
57
|
end
|
41
58
|
|
42
|
-
context 'default
|
43
|
-
let!(:adapter) { ActiveRecord::Base.connection }
|
59
|
+
context 'default values' do
|
44
60
|
before do
|
45
61
|
adapter.create_table :defaulted_users, :force => true do |t|
|
46
62
|
t.string :nick_names, :array => true, :default => '{}'
|
@@ -55,23 +71,25 @@ describe 'Models with array columns' do
|
|
55
71
|
Object.send(:remove_const, :DefaultedUser)
|
56
72
|
end
|
57
73
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
74
|
+
context 'model creation' do
|
75
|
+
describe '#create' do
|
76
|
+
it 'creates a user when there is no array assignment' do
|
77
|
+
u = DefaultedUser.create()
|
78
|
+
u.reload
|
79
|
+
u.nick_names.should eq []
|
80
|
+
end
|
64
81
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
82
|
+
it 'creates a user with an nil' do
|
83
|
+
u = DefaultedUser.create(:nick_names => nil)
|
84
|
+
u.reload
|
85
|
+
u.nick_names.should eq nil
|
86
|
+
end
|
70
87
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
88
|
+
it 'creates a user with an array of some values' do
|
89
|
+
u = DefaultedUser.create(:nick_names => ['some', 'things'])
|
90
|
+
u.reload
|
91
|
+
u.nick_names.should eq ['some', 'things']
|
92
|
+
end
|
75
93
|
end
|
76
94
|
end
|
77
95
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Models with inet columns' do
|
4
|
+
let!(:adapter) { ActiveRecord::Base.connection }
|
5
|
+
|
6
|
+
context 'no default value, inet' do
|
7
|
+
before do
|
8
|
+
adapter.create_table :addresses, :force => true do |t|
|
9
|
+
t.inet :ip_address
|
10
|
+
end
|
11
|
+
class Address < ActiveRecord::Base
|
12
|
+
attr_accessible :ip_address
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
after do
|
17
|
+
adapter.drop_table :addresses
|
18
|
+
Object.send(:remove_const, :Address)
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'no default value, inet' do
|
22
|
+
describe '#create' do
|
23
|
+
it 'creates an address when there is no assignment' do
|
24
|
+
address = Address.create()
|
25
|
+
address.reload
|
26
|
+
address.ip_address.should eq nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'creates an address with an address string' do
|
30
|
+
address = Address.create( :ip_address => '192.168.0.1')
|
31
|
+
address.reload
|
32
|
+
address.ip_address.should eq IPAddr.new('192.168.0.1')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'creates an address with an IPAddr' do
|
36
|
+
ip_addr = IPAddr.new('192.168.0.1')
|
37
|
+
address = Address.create( :ip_address => ip_addr)
|
38
|
+
address.reload
|
39
|
+
address.ip_address.should eq ip_addr
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'inet assignment' do
|
44
|
+
it 'updates an address with an address string' do
|
45
|
+
address = Address.create( :ip_address => '192.168.0.1')
|
46
|
+
address.ip_address = '192.168.1.2'
|
47
|
+
address.save
|
48
|
+
|
49
|
+
address.reload
|
50
|
+
address.ip_address.should eq IPAddr.new('192.168.1.2')
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'updates an address with an IPAddr' do
|
54
|
+
ip_addr_1 = IPAddr.new('192.168.0.1')
|
55
|
+
ip_addr_2 = IPAddr.new('192.168.1.2')
|
56
|
+
address = Address.create( :ip_address => ip_addr_1)
|
57
|
+
address.ip_address = ip_addr_2
|
58
|
+
address.save
|
59
|
+
|
60
|
+
address.reload
|
61
|
+
address.ip_address.should eq ip_addr_2
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'find_by_inet' do
|
66
|
+
let!(:address) { Address.create(:ip_address => '192.168.0.1') }
|
67
|
+
|
68
|
+
it 'finds address using string value' do
|
69
|
+
Address.find_by_ip_address('192.168.0.1').should eq address
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'finds address using IPAddr' do
|
73
|
+
ip_addr = IPAddr.new '192.168.0.1'
|
74
|
+
Address.find_by_ip_address(ip_addr).should eq address
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -15,4 +15,11 @@ Dir[File.join(ENGINE_RAILS_ROOT, 'spec/support/**/*.rb')].each { |f| require f }
|
|
15
15
|
RSpec.configure do |config|
|
16
16
|
config.mock_with :mocha
|
17
17
|
config.use_transactional_fixtures = true
|
18
|
+
config.backtrace_clean_patterns = [
|
19
|
+
#/\/lib\d*\/ruby\//,
|
20
|
+
#/bin\//,
|
21
|
+
#/gems/,
|
22
|
+
#/spec\/spec_helper\.rb/,
|
23
|
+
/lib\/rspec\/(core|expectations|matchers|mocks)/
|
24
|
+
]
|
18
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgres_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
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: 2012-
|
12
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.0.
|
37
|
+
version: 0.0.3
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.0.
|
45
|
+
version: 0.0.3
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rails
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,22 +139,6 @@ dependencies:
|
|
139
139
|
- - ! '>='
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: rvm-tester
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
142
|
description: Adds missing native PostgreSQL data types to ActiveRecord
|
159
143
|
email:
|
160
144
|
- git@danmcclain.net
|
@@ -183,6 +167,8 @@ files:
|
|
183
167
|
- lib/postgres_ext/arel/visitors/to_sql.rb
|
184
168
|
- lib/postgres_ext/version.rb
|
185
169
|
- postgres_ext.gemspec
|
170
|
+
- spec/arel/array_spec.rb
|
171
|
+
- spec/arel/inet_spec.rb
|
186
172
|
- spec/columns/array_spec.rb
|
187
173
|
- spec/columns/inet_spec.rb
|
188
174
|
- spec/dummy/.gitignore
|
@@ -243,6 +229,7 @@ files:
|
|
243
229
|
- spec/migrations/macaddr_spec.rb
|
244
230
|
- spec/migrations/uuid_spec.rb
|
245
231
|
- spec/models/array_spec.rb
|
232
|
+
- spec/models/inet_spec.rb
|
246
233
|
- spec/schema_dumper/array_spec.rb
|
247
234
|
- spec/schema_dumper/cidr_spec.rb
|
248
235
|
- spec/schema_dumper/inet_spec.rb
|
@@ -263,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
263
250
|
version: '0'
|
264
251
|
segments:
|
265
252
|
- 0
|
266
|
-
hash:
|
253
|
+
hash: 169599389239444303
|
267
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
268
255
|
none: false
|
269
256
|
requirements:
|
@@ -272,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
259
|
version: '0'
|
273
260
|
segments:
|
274
261
|
- 0
|
275
|
-
hash:
|
262
|
+
hash: 169599389239444303
|
276
263
|
requirements: []
|
277
264
|
rubyforge_project:
|
278
265
|
rubygems_version: 1.8.23
|
@@ -280,6 +267,8 @@ signing_key:
|
|
280
267
|
specification_version: 3
|
281
268
|
summary: Extends ActiveRecord to handle native PostgreSQL data types
|
282
269
|
test_files:
|
270
|
+
- spec/arel/array_spec.rb
|
271
|
+
- spec/arel/inet_spec.rb
|
283
272
|
- spec/columns/array_spec.rb
|
284
273
|
- spec/columns/inet_spec.rb
|
285
274
|
- spec/dummy/.gitignore
|
@@ -340,6 +329,7 @@ test_files:
|
|
340
329
|
- spec/migrations/macaddr_spec.rb
|
341
330
|
- spec/migrations/uuid_spec.rb
|
342
331
|
- spec/models/array_spec.rb
|
332
|
+
- spec/models/inet_spec.rb
|
343
333
|
- spec/schema_dumper/array_spec.rb
|
344
334
|
- spec/schema_dumper/cidr_spec.rb
|
345
335
|
- spec/schema_dumper/inet_spec.rb
|