enum_type 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 982eabb96a13860dce505242f21e0857b9463a73
4
+ data.tar.gz: 9f1b2ed6ad052f6a2bf2a2ec73f7908f778ab35c
5
+ SHA512:
6
+ metadata.gz: b6cb18a79aba92cf79bf765e189fb665e9b274e430b07ed4bebc914339358f346ea23684b867cd41427b6cf67bc3cdb1591d745b1dab917b0468bbc06ce2bb8d
7
+ data.tar.gz: 1d89ae1323994051f42d43b758602cb0d37f89533e7a478469f2764399b26a4579a3ded7e115f96848eebbed5577a5553a9c7d2ab44c6b5012b6339d5d764acc
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ enum_type
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p0
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # DEPENDENCIES
4
- gem 'activerecord', '>= 3.0', require: 'active_record'
5
- gem 'activesupport', '>= 3.0', require: 'active_support/core_ext/object/try'
4
+ gem 'activerecord', '>= 4.0', require: 'active_record'
5
+ gem 'activesupport', '>= 4.0', require: 'active_support/core_ext/object/try'
6
6
 
7
7
  group :development do
8
8
  # DEVELOPMENT
data/Gemfile.lock CHANGED
@@ -1,53 +1,95 @@
1
1
  GEM
2
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
3
3
  specs:
4
4
  RedCloth (4.2.9)
5
5
  RedCloth (4.2.9-java)
6
- activemodel (3.2.3)
7
- activesupport (= 3.2.3)
8
- builder (~> 3.0.0)
9
- activerecord (3.2.3)
10
- activemodel (= 3.2.3)
11
- activesupport (= 3.2.3)
12
- arel (~> 3.0.2)
13
- tzinfo (~> 0.3.29)
14
- activerecord-jdbc-adapter (1.2.2)
15
- activerecord-jdbcpostgresql-adapter (1.2.2)
16
- activerecord-jdbc-adapter (~> 1.2.2)
17
- jdbc-postgres (>= 9.0, < 9.2)
18
- activesupport (3.2.3)
19
- i18n (~> 0.6)
20
- multi_json (~> 1.0)
21
- arel (3.0.2)
22
- builder (3.0.0)
23
- diff-lcs (1.1.3)
24
- factory_girl (3.3.0)
6
+ activemodel (4.0.0)
7
+ activesupport (= 4.0.0)
8
+ builder (~> 3.1.0)
9
+ activerecord (4.0.0)
10
+ activemodel (= 4.0.0)
11
+ activerecord-deprecated_finders (~> 1.0.2)
12
+ activesupport (= 4.0.0)
13
+ arel (~> 4.0.0)
14
+ activerecord-deprecated_finders (1.0.3)
15
+ activerecord-jdbc-adapter (1.2.9.1)
16
+ activerecord-jdbcpostgresql-adapter (1.2.9)
17
+ activerecord-jdbc-adapter (~> 1.2.9)
18
+ jdbc-postgres (>= 9.1, < 9.3)
19
+ activesupport (4.0.0)
20
+ i18n (~> 0.6, >= 0.6.4)
21
+ minitest (~> 4.2)
22
+ multi_json (~> 1.3)
23
+ thread_safe (~> 0.1)
24
+ tzinfo (~> 0.3.37)
25
+ addressable (2.3.5)
26
+ arel (4.0.0)
27
+ atomic (1.1.12)
28
+ atomic (1.1.12-java)
29
+ builder (3.1.4)
30
+ diff-lcs (1.2.4)
31
+ factory_girl (4.2.0)
25
32
  activesupport (>= 3.0.0)
33
+ faraday (0.8.8)
34
+ multipart-post (~> 1.2.0)
26
35
  git (1.2.5)
27
- i18n (0.6.0)
28
- jdbc-postgres (9.1.901)
29
- jeweler (1.8.3)
36
+ github_api (0.10.1)
37
+ addressable
38
+ faraday (~> 0.8.1)
39
+ hashie (>= 1.2)
40
+ multi_json (~> 1.4)
41
+ nokogiri (~> 1.5.2)
42
+ oauth2
43
+ hashie (2.0.5)
44
+ highline (1.6.19)
45
+ httpauth (0.2.0)
46
+ i18n (0.6.4)
47
+ jdbc-postgres (9.2.1002.1)
48
+ jeweler (1.8.6)
49
+ builder
30
50
  bundler (~> 1.0)
