activerecord_enum 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.3
4
+ - 2.0.0
5
5
  before_script:
6
6
  - "mysql -e 'create database activerecord_enum_test;' >/dev/null"
7
7
  - "cp spec/{.travis.,}database.yml"
data/README.markdown CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Provides ActiveRecord support for the nonstandard `ENUM` and `SET` data types.
4
4
 
5
- [![Build Status](http://travis-ci.org/iangreenleaf/activerecord_enum.png)](http://travis-ci.org/iangreenleaf/activerecord_enum)
5
+ [![Build Status](https://travis-ci.org/iangreenleaf/activerecord_enum.png?branch=master)](http://travis-ci.org/iangreenleaf/activerecord_enum)
6
6
 
7
7
  ## Running the tests ##
8
8
 
@@ -22,7 +22,13 @@ To run the tests for just one adapter:
22
22
 
23
23
  ### Y U NO WORK?! ###
24
24
 
25
- Sorry, it currently only works with Rails 3.x and the mysql2 and sqlite adapters. I plan to support other standard adapters at some point.
25
+ It currently works with:
26
+
27
+ * Rails 3.0, 3.1, 3.2, 4.0.
28
+ * The `mysql2` and `sqlite` adapters.
29
+ * Ruby 1.9.3, 2.0.0. It probably also works with Ruby 1.8, but that is unsupported.
30
+
31
+ If you'd like to support other adapters, pull requests are welcome!
26
32
 
27
33
  ### Why doesn't it validate anything? ###
28
34
 
@@ -41,3 +47,5 @@ For SET columns, you may be interested in [iangreenleaf/active_set](https://gith
41
47
  This isn't a plugin everyone should use. There are a number of plugins to simulate enum behavior backed by standard data types. Personally, I like [nofxx/symbolize](https://github.com/nofxx/symbolize).
42
48
 
43
49
  However, sometimes we can't or won't avoid working with these data types. When that happens, I got you covered.
50
+
51
+ ## [Contributors](https://github.com/iangreenleaf/activerecord_enum/graphs/contributors) ##
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'bundler'
2
+ require 'yaml'
2
3
  Bundler::GemHelper.install_tasks
3
4
 
4
5
  DB_CONFIG = "spec/database.yml"
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "activerecord_enum"
16
16
 
17
- s.add_dependency "activerecord", "~> 3.0"
17
+ s.add_dependency "activerecord", ">= 3.0"
18
18
  s.add_development_dependency "rake"
19
19
  s.add_development_dependency "bundler"
20
20
  s.add_development_dependency "mysql2", "~> 0.3.11"
@@ -1,3 +1,3 @@
1
1
  module ActiverecordEnum
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -2,7 +2,7 @@ require 'active_record/connection_adapters/sqlite3_adapter'
2
2
 
3
3
  module ActiveRecord
4
4
  module ConnectionAdapters
5
- class SQLite3Adapter < SQLiteAdapter
5
+ class SQLite3Adapter < (defined?(SQLiteAdapter) ? SQLiteAdapter : AbstractAdapter)
6
6
  def type_to_sql_with_enum type, limit=nil, *args
7
7
  if type.to_s == "enum" || type.to_s == "set"
8
8
  type, limit = :string, nil
@@ -1,4 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
  gemspec :path => ".."
3
3
  gem "mysql2", "~> 0.2.0"
4
- gem "activerecord", "~> 3.0.9"
4
+ gem "activerecord", "~> 3.0.20"
@@ -1,4 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
  gemspec :path => ".."
3
3
  gem "mysql2", "~> 0.3.11"
4
- gem "activerecord", "~> 3.1.0"
4
+ gem "activerecord", "~> 3.1.12"
@@ -1,4 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
  gemspec :path => ".."
3
3
  gem "mysql2", "~> 0.3.11"
4
- gem "activerecord", "~> 3.1.0"
4
+ gem "activerecord", "~> 3.2.13"
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+ gemspec :path => ".."
3
+ gem "mysql2", "~> 0.3.11"
4
+ gem "activerecord", "~> 4.0.0"
data/spec/enum_spec.rb CHANGED
@@ -7,15 +7,15 @@ describe "ENUM datatype" do
7
7
  subject { dumped_schema }
8
8
 
9
9
  it "dumps native format" do
10
- subject.should match %r{t\.enum\s+"color",\s+:limit => \["blue", "red", "yellow"\]}
10
+ subject.should match %r{t\.enum\s+"color",\s+(:limit =>|limit:) \["blue", "red", "yellow"\]}
11
11
  end
12
12
 
13
13
  it "dumps default option" do
14
- subject.should match %r{t\.enum\s+"color",.+:default => "red"}
14
+ subject.should match %r{t\.enum\s+"color",.+(:default =>|default:) "red"}
15
15
  end
16
16
 
17
17
  it "dumps null option" do
18
- subject.should match %r{t\.enum\s+"color",.+:null => false$}
18
+ subject.should match %r{t\.enum\s+"color",.+(:null =>|null:) false$}
19
19
  end
20
20
  end
21
21
 
@@ -1,6 +1,5 @@
1
1
  ActiveRecord::Schema.define do
2
2
  create_table :balloons, :force => true do |t|
3
- t.integer "id"
4
3
  t.enum "color", :limit => ['red', 'gold'], :default => 'gold', :null => false
5
4
  t.column "size", :enum, :limit => ['small', 'medium', 'large']
6
5
  end
@@ -1,6 +1,5 @@
1
1
  ActiveRecord::Schema.define do
2
2
  create_table :aircraft, :force => true do |t|
3
- t.integer "id"
4
3
  t.column "color", "enum('blue','red','yellow')", :default => 'red', :null => false
5
4
  end
6
5
  end
@@ -1,6 +1,5 @@
1
1
  ActiveRecord::Schema.define do
2
2
  create_table :balloons, :force => true do |t|
3
- t.integer "id"
4
3
  t.set "ribbons", :limit => ['red', 'green', 'gold'], :default => ['green','gold'], :null => false
5
4
  t.column "gasses", :set, :limit => ['helium', 'hydrogen']
6
5
  end
@@ -1,6 +1,5 @@
1
1
  ActiveRecord::Schema.define do
2
2
  create_table :aircraft, :force => true do |t|
3
- t.integer "id"
4
3
  t.column "gadgets", "set('propeller','tail gun','gps')", :default => 'propeller,gps', :null => false
5
4
  end
6
5
  end
data/spec/set_spec.rb CHANGED
@@ -7,15 +7,15 @@ describe "SET datatype" do
7
7
  subject { dumped_schema }
8
8
 
9
9
  it "dumps native format" do
10
- subject.should match %r{t\.set\s+"gadgets",\s+:limit => \["propeller", "tail gun", "gps"\]}
10
+ subject.should match %r{t\.set\s+"gadgets",\s+(:limit =>|limit:) \["propeller", "tail gun", "gps"\]}
11
11
  end
12
12
 
13
13
  it "dumps default option" do
14
- subject.should match %r{t\.set\s+"gadgets",.+:default => \["propeller", "gps"\]}
14
+ subject.should match %r{t\.set\s+"gadgets",.+(:default =>|default:) \["propeller", "gps"\]}
15
15
  end
16
16
 
17
17
  it "dumps null option" do
18
- subject.should match %r{t\.set\s+"gadgets",.+:null => false$}
18
+ subject.should match %r{t\.set\s+"gadgets",.+(:null =>|null:) false$}
19
19
  end
20
20
  end
21
21
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rspec'
2
+ require 'yaml'
2
3
 
3
4
  def db
4
5
  ENV["DB"] || "mysql"
metadata CHANGED
@@ -1,123 +1,119 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: activerecord_enum
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ian Young
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-17 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- requirement: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- hash: 7
27
- segments:
28
- - 3
29
- - 0
30
- version: "3.0"
31
- version_requirements: *id001
12
+ date: 2013-07-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
32
15
  name: activerecord
33
- prerelease: false
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
34
22
  type: :runtime
35
- - !ruby/object:Gem::Dependency
36
- requirement: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
37
25
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 3
42
- segments:
43
- - 0
44
- version: "0"
45
- version_requirements: *id002
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - !ruby/object:Gem::Dependency
46
31
  name: rake
47
- prerelease: false
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
48
38
  type: :development
49
- - !ruby/object:Gem::Dependency
50
- requirement: &id003 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
51
41
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
- version: "0"
59
- version_requirements: *id003
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
60
47
  name: bundler
61
- prerelease: false
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
62
54
  type: :development
63
- - !ruby/object:Gem::Dependency
64
- requirement: &id004 !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: mysql2
64
+ requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
- requirements:
66
+ requirements:
67
67
  - - ~>
68
- - !ruby/object:Gem::Version
69
- hash: 5
70
- segments:
71
- - 0
72
- - 3
73
- - 11
68
+ - !ruby/object:Gem::Version
74
69
  version: 0.3.11
75
- version_requirements: *id004
76
- name: mysql2
77
- prerelease: false
78
70
  type: :development
79
- - !ruby/object:Gem::Dependency
80
- requirement: &id005 !ruby/object:Gem::Requirement
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
81
73
  none: false
82
- requirements:
74
+ requirements:
83
75
  - - ~>
84
- - !ruby/object:Gem::Version
85
- hash: 19
86
- segments:
87
- - 1
88
- - 3
89
- - 4
90
- version: 1.3.4
91
- version_requirements: *id005
76
+ - !ruby/object:Gem::Version
77
+ version: 0.3.11
78
+ - !ruby/object:Gem::Dependency
92
79
  name: sqlite3
93
- prerelease: false
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 1.3.4
94
86
  type: :development
95
- - !ruby/object:Gem::Dependency
96
- requirement: &id006 !ruby/object:Gem::Requirement
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
97
89
  none: false
98
- requirements:
90
+ requirements:
99
91
  - - ~>
100
- - !ruby/object:Gem::Version
101
- hash: 43
102
- segments:
103
- - 2
104
- - 9
105
- - 0
106
- version: 2.9.0
107
- version_requirements: *id006
92
+ - !ruby/object:Gem::Version
93
+ version: 1.3.4
94
+ - !ruby/object:Gem::Dependency
108
95
  name: rspec
109
- prerelease: false
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 2.9.0
110
102
  type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 2.9.0
111
110
  description: Adds the ENUM data type natively to ActiveRecord.
112
- email:
111
+ email:
113
112
  - ian.greenleaf+github@gmail.com
114
113
  executables: []
115
-
116
114
  extensions: []
117
-
118
115
  extra_rdoc_files: []
119
-
120
- files:
116
+ files:
121
117
  - .gitignore
122
118
  - .travis.yml
123
119
  - Gemfile
@@ -133,6 +129,7 @@ files:
133
129
  - spec/Gemfile.rails_3_0
134
130
  - spec/Gemfile.rails_3_1
135
131
  - spec/Gemfile.rails_3_2
132
+ - spec/Gemfile.rails_4_0
136
133
  - spec/all_rails
137
134
  - spec/database.yml.tmpl
138
135
  - spec/enum_spec.rb
@@ -142,43 +139,35 @@ files:
142
139
  - spec/schema/set_old.rb
143
140
  - spec/set_spec.rb
144
141
  - spec/spec_helper.rb
145
- homepage: ""
142
+ homepage: ''
146
143
  licenses: []
147
-
148
144
  post_install_message:
149
145
  rdoc_options: []
150
-
151
- require_paths:
146
+ require_paths:
152
147
  - lib
153
- required_ruby_version: !ruby/object:Gem::Requirement
148
+ required_ruby_version: !ruby/object:Gem::Requirement
154
149
  none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- hash: 3
159
- segments:
160
- - 0
161
- version: "0"
162
- required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
155
  none: false
164
- requirements:
165
- - - ">="
166
- - !ruby/object:Gem::Version
167
- hash: 3
168
- segments:
169
- - 0
170
- version: "0"
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
171
160
  requirements: []
172
-
173
161
  rubyforge_project: activerecord_enum
174
- rubygems_version: 1.8.11
162
+ rubygems_version: 1.8.23
175
163
  signing_key:
176
164
  specification_version: 3
177
165
  summary: Enum data types for ActiveRecord
178
- test_files:
166
+ test_files:
179
167
  - spec/Gemfile.rails_3_0
180
168
  - spec/Gemfile.rails_3_1
181
169
  - spec/Gemfile.rails_3_2
170
+ - spec/Gemfile.rails_4_0
182
171
  - spec/all_rails
183
172
  - spec/database.yml.tmpl
184
173
  - spec/enum_spec.rb