ar-enum 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f49a388dead9cf884822c5c21073a00f8cd89616f15e282ab418076b2b687a2b
4
- data.tar.gz: edf1bf166a224156ab443eafdc2bc91ad027631c0731d93ed9c24b9eb4f197bd
3
+ metadata.gz: 7d19aadabd18299434e0b2d6b0575c818e50219a52dc2498d9cd2547fd1762ed
4
+ data.tar.gz: 319fd8919aa508923146bcbc06867e9547c8623903d37789c90ef9310745ff25
5
5
  SHA512:
6
- metadata.gz: 450a91d4321a891a057484e2bcc676179449a903d5dc7c98a6505270ad1443e96ef38262d241d71b109c0b55fbd09106481c7c9dc9a16c85b463a9c9fadbc96c
7
- data.tar.gz: e40a739ba7bb496a249e1c0a67d40505857fb989a6469bd42794765b8705a2dce16b6f4e980c1e0c133171ac3f76af48cb2d8514431aca086c905cee43bedf95
6
+ metadata.gz: 2126449281a5b6a2c3b26649efcb287db2da514804ac5ee38306b95f27d7caec964f1afde1d359575f2952d1c3c9fff660039e8e046c27084404f7c9705082c9
7
+ data.tar.gz: 9666be7a4612e9fa07afbb05aa1ba6f4002c8f56b199f3f102ff083a3040b685dd6f79b54b50707adecacdf29a764f1314424f7d41b1a166ea96136ab38e80b0
@@ -0,0 +1,6 @@
1
+ ---
2
+ inherit_gem:
3
+ rubocop-fnando: .rubocop.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
@@ -1,31 +1,33 @@
1
+ ---
1
2
  language: ruby
3
+ dist: xenial
2
4
  addons:
3
- postgresql: "10"
5
+ postgresql: "11"
4
6
  apt:
5
7
  packages:
6
- - postgresql-10
7
- - postgresql-client-10
8
+ - postgresql-11
9
+ - postgresql-client-11
8
10
  cache: bundler
9
11
  before_install:
10
- - sudo service postgresql stop
11
- - sed -e 's/^port.*/port = 5432/' /etc/postgresql/10/main/postgresql.conf > postgresql.conf
12
- - sudo chown postgres postgresql.conf
13
- - sudo mv postgresql.conf /etc/postgresql/10/main
14
- - sudo service postgresql start 10
12
+ - gem install bundler
13
+ - sudo service postgresql stop
14
+ - sed -e 's/^port.*/port = 5432/' /etc/postgresql/11/main/postgresql.conf > postgresql.conf
15
+ - sudo chown postgres postgresql.conf
16
+ - sudo mv postgresql.conf /etc/postgresql/11/main
17
+ - sudo service postgresql start 11
15
18
  before_script:
16
- - createdb test
17
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
18
- - chmod +x ./cc-test-reporter
19
- - "./cc-test-reporter before-build"
19
+ - createdb test
20
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
21
+ - chmod +x ./cc-test-reporter
22
+ - "./cc-test-reporter before-build"
20
23
  after_script:
21
- - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
24
+ - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
22
25
  gemfile:
23
- - Gemfile
24
- - gemfiles/activerecord_6_0.gemfile
25
- - gemfiles/activerecord_5_2.gemfile
26
+ - gemfiles/activerecord_6_0.gemfile
27
+ - gemfiles/activerecord_5_2.gemfile
26
28
  rvm:
27
- - 2.6.1
28
- - 2.5.3
29
+ - 2.6.5
30
+ - 2.5.7
29
31
  notifications:
30
32
  email: false
31
33
  env:
@@ -3,4 +3,4 @@
3
3
  source "https://rubygems.org"
4
4
  gemspec path: ".."
5
5
 
6
- gem "activerecord", "~> 6.0.0.beta2"
6
+ gem "activerecord", "~> 6.0.0"
@@ -19,13 +19,17 @@ end
19
19
 
20
20
  ActiveSupport.on_load(:active_record) do
21
21
  require "active_record/connection_adapters/postgresql_adapter"
22
+ silence_warnings do
23
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES = ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES.dup
24
+ end
22
25
 
23
26
  ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(
24
27
  Module.new do
25
28
  def create_table_definition(*args)
26
29
  ActiveRecord::Base.connection.enum_types.each do |enum|
27
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[enum["name"].to_sym] = {name: enum["name"]}
28
30
  ActiveRecord::ConnectionAdapters::PostgreSQL::ColumnMethods.class_eval do
31
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[enum["name"].to_sym] = {name: enum["name"]}
32
+
29
33
  define_method(enum["name"]) do |*names, **options|
30
34
  names.each {|name| column(name, enum["name"].to_sym, options) }
31
35
  end
@@ -53,7 +57,7 @@ ActiveSupport.on_load(:active_record) do
53
57
  )
54
58
  type_metadata = ActiveRecord::ConnectionAdapters::PostgreSQLTypeMetadata.new(type_metadata)
55
59
 
56
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[type_metadata.type] = {name: "character varying"}
60
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[type_metadata.type] = {name: "character varying"}
57
61
  end
58
62
 
59
63
  type_metadata
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AR
4
4
  module Enum
5
- VERSION = "0.2.3"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar-enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -116,6 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
+ - ".rubocop.yml"
119
120
  - ".travis.yml"
120
121
  - CHANGELOG.md
121
122
  - CODE_OF_CONDUCT.md
@@ -151,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  - !ruby/object:Gem::Version
152
153
  version: '0'
153
154
  requirements: []
154
- rubygems_version: 3.0.1
155
+ rubygems_version: 3.0.3
155
156
  signing_key:
156
157
  specification_version: 4
157
158
  summary: Add support for creating `ENUM` types in PostgreSQL with ActiveRecord