31
51
  git (>= 1.2.5)
52
+ github_api (= 0.10.1)
53
+ highline (>= 1.6.15)
54
+ nokogiri (= 1.5.10)
32
55
  rake
33
56
  rdoc
34
- json (1.7.3)
35
- json (1.7.3-java)
36
- multi_json (1.3.5)
37
- pg (0.13.2)
38
- rake (0.9.2.2)
39
- rdoc (3.12)
57
+ json (1.8.0)
58
+ json (1.8.0-java)
59
+ jwt (0.1.8)
60
+ multi_json (>= 1.5)
61
+ minitest (4.7.5)
62
+ multi_json (1.7.8)
63
+ multi_xml (0.5.5)
64
+ multipart-post (1.2.0)
65
+ nokogiri (1.5.10)
66
+ nokogiri (1.5.10-java)
67
+ oauth2 (0.9.2)
68
+ faraday (~> 0.8)
69
+ httpauth (~> 0.2)
70
+ jwt (~> 0.1.4)
71
+ multi_json (~> 1.0)
72
+ multi_xml (~> 0.5)
73
+ rack (~> 1.2)
74
+ pg (0.16.0)
75
+ rack (1.5.2)
76
+ rake (10.1.0)
77
+ rdoc (4.0.1)
40
78
  json (~> 1.4)
41
- rspec (2.10.0)
42
- rspec-core (~> 2.10.0)
43
- rspec-expectations (~> 2.10.0)
44
- rspec-mocks (~> 2.10.0)
45
- rspec-core (2.10.0)
46
- rspec-expectations (2.10.0)
47
- diff-lcs (~> 1.1.3)
48
- rspec-mocks (2.10.1)
49
- tzinfo (0.3.33)
50
- yard (0.8.1)
79
+ rspec (2.14.1)
80
+ rspec-core (~> 2.14.0)
81
+ rspec-expectations (~> 2.14.0)
82
+ rspec-mocks (~> 2.14.0)
83
+ rspec-core (2.14.4)
84
+ rspec-expectations (2.14.0)
85
+ diff-lcs (>= 1.1.3, < 2.0)
86
+ rspec-mocks (2.14.2)
87
+ thread_safe (0.1.2)
88
+ atomic
89
+ thread_safe (0.1.2-java)
90
+ atomic
91
+ tzinfo (0.3.37)
92
+ yard (0.8.7)
51
93
 
52
94
  PLATFORMS
53
95
  java
@@ -55,9 +97,9 @@ PLATFORMS
55
97
 
56
98
  DEPENDENCIES
57
99
  RedCloth
58
- activerecord (>= 3.0)
100
+ activerecord (>= 4.0)
59
101
  activerecord-jdbcpostgresql-adapter
60
- activesupport (>= 3.0)
102
+ activesupport (>= 4.0)
61
103
  factory_girl
62
104
  jeweler
63
105
  pg
data/Rakefile CHANGED
@@ -1,13 +1,15 @@
1
- require 'rake'
1
+ require 'rubygems'
2
+ require 'bundler'
2
3
  begin
3
- require 'bundler'
4
- rescue LoadError
5
- puts "Bundler is not installed; install with `gem install bundler`."
6
- exit 1
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
7
9
  end
10
+ require 'rake'
8
11
 
9
- Bundler.require :default, :development
10
-
12
+ require 'jeweler'
11
13
  Jeweler::Tasks.new do |gem|
12
14
  gem.name = "enum_type"
13
15
  gem.summary = %Q{PostgreSQL enumerated types in ActiveRecord}
@@ -18,11 +20,12 @@ Jeweler::Tasks.new do |gem|
18
20
  gem.required_ruby_version = '>= 1.9'
19
21
  gem.add_dependency "activerecord", ">= 0"
20
22
  end
21
- Jeweler::GemcutterTasks.new
23
+ Jeweler::RubygemsDotOrgTasks.new
22
24
 
