activerecord-mysql-enum 0.1.4 → 1.0.0.pre.1
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 +5 -5
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/.travis.yml +29 -0
- data/Appraisals +13 -0
- data/CHANGELOG.md +19 -1
- data/Gemfile +4 -1
- data/Gemfile.lock +51 -2
- data/README.md +3 -19
- data/Rakefile +15 -2
- data/app/assets/config/manifest.js +0 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/javascripts/application.js +16 -0
- data/app/assets/stylesheets/application.css +15 -0
- data/app/controllers/application_controller.rb +5 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/concerns/.keep +0 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/bin/bundle +3 -0
- data/bin/rails +4 -0
- data/bin/rake +4 -0
- data/bin/setup +29 -0
- data/config/application.rb +35 -0
- data/config/boot.rb +3 -0
- data/config/database.yml +19 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +41 -0
- data/config/environments/production.rb +79 -0
- data/config/environments/test.rb +42 -0
- data/config/initializers/assets.rb +11 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/cookies_serializer.rb +3 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +4 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/to_time_preserves_timezone.rb +10 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/en.yml +23 -0
- data/config/routes.rb +56 -0
- data/config/secrets.yml +22 -0
- data/db/schema.rb +26 -0
- data/db/seeds.rb +7 -0
- data/enum_column.gemspec +1 -0
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/rails_4.gemfile +14 -0
- data/gemfiles/rails_5.gemfile +14 -0
- data/gemfiles/rails_6.gemfile +14 -0
- data/lib/active_record/mysql/enum.rb +0 -5
- data/lib/active_record/mysql/enum/enum_column_adapter.rb +38 -91
- data/lib/active_record/mysql/enum/mysql_adapter.rb +15 -14
- data/lib/active_record/mysql/enum/version.rb +1 -1
- data/lib/activerecord-mysql-enum.rb +1 -0
- data/log/.keep +0 -0
- data/public/404.html +67 -0
- data/public/422.html +67 -0
- data/public/500.html +66 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +5 -0
- metadata +72 -11
- data/lib/active_record/mysql/enum/active_record_helper.rb +0 -65
- data/lib/active_record/mysql/enum/enum_adapter.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: afde12edd641ac6ca2d7f22b1eb581e24bbc33efdcd386214f5048446f5ee76d
|
4
|
+
data.tar.gz: ffcb94f693bf8bceb96bd74df2240bd50dfd1fd3cff908c94bf921aa50c00956
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4384f7be2daa3d298e7e1a1195e0d9b16f896289fc9c9a83805132d3f42dd1f6a387d61afd149928884634bb8209a42895f9aafee9cd5aef667faf8729d6133f
|
7
|
+
data.tar.gz: 1f909f0ec74370ce944d86215b50608fd5d40fe7b2779384f8a191fb69b5aa8a3ca243f986b3aadabcc5bc86e1067bc3dfb3b004fff00d947aa6ee4eaa237668
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require rails_helper
|
data/.travis.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
dist: trusty
|
3
|
+
language: ruby
|
4
|
+
sudo: false
|
5
|
+
cache: bundler
|
6
|
+
rvm:
|
7
|
+
- 2.4.5
|
8
|
+
- 2.5.8
|
9
|
+
- 2.6.5
|
10
|
+
- 2.7.1
|
11
|
+
- ruby-head
|
12
|
+
gemfile:
|
13
|
+
- gemfiles/rails_4.gemfile
|
14
|
+
- gemfiles/rails_5.gemfile
|
15
|
+
- gemfiles/rails_6.gemfile
|
16
|
+
matrix:
|
17
|
+
fast_finish: false
|
18
|
+
exclude:
|
19
|
+
- gemfile: gemfiles/rails_4.gemfile
|
20
|
+
rvm: 2.7.1
|
21
|
+
- gemfile: gemfiles/rails_5.gemfile
|
22
|
+
rvm: 2.4.5
|
23
|
+
- gemfile: gemfiles/rails_6.gemfile
|
24
|
+
rvm: 2.4.5
|
25
|
+
allow_failures:
|
26
|
+
- rvm: ruby-head
|
27
|
+
script:
|
28
|
+
- RAILS_ENV=test bundle exec rake db:create
|
29
|
+
- bundle exec rspec
|
data/Appraisals
ADDED
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,24 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [0.
|
7
|
+
## [1.0.0] - Unreleased
|
8
|
+
### Added
|
9
|
+
- A Rspec test suit
|
10
|
+
- Dummy Rails app to be used by tests
|
11
|
+
- Test coverage reports via Coveralls/SimpleCov
|
12
|
+
- A coverage report badge to the README
|
13
|
+
- Unit tests being run on push with TravisCI
|
14
|
+
- Appraisal to test Rails 4.2, 5.2, and 6.0
|
15
|
+
- A dependency on the mysql2 gem
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
- Existing tests to be run with Rspec
|
19
|
+
|
20
|
+
### Removed
|
21
|
+
- Support for the mysql gem
|
22
|
+
- Support for Rails < 4.2
|
23
|
+
|
24
|
+
## [0.1.4] - Unreleased
|
8
25
|
### Fixed
|
9
26
|
- Fixed bug in `mysql_adapter` where optional arguments being passed to `type_to_sql` would cause
|
10
27
|
an unexpected error
|
@@ -28,6 +45,7 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
|
|
28
45
|
### Changed
|
29
46
|
- Renamed the gem from `enum_column3` to `activerecord-mysql-enum`
|
30
47
|
|
48
|
+
[1.0.0]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.4...v1.0.0
|
31
49
|
[0.1.4]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.3...v0.1.4
|
32
50
|
[0.1.3]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.2...v0.1.3
|
33
51
|
[0.1.2]: https://github.com/Invoca/activerecord-mysql-enum/compare/v0.1.1...v0.1.2
|
data/Gemfile
CHANGED
@@ -5,8 +5,11 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in active_table_set.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem '
|
8
|
+
gem 'appraisal'
|
9
|
+
gem 'coveralls', require: false
|
9
10
|
gem 'pry'
|
10
11
|
gem 'pry-byebug'
|
11
12
|
gem 'rake', '~> 13.0'
|
12
13
|
gem 'rails', '~> 4.2'
|
14
|
+
gem 'rspec'
|
15
|
+
gem 'rspec-rails', '~> 3.0'
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-mysql-enum (0.1
|
4
|
+
activerecord-mysql-enum (1.0.0.pre.1)
|
5
5
|
activerecord (>= 4.2, < 7)
|
6
|
+
mysql2 (= 0.4.5)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
@@ -41,17 +42,30 @@ GEM
|
|
41
42
|
minitest (~> 5.1)
|
42
43
|
thread_safe (~> 0.3, >= 0.3.4)
|
43
44
|
tzinfo (~> 1.1)
|
45
|
+
appraisal (2.3.0)
|
46
|
+
bundler
|
47
|
+
rake
|
48
|
+
thor (>= 0.14.0)
|
44
49
|
arel (6.0.4)
|
45
50
|
builder (3.2.4)
|
46
51
|
byebug (11.1.3)
|
47
52
|
coderay (1.1.3)
|
48
53
|
concurrent-ruby (1.1.7)
|
54
|
+
coveralls (0.8.23)
|
55
|
+
json (>= 1.8, < 3)
|
56
|
+
simplecov (~> 0.16.1)
|
57
|
+
term-ansicolor (~> 1.3)
|
58
|
+
thor (>= 0.19.4, < 2.0)
|
59
|
+
tins (~> 1.6)
|
49
60
|
crass (1.0.6)
|
61
|
+
diff-lcs (1.4.4)
|
62
|
+
docile (1.3.2)
|
50
63
|
erubis (2.7.0)
|
51
64
|
globalid (0.4.2)
|
52
65
|
activesupport (>= 4.2.0)
|
53
66
|
i18n (0.9.5)
|
54
67
|
concurrent-ruby (~> 1.0)
|
68
|
+
json (2.3.1)
|
55
69
|
loofah (2.6.0)
|
56
70
|
crass (~> 1.0.2)
|
57
71
|
nokogiri (>= 1.5.9)
|
@@ -61,6 +75,7 @@ GEM
|
|
61
75
|
mini_mime (1.0.2)
|
62
76
|
mini_portile2 (2.4.0)
|
63
77
|
minitest (5.14.1)
|
78
|
+
mysql2 (0.4.5)
|
64
79
|
nokogiri (1.10.10)
|
65
80
|
mini_portile2 (~> 2.4.0)
|
66
81
|
pry (0.13.1)
|
@@ -97,6 +112,32 @@ GEM
|
|
97
112
|
rake (>= 0.8.7)
|
98
113
|
thor (>= 0.18.1, < 2.0)
|
99
114
|
rake (13.0.1)
|
115
|
+
rspec (3.9.0)
|
116
|
+
rspec-core (~> 3.9.0)
|
117
|
+
rspec-expectations (~> 3.9.0)
|
118
|
+
rspec-mocks (~> 3.9.0)
|
119
|
+
rspec-core (3.9.2)
|
120
|
+
rspec-support (~> 3.9.3)
|
121
|
+
rspec-expectations (3.9.2)
|
122
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
123
|
+
rspec-support (~> 3.9.0)
|
124
|
+
rspec-mocks (3.9.1)
|
125
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
126
|
+
rspec-support (~> 3.9.0)
|
127
|
+
rspec-rails (3.9.1)
|
128
|
+
actionpack (>= 3.0)
|
129
|
+
activesupport (>= 3.0)
|
130
|
+
railties (>= 3.0)
|
131
|
+
rspec-core (~> 3.9.0)
|
132
|
+
rspec-expectations (~> 3.9.0)
|
133
|
+
rspec-mocks (~> 3.9.0)
|
134
|
+
rspec-support (~> 3.9.0)
|
135
|
+
rspec-support (3.9.3)
|
136
|
+
simplecov (0.16.1)
|
137
|
+
docile (~> 1.1)
|
138
|
+
json (>= 1.8, < 3)
|
139
|
+
simplecov-html (~> 0.10.0)
|
140
|
+
simplecov-html (0.10.2)
|
100
141
|
sprockets (3.7.2)
|
101
142
|
concurrent-ruby (~> 1.0)
|
102
143
|
rack (> 1, < 3)
|
@@ -104,8 +145,13 @@ GEM
|
|
104
145
|
actionpack (>= 4.0)
|
105
146
|
activesupport (>= 4.0)
|
106
147
|
sprockets (>= 3.0.0)
|
148
|
+
sync (0.5.0)
|
149
|
+
term-ansicolor (1.7.1)
|
150
|
+
tins (~> 1.0)
|
107
151
|
thor (1.0.1)
|
108
152
|
thread_safe (0.3.6)
|
153
|
+
tins (1.25.0)
|
154
|
+
sync
|
109
155
|
tzinfo (1.2.7)
|
110
156
|
thread_safe (~> 0.1)
|
111
157
|
|
@@ -114,11 +160,14 @@ PLATFORMS
|
|
114
160
|
|
115
161
|
DEPENDENCIES
|
116
162
|
activerecord-mysql-enum!
|
117
|
-
|
163
|
+
appraisal
|
164
|
+
coveralls
|
118
165
|
pry
|
119
166
|
pry-byebug
|
120
167
|
rails (~> 4.2)
|
121
168
|
rake (~> 13.0)
|
169
|
+
rspec
|
170
|
+
rspec-rails (~> 3.0)
|
122
171
|
|
123
172
|
BUNDLED WITH
|
124
173
|
1.17.3
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# ActiveRecord::Mysql::Enum
|
1
|
+
# ActiveRecord::Mysql::Enum [](https://coveralls.io/github/Invoca/activerecord-mysql-enum?branch=master)
|
2
2
|
|
3
3
|
This gem is an extension to ActiveRecord which enables native support of
|
4
4
|
enumerations in the database schema using the ENUM type in MySQL. Forked
|
@@ -7,17 +7,15 @@ which was itself a fork of a fork of Nick Pohodnya's original gem for
|
|
7
7
|
Rails 3, [enum_column3](https://github.com/electronick/enum_column).
|
8
8
|
|
9
9
|
## Support
|
10
|
-
Currently this
|
10
|
+
Currently this is tested with Rails version 4.2, 5.2, and 6.0.
|
11
11
|
|
12
12
|
**Supported adapters:**
|
13
|
-
- mysql
|
14
13
|
- mysql2
|
15
|
-
- jdbcmysql (by Nilesh Trivedi)
|
16
14
|
|
17
15
|
## Installation
|
18
16
|
In your `Gemfile` add the following snippet
|
19
17
|
```ruby
|
20
|
-
gem 'activerecord-mysql-enum', '~> 0
|
18
|
+
gem 'activerecord-mysql-enum', '~> 1.0', require: 'active_record/mysql/enum'
|
21
19
|
```
|
22
20
|
|
23
21
|
## Usage
|
@@ -50,17 +48,3 @@ irb(1)> Enumeration.columns_hash['color'].limit
|
|
50
48
|
irb(2)> @enumeration.column_for_attribute(:color).limit
|
51
49
|
=> [:red, :blue, :green, :yellow]
|
52
50
|
```
|
53
|
-
|
54
|
-
### Form Helpers
|
55
|
-
You can use enum_select helper to generate input for enumerated attribute as:
|
56
|
-
```ruby
|
57
|
-
<%= enum_select(@enumeration, 'severity')%>
|
58
|
-
```
|
59
|
-
|
60
|
-
Or using `form_for`:
|
61
|
-
```ruby
|
62
|
-
<%= form_for @enumeration do |f| %>
|
63
|
-
<%= f.label :severity %>
|
64
|
-
<%= f.enum_select :severity %>
|
65
|
-
<% end %>
|
66
|
-
```
|
data/Rakefile
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
3
5
|
|
4
6
|
Bundler::GemHelper.install_tasks
|
7
|
+
Rails.application.load_tasks
|
8
|
+
|
9
|
+
task default: :rspec
|
10
|
+
|
11
|
+
desc "run rspec unit tests"
|
12
|
+
begin
|
13
|
+
require 'rspec/core/rake_task'
|
14
|
+
RSpec::Core::RakeTask.new(:rspec) do |rspec_task|
|
15
|
+
# rspec_task.exclude_pattern = 'spec/e2e/**/*_spec.rb'
|
16
|
+
end
|
17
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
data/app/mailers/.keep
ADDED
File without changes
|
data/app/models/.keep
ADDED
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>ActiverecordMysqlEnum</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/bin/bundle
ADDED
data/bin/rails
ADDED
data/bin/rake
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
require "active_model/railtie"
|
6
|
+
require "active_job/railtie"
|
7
|
+
require "active_record/railtie"
|
8
|
+
require "action_controller/railtie"
|
9
|
+
require "action_mailer/railtie"
|
10
|
+
require "action_view/railtie"
|
11
|
+
require "sprockets/railtie"
|
12
|
+
# require "rails/test_unit/railtie"
|
13
|
+
|
14
|
+
# Require the gems listed in Gemfile, including any gems
|
15
|
+
# you've limited to :test, :development, or :production.
|
16
|
+
Bundler.require(*Rails.groups)
|
17
|
+
|
18
|
+
module ActiverecordMysqlEnum
|
19
|
+
class Application < Rails::Application
|
20
|
+
# Settings in config/environments/* take precedence over those specified here.
|
21
|
+
# Application configuration should go into files in config/initializers
|
22
|
+
# -- all .rb files in that directory are automatically loaded.
|
23
|
+
|
24
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
27
|
+
|
28
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
29
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
|
+
# config.i18n.default_locale = :de
|
31
|
+
|
32
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
33
|
+
# config.active_record.raise_in_transactional_callbacks = true
|
34
|
+
end
|
35
|
+
end
|