active_record-pgcrypto 0.2.0 → 0.2.1

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: fdfae8c2a06a75d5c690b69ee646b664b72f136d857ef11983a53585f71c6072
4
- data.tar.gz: 2bb21a130b23a38d76241096256e0f674da1aa6314c3a71ccc4d52df8a4f2927
3
+ metadata.gz: 68b93cced1e27c13c2bf95d0731a0f7998ce35b6d481c2b38235cd407697e601
4
+ data.tar.gz: b4e89c6612d5d67661fb4ef896c468c8ba46c2ab4e5ab7aed29c178fe7a65633
5
5
  SHA512:
6
- metadata.gz: 6b53df98419e5a7d87edb67d3408a53285bfdf7d5dfeb2b07b1538631e72ee76e916940b0283f436b40df0a446e74724a4d5485636710f851931e7dcdc3b4409
7
- data.tar.gz: d683c6fab000b48b466e31eaf5d8c20d1978aea0c43c1d3921ccaaa1c1799905c8f3061a4ab7fd956522143fcea1271c2a70e3a986906721ccfcf0abae7da866
6
+ metadata.gz: f135dffa6f20c0623f0fb7dd2804651f5d930eb75958b5a1b69e7ab520a12326aebe35ac2cfdb3a31f52d3057d8d91457402b75ccb548d91f9c8bccd0512049e
7
+ data.tar.gz: 9010ddbc616b30098531785d76e5429cf704755edaf49d0313becde5560dcd3e1ebebbea49725e0f372e1f65eac6e9a1f49f00a2117aaf6b658180445f6e2295
@@ -1,8 +1,9 @@
1
1
  workflow "Docs/Tests" {
2
2
  on = "push"
3
3
  resolves = [
4
- "Builds the Docker image",
5
- "Runs the linters and tests"
4
+ "Runs the linters and tests (Rails 4)",
5
+ "Runs the linters and tests (Rails 5)",
6
+ "Runs the linters and tests (Rails 6)"
6
7
  ]
7
8
  }
8
9
 
@@ -11,8 +12,20 @@ action "Builds the Docker image" {
11
12
  args = "build -f Dockerfile -t active_record-pgcrypto/ci:$GITHUB_SHA ."
12
13
  }
13
14
 
14
- action "Runs the linters and tests" {
15
+ action "Runs the linters and tests (Rails 4)" {
15
16
  uses = "actions/docker/cli@master"
16
17
  needs = ["Builds the Docker image"]
17
- args = "run active_record-pgcrypto/ci:$GITHUB_SHA"
18
+ args = "run -e RAILS_VERSION='~> 4' active_record-pgcrypto/ci:$GITHUB_SHA"
19
+ }
20
+
21
+ action "Runs the linters and tests (Rails 5)" {
22
+ uses = "actions/docker/cli@master"
23
+ needs = ["Builds the Docker image"]
24
+ args = "run -e RAILS_VERSION='~> 5' active_record-pgcrypto/ci:$GITHUB_SHA"
25
+ }
26
+
27
+ action "Runs the linters and tests (Rails 6)" {
28
+ uses = "actions/docker/cli@master"
29
+ needs = ["Builds the Docker image"]
30
+ args = "run -e RAILS_VERSION='~> 6.0.0.rc1' active_record-pgcrypto/ci:$GITHUB_SHA"
18
31
  }
data/Dockerfile CHANGED
@@ -14,4 +14,4 @@ ENV DATABASE_URL=postgresql://postgres@localhost/postgres?pool=5
14
14
 
15
15
  ENTRYPOINT []
16
16
 
17
- CMD ["sh", "-c", "(nohup /docker-entrypoint.sh postgres > /dev/null &) && sleep 3 && bundle exec rake"]
17
+ CMD ["sh", "-c", "(nohup /docker-entrypoint.sh postgres > /dev/null &) && sleep 3 && bundle install && bundle exec rake"]
@@ -21,9 +21,11 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency 'activerecord', ENV['RAILS_VERSION']
23
23
 
24
+ pg_version = '< 1' if ENV['RAILS_VERSION'].to_s.split(' ').last.to_i == 4
25
+
24
26
  spec.add_development_dependency 'bundler'
25
27
  spec.add_development_dependency 'ffaker'
26
- spec.add_development_dependency 'pg'
28
+ spec.add_development_dependency 'pg', pg_version
27
29
  spec.add_development_dependency 'rake'
28
30
  spec.add_development_dependency 'rspec'
29
31
  spec.add_development_dependency 'rubocop-performance'
@@ -1,5 +1,6 @@
1
- require 'active_record/pgcrypto/version'
1
+ require 'active_support'
2
2
  require 'active_record/log_subscriber'
3
+ require 'active_record/pgcrypto/version'
3
4
  require 'active_record/pgcrypto/symmetric_coder'
4
5
  require 'active_record/pgcrypto/log_subscriber'
5
6
 
@@ -10,7 +11,7 @@ module ActiveRecord
10
11
  #
11
12
  # @return [NilClass]
12
13
  def self.enable_log_subscriber!
13
- ActiveRecord::LogSubscriber.prepend(ActiveRecord::PGCrypto::LogSubscriber)
14
+ ::ActiveRecord::LogSubscriber.prepend(LogSubscriber)
14
15
  end
15
16
  end
16
17
  end
@@ -2,17 +2,15 @@ module ActiveRecord
2
2
  module PGCrypto
3
3
  # PGCrypto symmetric encryption/decryption coder for attribute serialization
4
4
  module SymmetricCoder
5
- mattr_accessor :pgcrypto_key, default: ENV['PGCRYPTO_SYM_KEY']
6
- mattr_accessor(
7
- :pgcrypto_options,
8
- default: (
9
- ENV['PGCRYPTO_SYM_OPTIONS'] || 'cipher-algo=aes256, unicode-mode=1'
10
- )
11
- )
12
- mattr_accessor(
13
- :pgcrypto_encoding,
14
- default: Encoding.find(ENV['PGCRYPTO_ENCODING'] || 'utf-8')
15
- )
5
+ mattr_accessor :pgcrypto_key do
6
+ ENV['PGCRYPTO_SYM_KEY']
7
+ end
8
+ mattr_accessor :pgcrypto_options do
9
+ ENV['PGCRYPTO_SYM_OPTIONS'] || 'cipher-algo=aes256, unicode-mode=1'
10
+ end
11
+ mattr_accessor :pgcrypto_encoding do
12
+ Encoding.find(ENV['PGCRYPTO_ENCODING'] || 'utf-8')
13
+ end
16
14
 
17
15
  # Decrypts the requested value
18
16
  #
@@ -73,8 +71,13 @@ module ActiveRecord
73
71
  #
74
72
  # @return [String] the first returned value
75
73
  def self.arel_query(arel_nodes)
76
- query = Arel::SelectManager.new(nil).project(arel_nodes).to_sql
74
+ sel_manager = Arel::SelectManager.new(nil)
75
+
76
+ if ::ActiveRecord::VERSION::MAJOR == 4
77
+ sel_manager = Arel::SelectManager.new(::ActiveRecord::Base)
78
+ end
77
79
 
80
+ query = sel_manager.project(arel_nodes).to_sql
78
81
  ::ActiveRecord::Base.connection.select_value(query)
79
82
  end
80
83
 
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module PGCrypto
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.2.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-pgcrypto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas SUȘCOV