23
25
  require 'rspec/core/rake_task'
24
26
  RSpec::Core::RakeTask.new
25
27
 
28
+ require 'yard'
26
29
  YARD::Rake::YardocTask.new('doc') do |doc|
27
30
  doc.options << "-m" << "textile"
28
31
  doc.options << "--protected"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.1
data/enum_type.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "enum_type"
8
- s.version = "2.1.0"
8
+ s.version = "2.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tim Morgan"]
12
- s.date = "2012-05-14"
12
+ s.date = "2013-08-06"
13
13
  s.description = "Allows ActiveRecord to better use PostgreSQL's ENUM types."
14
14
  s.email = "git@timothymorgan.info"
15
15
  s.extra_rdoc_files = [
@@ -19,6 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
+ ".ruby-gemset",
23
+ ".ruby-version",
22
24
  "Gemfile",
23
25
  "Gemfile.lock",
24
26
  "LICENSE",
@@ -35,15 +37,15 @@ Gem::Specification.new do |s|
35
37
  s.homepage = "http://github.com/riscfuture/enum_type"
36
38
  s.require_paths = ["lib"]
37
39
  s.required_ruby_version = Gem::Requirement.new(">= 1.9")
38
- s.rubygems_version = "1.8.24"
40
+ s.rubygems_version = "2.0.6"
39
41
  s.summary = "PostgreSQL enumerated types in ActiveRecord"
40
42
 
41
43
  if s.respond_to? :specification_version then
42
- s.specification_version = 3
44
+ s.specification_version = 4
43
45
 
44
46
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_runtime_dependency(%q<activerecord>, [">= 3.0"])
46
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
47
+ s.add_runtime_dependency(%q<activerecord>, [">= 4.0"])
48
+ s.add_runtime_dependency(%q<activesupport>, [">= 4.0"])
47
49
  s.add_development_dependency(%q<jeweler>, [">= 0"])
48
50
  s.add_development_dependency(%q<yard>, [">= 0"])
49
51
  s.add_development_dependency(%q<RedCloth>, [">= 0"])
@@ -53,8 +55,8 @@ Gem::Specification.new do |s|
53
55
  s.add_development_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
54
56
  s.add_runtime_dependency(%q<activerecord>, [">= 0"])
55
57
  else
56
- s.add_dependency(%q<activerecord>, [">= 3.0"])
57
- s.add_dependency(%q<activesupport>, [">= 3.0"])
58
+ s.add_dependency(%q<activerecord>, [">= 4.0"])
59
+ s.add_dependency(%q<activesupport>, [">= 4.0"])
58
60
  s.add_dependency(%q<jeweler>, [">= 0"])
59
61
  s.add_dependency(%q<yard>, [">= 0"])
60
62
  s.add_dependency(%q<RedCloth>, [">= 0"])
@@ -65,8 +67,8 @@ Gem::Specification.new do |s|
65
67
  s.add_dependency(%q<activerecord>, [">= 0"])
66
68
  end
67
69
  else
68
- s.add_dependency(%q<activerecord>, [">= 3.0"])
69
- s.add_dependency(%q<activesupport>, [">= 3.0"])
70
+ s.add_dependency(%q<activerecord>, [">= 4.0"])
71
+ s.add_dependency(%q<activesupport>, [">= 4.0"])
70
72
  s.add_dependency(%q<jeweler>, [">= 0"])
71
73
  s.add_dependency(%q<yard>, [">= 0"])
72
74
  s.add_dependency(%q<RedCloth>, [">= 0"])
@@ -4,11 +4,19 @@ 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
- def initialize(name, default, sql_type = nil, null = true)
8
- super(name, self.class.extract_value_from_default(default, sql_type), sql_type, null)
7
+ def initialize(name, default, oid_type, sql_type = nil, null = true)
8
+ @oid_type = oid_type
9
+ if sql_type =~ /\[\]$/
10
+ @array = true
11
+ super(name, self.class.extract_value_from_default(default, sql_type), sql_type[0..sql_type.length - 3], null)
12
+ else
13
+ @array = false
14
+ super(name, self.class.extract_value_from_default(default, sql_type), sql_type, null)
15
+ end
9
16
  end
10
17
 
11
- def self.extract_value_from_default_with_enum(default, type)
18
+ def self.extract_value_from_default_with_enum(default, type=nil)
19
+ return extract_value_from_default_without_enum(default) unless type
12
20
  case default
13
21
  when /\A'(.*)'::(?:#{Regexp.escape type})\z/
14
22
  $1
@@ -67,7 +67,7 @@ describe EnumType do
67
67
 
68
68
  context "[validations]" do
69
69
  before :each do
70
- @field = Factory.next(:enum_field)
70
+ @field = FactoryGirl.generate(:enum_field)
71
71
  SpecSupport::EnumTypeTester.set_field(@field)
72
72
  @model = SpecSupport::EnumTypeTester.new
73
73
  end
data/spec/factories.rb CHANGED
@@ -1,2 +1,4 @@
1
1
  require 'factory_girl'
2
- Factory.sequence(:enum_field) { |i| :"field#{i}" }
2
+ FactoryGirl.define do
3
+ sequence(:enum_field) { |i| :"field#{i}" }
4
+ end
data/spec/spec_helper.rb CHANGED
@@ -9,7 +9,8 @@ require 'enum_type'
9
9
  ActiveRecord::Base.establish_connection(
10
10
  adapter: (defined?(JRuby) ? 'jdbcpostgresql' : 'postgresql'),
11
11
  database: 'enum_type_test',
12
- username: 'enum_type_tester'
12
+ username: 'enum_type_tester',
13
+ host: 'localhost'
13
14
  )
14
15
 
15
16
  class Model < ActiveRecord::Base
metadata CHANGED
@@ -1,174 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enum_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
5
- prerelease:
4
+ version: 2.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tim Morgan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-14 00:00:00.000000000 Z
11
+ date: 2013-08-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: '3.0'
19
+ version: '4.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
- version: '3.0'
26
+ version: '4.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activesupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: '3.0'
33
+ version: '4.0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: '3.0'
40
+ version: '4.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: jeweler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: yard
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: RedCloth
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: factory_girl
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: pg
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: activerecord-jdbcpostgresql-adapter
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - '>='
148
130
  - !ruby/object:Gem::Version
149
131
  version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - '>='
156
137
  - !ruby/object:Gem::Version
157
138
  version: '0'
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: activerecord
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - '>='
164
144
  - !ruby/object:Gem::Version
165
145
  version: '0'
166
146
  type: :runtime
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - '>='
172
151
  - !ruby/object:Gem::Version
173
152
  version: '0'
174
153
  description: Allows ActiveRecord to better use PostgreSQL's ENUM types.
@@ -181,6 +160,8 @@ extra_rdoc_files:
181
160
  files:
182
161
  - .document
183
162
  - .rspec
163
+ - .ruby-gemset
164
+ - .ruby-version
184
165
  - Gemfile
185
166
  - Gemfile.lock
186
167
  - LICENSE
@@ -195,26 +176,25 @@ files:
195
176
  - spec/spec_helper.rb
196
177
  homepage: http://github.com/riscfuture/enum_type
197
178
  licenses: []
179
+ metadata: {}
198
180
  post_install_message:
199
181
  rdoc_options: []
200
182
  require_paths:
201
183
  - lib
202
184
  required_ruby_version: !ruby/object:Gem::Requirement
203
- none: false
204
185
  requirements:
205
- - - ! '>='
186
+ - - '>='
206
187
  - !ruby/object:Gem::Version
207
188
  version: '1.9'
208
189
  required_rubygems_version: !ruby/object:Gem::Requirement
209
- none: false
210
190
  requirements:
211
- - - ! '>='
191
+ - - '>='
212
192
  - !ruby/object:Gem::Version
213
193
  version: '0'
214
194
  requirements: []
215
195
  rubyforge_project:
216
- rubygems_version: 1.8.24
196
+ rubygems_version: 2.0.6
217
197
  signing_key:
218
- specification_version: 3
198
+ specification_version: 4
219
199
  summary: PostgreSQL enumerated types in ActiveRecord
220
200
  test_files: []