enum_type 2.1.1 → 2.1.2
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +32 -31
- data/README.textile +1 -1
- data/VERSION +1 -1
- data/enum_type.gemspec +4 -3
- data/lib/enum_type/extensions.rb +10 -4
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a3e4e56b190e7bafd870a8d85d36f2d510db511
|
|
4
|
+
data.tar.gz: 7b6ed07e741a01450e0546ed39dbcf9ec76295e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98cd180bedacbf7233eb4bc7e87eb1211dc00407cc0e6614602e1b3c9094e49eb2b684a24c17ab38ac8483c003f6fbcae140046fd4857bf9d9c17b2f1452a20d
|
|
7
|
+
data.tar.gz: 1c8d026cbd98ef6d02406c2c868cfb06b8da813fbd41d4448353a8c5194acac59d0af4ffe0285d1339b8f5784944064fdb3aa8b79d2bd8368fa87d656727ea5e
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0.0
|
|
1
|
+
2.0.0
|
data/Gemfile.lock
CHANGED
|
@@ -3,36 +3,37 @@ GEM
|
|
|
3
3
|
specs:
|
|
4
4
|
RedCloth (4.2.9)
|
|
5
5
|
RedCloth (4.2.9-java)
|
|
6
|
-
activemodel (4.0.
|
|
7
|
-
activesupport (= 4.0.
|
|
6
|
+
activemodel (4.0.1)
|
|
7
|
+
activesupport (= 4.0.1)
|
|
8
8
|
builder (~> 3.1.0)
|
|
9
|
-
activerecord (4.0.
|
|
10
|
-
activemodel (= 4.0.
|
|
9
|
+
activerecord (4.0.1)
|
|
10
|
+
activemodel (= 4.0.1)
|
|
11
11
|
activerecord-deprecated_finders (~> 1.0.2)
|
|
12
|
-
activesupport (= 4.0.
|
|
12
|
+
activesupport (= 4.0.1)
|
|
13
13
|
arel (~> 4.0.0)
|
|
14
14
|
activerecord-deprecated_finders (1.0.3)
|
|
15
|
-
activerecord-jdbc-adapter (1.2
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
jdbc-
|
|
19
|
-
|
|
15
|
+
activerecord-jdbc-adapter (1.3.2)
|
|
16
|
+
activerecord (>= 2.2)
|
|
17
|
+
activerecord-jdbcpostgresql-adapter (1.3.2)
|
|
18
|
+
activerecord-jdbc-adapter (~> 1.3.2)
|
|
19
|
+
jdbc-postgres (>= 9.1)
|
|
20
|
+
activesupport (4.0.1)
|
|
20
21
|
i18n (~> 0.6, >= 0.6.4)
|
|
21
22
|
minitest (~> 4.2)
|
|
22
23
|
multi_json (~> 1.3)
|
|
23
24
|
thread_safe (~> 0.1)
|
|
24
25
|
tzinfo (~> 0.3.37)
|
|
25
26
|
addressable (2.3.5)
|
|
26
|
-
arel (4.0.
|
|
27
|
-
atomic (1.1.
|
|
28
|
-
atomic (1.1.
|
|
27
|
+
arel (4.0.1)
|
|
28
|
+
atomic (1.1.14)
|
|
29
|
+
atomic (1.1.14-java)
|
|
29
30
|
builder (3.1.4)
|
|
30
|
-
diff-lcs (1.2.
|
|
31
|
-
factory_girl (4.
|
|
31
|
+
diff-lcs (1.2.5)
|
|
32
|
+
factory_girl (4.3.0)
|
|
32
33
|
activesupport (>= 3.0.0)
|
|
33
34
|
faraday (0.8.8)
|
|
34
35
|
multipart-post (~> 1.2.0)
|
|
35
|
-
git (1.2.
|
|
36
|
+
git (1.2.6)
|
|
36
37
|
github_api (0.10.1)
|
|
37
38
|
addressable
|
|
38
39
|
faraday (~> 0.8.1)
|
|
@@ -41,11 +42,11 @@ GEM
|
|
|
41
42
|
nokogiri (~> 1.5.2)
|
|
42
43
|
oauth2
|
|
43
44
|
hashie (2.0.5)
|
|
44
|
-
highline (1.6.
|
|
45
|
+
highline (1.6.20)
|
|
45
46
|
httpauth (0.2.0)
|
|
46
|
-
i18n (0.6.
|
|
47
|
-
jdbc-postgres (9.2.
|
|
48
|
-
jeweler (1.8.
|
|
47
|
+
i18n (0.6.5)
|
|
48
|
+
jdbc-postgres (9.2.1004)
|
|
49
|
+
jeweler (1.8.8)
|
|
49
50
|
builder
|
|
50
51
|
bundler (~> 1.0)
|
|
51
52
|
git (>= 1.2.5)
|
|
@@ -54,12 +55,12 @@ GEM
|
|
|
54
55
|
nokogiri (= 1.5.10)
|
|
55
56
|
rake
|
|
56
57
|
rdoc
|
|
57
|
-
json (1.8.
|
|
58
|
-
json (1.8.
|
|
58
|
+
json (1.8.1)
|
|
59
|
+
json (1.8.1-java)
|
|
59
60
|
jwt (0.1.8)
|
|
60
61
|
multi_json (>= 1.5)
|
|
61
62
|
minitest (4.7.5)
|
|
62
|
-
multi_json (1.
|
|
63
|
+
multi_json (1.8.2)
|
|
63
64
|
multi_xml (0.5.5)
|
|
64
65
|
multipart-post (1.2.0)
|
|
65
66
|
nokogiri (1.5.10)
|
|
@@ -71,7 +72,7 @@ GEM
|
|
|
71
72
|
multi_json (~> 1.0)
|
|
72
73
|
multi_xml (~> 0.5)
|
|
73
74
|
rack (~> 1.2)
|
|
74
|
-
pg (0.
|
|
75
|
+
pg (0.17.0)
|
|
75
76
|
rack (1.5.2)
|
|
76
77
|
rake (10.1.0)
|
|
77
78
|
rdoc (4.0.1)
|
|
@@ -80,16 +81,16 @@ GEM
|
|
|
80
81
|
rspec-core (~> 2.14.0)
|
|
81
82
|
rspec-expectations (~> 2.14.0)
|
|
82
83
|
rspec-mocks (~> 2.14.0)
|
|
83
|
-
rspec-core (2.14.
|
|
84
|
-
rspec-expectations (2.14.
|
|
84
|
+
rspec-core (2.14.7)
|
|
85
|
+
rspec-expectations (2.14.4)
|
|
85
86
|
diff-lcs (>= 1.1.3, < 2.0)
|
|
86
|
-
rspec-mocks (2.14.
|
|
87
|
-
thread_safe (0.1.
|
|
87
|
+
rspec-mocks (2.14.4)
|
|
88
|
+
thread_safe (0.1.3)
|
|
88
89
|
atomic
|
|
89
|
-
thread_safe (0.1.
|
|
90
|
+
thread_safe (0.1.3-java)
|
|
90
91
|
atomic
|
|
91
|
-
tzinfo (0.3.
|
|
92
|
-
yard (0.8.7)
|
|
92
|
+
tzinfo (0.3.38)
|
|
93
|
+
yard (0.8.7.3)
|
|
93
94
|
|
|
94
95
|
PLATFORMS
|
|
95
96
|
java
|
data/README.textile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.1.
|
|
1
|
+
2.1.2
|
data/enum_type.gemspec
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
+
# stub: enum_type 2.1.2 ruby lib
|
|
5
6
|
|
|
6
7
|
Gem::Specification.new do |s|
|
|
7
8
|
s.name = "enum_type"
|
|
8
|
-
s.version = "2.1.
|
|
9
|
+
s.version = "2.1.2"
|
|
9
10
|
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
12
|
s.authors = ["Tim Morgan"]
|
|
12
|
-
s.date = "2013-
|
|
13
|
+
s.date = "2013-11-11"
|
|
13
14
|
s.description = "Allows ActiveRecord to better use PostgreSQL's ENUM types."
|
|
14
15
|
s.email = "git@timothymorgan.info"
|
|
15
16
|
s.extra_rdoc_files = [
|
|
@@ -37,7 +38,7 @@ Gem::Specification.new do |s|
|
|
|
37
38
|
s.homepage = "http://github.com/riscfuture/enum_type"
|
|
38
39
|
s.require_paths = ["lib"]
|
|
39
40
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9")
|
|
40
|
-
s.rubygems_version = "2.
|
|
41
|
+
s.rubygems_version = "2.1.10"
|
|
41
42
|
s.summary = "PostgreSQL enumerated types in ActiveRecord"
|
|
42
43
|
|
|
43
44
|
if s.respond_to? :specification_version then
|
data/lib/enum_type/extensions.rb
CHANGED
|
@@ -4,15 +4,21 @@ require 'active_record/connection_adapters/postgresql_adapter'
|
|
|
4
4
|
# Patch the PostgreSQL adapter to recognize defaults on ENUM columns.
|
|
5
5
|
|
|
6
6
|
class ActiveRecord::ConnectionAdapters::PostgreSQLColumn
|
|
7
|
+
|
|
7
8
|
def initialize(name, default, oid_type, sql_type = nil, null = true)
|
|
8
|
-
@oid_type
|
|
9
|
+
@oid_type = oid_type
|
|
10
|
+
default_value = self.class.extract_value_from_default(default, sql_type)
|
|
11
|
+
|
|
9
12
|
if sql_type =~ /\[\]$/
|
|
10
13
|
@array = true
|
|
11
|
-
super(name,
|
|
14
|
+
super(name, default_value, sql_type[0..sql_type.length - 3], null)
|
|
12
15
|
else
|
|
13
16
|
@array = false
|
|
14
|
-
super(name,
|
|
17
|
+
super(name, default_value, sql_type, null)
|
|
15
18
|
end
|
|
19
|
+
|
|
20
|
+
@default_function = default if has_default_function?(default_value, default)
|
|
21
|
+
@type ||= :string #TODO this is scary
|
|
16
22
|
end
|
|
17
23
|
|
|
18
24
|
def self.extract_value_from_default_with_enum(default, type=nil)
|
|
@@ -33,7 +39,7 @@ end if ActiveRecord::ConnectionAdapters::PostgreSQLColumn.methods.include?(:extr
|
|
|
33
39
|
class ActiveRecord::ConnectionAdapters::JdbcColumn
|
|
34
40
|
def initialize(config, name, default, *args)
|
|
35
41
|
call_discovered_column_callbacks(config)
|
|
36
|
-
super(name,enum_default_value(default, args.first)
|
|
42
|
+
super(name, enum_default_value(default, args.first), *args)
|
|
37
43
|
init_column(name, default, *args)
|
|
38
44
|
end
|
|
39
45
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: enum_type
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Morgan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
193
193
|
version: '0'
|
|
194
194
|
requirements: []
|
|
195
195
|
rubyforge_project:
|
|
196
|
-
rubygems_version: 2.
|
|
196
|
+
rubygems_version: 2.1.10
|
|
197
197
|
signing_key:
|
|
198
198
|
specification_version: 4
|
|
199
199
|
summary: PostgreSQL enumerated types in ActiveRecord
|