active_record-pgcrypto 0.2.1 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -11
- data/lib/active_record/pgcrypto.rb +1 -0
- data/lib/active_record/pgcrypto/log_subscriber.rb +3 -5
- data/lib/active_record/pgcrypto/patches.rb +23 -0
- data/lib/active_record/pgcrypto/symmetric_coder.rb +12 -0
- data/lib/active_record/pgcrypto/version.rb +1 -1
- data/spec/active_record/pgcrypto/log_subscriber_spec.rb +24 -0
- data/spec/active_record/pgcrypto/symmetric_coder_spec.rb +36 -0
- data/spec/dummy.rb +27 -0
- data/spec/integration/model_spec.rb +32 -0
- data/spec/spec_helper.rb +22 -0
- metadata +11 -15
- data/.github/main.workflow +0 -31
- data/.gitignore +0 -11
- data/.rubocop.yml +0 -47
- data/.yardstick.yml +0 -29
- data/CODE_OF_CONDUCT.md +0 -74
- data/Dockerfile +0 -17
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -92
- data/Rakefile +0 -23
- data/active_record-pgcrypto.gemspec +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97344e7536d8cae65d07a9367efb4fbafd5c7b2a184a954fc0fa3d1dc9a43240
|
4
|
+
data.tar.gz: 94da041a559e67ea37ce3a97052090dbc6f368d5d9106bbe93509ee089689447
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31bff89b5403e6ade89f4fa80cf770f115d3356523b9841f296deb921e4ded9b1b148e151c2a7994ca4d35ed75410a46a60c6fa2c59b1645be2fdf58c45e0bc2
|
7
|
+
data.tar.gz: 4406389b8f07e536c17276d53bb3c3c73a74e967f8a17cea0e40d496dd46e5575b7a6c6c41033098df22d3f303a7650784b3e2a3a4662ef3ce1bad5015ac65ec
|
data/README.md
CHANGED
@@ -71,15 +71,18 @@ class MyModel < ActiveRecord::Base
|
|
71
71
|
end
|
72
72
|
```
|
73
73
|
|
74
|
-
|
75
|
-
|
74
|
+
NOTE: In order for the encrypted data to be store the column must be of type `binary`.
|
75
|
+
|
76
|
+
The coder provides a simple API to help you provide search support by
|
77
|
+
leveraging the Arel API:
|
76
78
|
|
77
79
|
```ruby
|
78
80
|
class MyModel < ActiveRecord::Base
|
79
81
|
serialize(:email, ActiveRecord::PGCrypto::SymmetricCoder)
|
80
82
|
|
81
83
|
def self.decrypted_email
|
82
|
-
ActiveRecord::PGCrypto::SymmetricCoder
|
84
|
+
ActiveRecord::PGCrypto::SymmetricCoder
|
85
|
+
.decrypted_arel_text(arel_table[:email])
|
83
86
|
end
|
84
87
|
end
|
85
88
|
```
|
@@ -87,21 +90,23 @@ end
|
|
87
90
|
Now you can use add it to your `ActiveRecord::Base#where` queries:
|
88
91
|
|
89
92
|
```ruby
|
90
|
-
MyModel.where(MyModel.decrypted_email.
|
93
|
+
MyModel.where(MyModel.decrypted_email.matches('keyword%'))
|
91
94
|
```
|
92
95
|
|
93
96
|
## Development
|
94
97
|
|
95
|
-
|
98
|
+
Build the Docker image first:
|
99
|
+
|
100
|
+
```
|
101
|
+
docker build -f Dockerfile -t active_record-pgcrypto/ci ./`
|
102
|
+
```
|
96
103
|
|
97
|
-
|
104
|
+
Now you can run the tests:
|
98
105
|
|
99
|
-
|
106
|
+
```
|
107
|
+
docker run -v `pwd`:/gem -it active_record-pgcrypto/ci
|
108
|
+
```
|
100
109
|
|
101
|
-
To release a new version, update the version number in `version.rb`, and then
|
102
|
-
run `bundle exec rake release`, which will create a git tag for the version,
|
103
|
-
push git commits and tags, and push the `.gem` file to
|
104
|
-
[rubygems.org](https://rubygems.org).
|
105
110
|
|
106
111
|
## Contributing
|
107
112
|
|
@@ -2,19 +2,17 @@ module ActiveRecord
|
|
2
2
|
module PGCrypto
|
3
3
|
# Subscribes to the logger and obfuscates the sensitive queries.
|
4
4
|
module LogSubscriber
|
5
|
+
# rubocop:disable Lint/MixedRegexpCaptureTypes
|
5
6
|
REGEXP = \
|
6
7
|
/(\(*)(?<operation>pgp_sym_(decrypt|encrypt)_bytea)(\(+.*\)+)/im.freeze
|
8
|
+
# rubocop:enable Lint/MixedRegexpCaptureTypes
|
7
9
|
PLACEHOLDER = '[FILTERED]'.freeze
|
8
10
|
|
9
11
|
# Scrubs the log event from any sensitive SQL
|
10
12
|
#
|
11
13
|
# @return [NilClass]
|
12
14
|
def sql(event)
|
13
|
-
|
14
|
-
"#{$LAST_MATCH_INFO[:operation]}(#{PLACEHOLDER})"
|
15
|
-
end
|
16
|
-
|
17
|
-
event.payload[:sql] = scrubbed_sql
|
15
|
+
event.payload[:sql] = event.payload[:sql].gsub(REGEXP, PLACEHOLDER)
|
18
16
|
|
19
17
|
super(event)
|
20
18
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'active_record/type/serialized'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
# ...
|
5
|
+
module PGCrypto
|
6
|
+
# Patched `serialize` wrapper class to play well with [ActiveModel::Dirty]
|
7
|
+
module PatchedSerialized
|
8
|
+
# Determines whether the mutable value has been modified since it was read
|
9
|
+
#
|
10
|
+
# Since encrypted binary data, from our coder,
|
11
|
+
# can return same decrypted values, we don't check it.
|
12
|
+
#
|
13
|
+
# @return [FalseClass] on our coder values.
|
14
|
+
def changed_in_place?(*args, **kwargs)
|
15
|
+
return false if coder == ActiveRecord::PGCrypto::SymmetricCoder
|
16
|
+
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
ActiveRecord::Type::Serialized.prepend(PatchedSerialized)
|
22
|
+
end
|
23
|
+
end
|
@@ -55,6 +55,18 @@ module ActiveRecord
|
|
55
55
|
)
|
56
56
|
end
|
57
57
|
|
58
|
+
# Wraps a node for decryption and text encoded calls
|
59
|
+
#
|
60
|
+
# @return [Arel::Node]
|
61
|
+
def self.decrypted_arel_text(node)
|
62
|
+
Arel::Nodes::NamedFunction.new(
|
63
|
+
'ENCODE', [
|
64
|
+
decrypted_arel(node),
|
65
|
+
Arel::Nodes::Quoted.new('escape')
|
66
|
+
]
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
58
70
|
# Wraps the value into an [Arel::Node] with SQL calls for decryption
|
59
71
|
#
|
60
72
|
# @return [Arel::Node]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'active_record/pgcrypto/log_subscriber'
|
3
|
+
|
4
|
+
RSpec.describe ActiveRecord::PGCrypto::LogSubscriber do
|
5
|
+
let(:pgcrypto_key) { FFaker::Internet.password }
|
6
|
+
let(:subscriber) { ActiveRecord::LogSubscriber.new }
|
7
|
+
let(:event_payload) do
|
8
|
+
{ sql: "SELECT PGP_SYM_ENCRYPT_BYTEA('data', '#{pgcrypto_key}')" }
|
9
|
+
end
|
10
|
+
let(:event) do
|
11
|
+
ActiveSupport::Notifications::Event.new(:test, 0, 0, :id, event_payload)
|
12
|
+
end
|
13
|
+
|
14
|
+
before do
|
15
|
+
ActiveRecord::PGCrypto.enable_log_subscriber!
|
16
|
+
end
|
17
|
+
|
18
|
+
it do
|
19
|
+
subscriber.sql(event)
|
20
|
+
|
21
|
+
expect(event.payload[:sql]).not_to include(pgcrypto_key)
|
22
|
+
expect(event.payload[:sql]).to include(described_class::PLACEHOLDER)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'active_record/pgcrypto/symmetric_coder'
|
3
|
+
|
4
|
+
RSpec.describe ActiveRecord::PGCrypto::SymmetricCoder do
|
5
|
+
let(:pgcrypto_key) { FFaker::Internet.password }
|
6
|
+
let(:text) { '€n©őđ3Đ' }
|
7
|
+
let(:numeric) { rand(1.0..5.0) }
|
8
|
+
|
9
|
+
before do
|
10
|
+
described_class.pgcrypto_key = pgcrypto_key
|
11
|
+
end
|
12
|
+
|
13
|
+
it { expect(described_class.pgcrypto_key).to eq(pgcrypto_key) }
|
14
|
+
|
15
|
+
context 'with encrypted text' do
|
16
|
+
it { expect(described_class.dump(text)).not_to eq(text) }
|
17
|
+
|
18
|
+
it { expect(described_class.dump(text)).not_to be_blank }
|
19
|
+
|
20
|
+
it do
|
21
|
+
expect(described_class.load(described_class.dump(text))).to eq(text)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'with encrypted numeric' do
|
26
|
+
it { expect(described_class.dump(numeric)).not_to eq(numeric.to_s) }
|
27
|
+
|
28
|
+
it { expect(described_class.dump(numeric)).not_to be_blank }
|
29
|
+
|
30
|
+
it do
|
31
|
+
expect(
|
32
|
+
described_class.load(described_class.dump(numeric))
|
33
|
+
).to eq(numeric.to_s)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/spec/dummy.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
ActiveRecord::Base.logger = Logger.new($stdout)
|
5
|
+
ActiveRecord::Base.logger.level = ENV['LOG_LEVEL'] || Logger::WARN
|
6
|
+
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
|
7
|
+
|
8
|
+
ActiveRecord::Schema.define do
|
9
|
+
enable_extension 'pgcrypto'
|
10
|
+
|
11
|
+
create_table :users, force: true do |t|
|
12
|
+
t.binary :email
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Enable PGCrypto Symmetric encryption support.
|
17
|
+
ENV['PGCRYPTO_SYM_KEY'] = SecureRandom.hex(10)
|
18
|
+
require 'active_record/pgcrypto'
|
19
|
+
|
20
|
+
class User < ActiveRecord::Base
|
21
|
+
serialize(:email, ActiveRecord::PGCrypto::SymmetricCoder)
|
22
|
+
|
23
|
+
def self.decrypted_email
|
24
|
+
ActiveRecord::PGCrypto::SymmetricCoder
|
25
|
+
.decrypted_arel_text(arel_table[:email])
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'securerandom'
|
3
|
+
|
4
|
+
RSpec.describe User do
|
5
|
+
let(:good_user) { User.create!(email: FFaker::Internet.email) }
|
6
|
+
let(:bad_user) { User.create!(email: FFaker::Internet.email) }
|
7
|
+
|
8
|
+
it 'finds the searched user' do
|
9
|
+
expect(good_user.email).not_to eq(bad_user.email)
|
10
|
+
|
11
|
+
filtered = User.where(
|
12
|
+
User.decrypted_email.matches("#{good_user.email.first(4)}%")
|
13
|
+
)
|
14
|
+
|
15
|
+
expect(filtered.count).to eq(1)
|
16
|
+
expect(filtered.first).to eq(good_user)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'stays unchanged' do
|
20
|
+
good_user.reload
|
21
|
+
expect(good_user).not_to be_changed
|
22
|
+
|
23
|
+
good_user.email = good_user.reload.email
|
24
|
+
expect(good_user).not_to be_changed
|
25
|
+
|
26
|
+
good_user.email = FFaker::Internet.email
|
27
|
+
expect(good_user).to be_changed
|
28
|
+
|
29
|
+
good_user.reload
|
30
|
+
expect(good_user).not_to be_changed
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'simplecov'
|
3
|
+
|
4
|
+
SimpleCov.start do
|
5
|
+
add_group 'Lib', 'lib'
|
6
|
+
add_group 'Tests', 'spec'
|
7
|
+
end
|
8
|
+
SimpleCov.minimum_coverage 90
|
9
|
+
|
10
|
+
require 'dummy'
|
11
|
+
require 'ffaker'
|
12
|
+
require 'rspec'
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.mock_with :rspec
|
16
|
+
config.filter_run_when_matching :focus
|
17
|
+
config.disable_monkey_patching!
|
18
|
+
|
19
|
+
config.expect_with :rspec do |c|
|
20
|
+
c.syntax = :expect
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record-pgcrypto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas SUȘCOV
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,22 +157,18 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
-
- ".github/main.workflow"
|
161
|
-
- ".gitignore"
|
162
|
-
- ".rubocop.yml"
|
163
|
-
- ".yardstick.yml"
|
164
|
-
- CODE_OF_CONDUCT.md
|
165
|
-
- Dockerfile
|
166
|
-
- Gemfile
|
167
|
-
- Gemfile.lock
|
168
160
|
- LICENSE.txt
|
169
161
|
- README.md
|
170
|
-
- Rakefile
|
171
|
-
- active_record-pgcrypto.gemspec
|
172
162
|
- lib/active_record/pgcrypto.rb
|
173
163
|
- lib/active_record/pgcrypto/log_subscriber.rb
|
164
|
+
- lib/active_record/pgcrypto/patches.rb
|
174
165
|
- lib/active_record/pgcrypto/symmetric_coder.rb
|
175
166
|
- lib/active_record/pgcrypto/version.rb
|
167
|
+
- spec/active_record/pgcrypto/log_subscriber_spec.rb
|
168
|
+
- spec/active_record/pgcrypto/symmetric_coder_spec.rb
|
169
|
+
- spec/dummy.rb
|
170
|
+
- spec/integration/model_spec.rb
|
171
|
+
- spec/spec_helper.rb
|
176
172
|
homepage: https://github.com/stas/active_record-pgcrypto
|
177
173
|
licenses:
|
178
174
|
- MIT
|
@@ -192,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
188
|
- !ruby/object:Gem::Version
|
193
189
|
version: '0'
|
194
190
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
191
|
+
rubygems_version: 3.2.3
|
196
192
|
signing_key:
|
197
193
|
specification_version: 4
|
198
194
|
summary: PGCrypto for ActiveRecord
|
data/.github/main.workflow
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
workflow "Docs/Tests" {
|
2
|
-
on = "push"
|
3
|
-
resolves = [
|
4
|
-
"Runs the linters and tests (Rails 4)",
|
5
|
-
"Runs the linters and tests (Rails 5)",
|
6
|
-
"Runs the linters and tests (Rails 6)"
|
7
|
-
]
|
8
|
-
}
|
9
|
-
|
10
|
-
action "Builds the Docker image" {
|
11
|
-
uses = "actions/docker/cli@master"
|
12
|
-
args = "build -f Dockerfile -t active_record-pgcrypto/ci:$GITHUB_SHA ."
|
13
|
-
}
|
14
|
-
|
15
|
-
action "Runs the linters and tests (Rails 4)" {
|
16
|
-
uses = "actions/docker/cli@master"
|
17
|
-
needs = ["Builds the Docker image"]
|
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"
|
31
|
-
}
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-performance
|
3
|
-
- rubocop-rspec
|
4
|
-
|
5
|
-
RSpec:
|
6
|
-
Enabled: true
|
7
|
-
|
8
|
-
RSpec/MultipleExpectations:
|
9
|
-
Enabled: false
|
10
|
-
|
11
|
-
Performance:
|
12
|
-
Enabled: true
|
13
|
-
|
14
|
-
Bundler:
|
15
|
-
Enabled: true
|
16
|
-
|
17
|
-
Gemspec:
|
18
|
-
Enabled: true
|
19
|
-
|
20
|
-
Style/StringLiterals:
|
21
|
-
Enabled: true
|
22
|
-
EnforcedStyle: single_quotes
|
23
|
-
|
24
|
-
Style/FrozenStringLiteralComment:
|
25
|
-
Enabled: false
|
26
|
-
|
27
|
-
Metrics/LineLength:
|
28
|
-
Max: 80
|
29
|
-
|
30
|
-
Metrics/BlockLength:
|
31
|
-
Exclude:
|
32
|
-
- 'spec/**/*_spec.rb'
|
33
|
-
- '**/*.gemspec'
|
34
|
-
|
35
|
-
Layout/IndentationConsistency:
|
36
|
-
EnforcedStyle: normal
|
37
|
-
|
38
|
-
Style/BlockDelimiters:
|
39
|
-
Enabled: true
|
40
|
-
|
41
|
-
RSpec/FilePath:
|
42
|
-
Exclude:
|
43
|
-
- 'spec/**/*_spec.rb'
|
44
|
-
|
45
|
-
RSpec/DescribedClass:
|
46
|
-
Exclude:
|
47
|
-
- 'spec/integration/*_spec.rb'
|
data/.yardstick.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
---
|
2
|
-
path: ['lib/**/*.rb']
|
3
|
-
threshold: 100
|
4
|
-
rules:
|
5
|
-
ApiTag::Presence:
|
6
|
-
enabled: false
|
7
|
-
ApiTag::Inclusion:
|
8
|
-
enabled: false
|
9
|
-
ApiTag::ProtectedMethod:
|
10
|
-
enabled: false
|
11
|
-
ApiTag::PrivateMethod:
|
12
|
-
enabled: false
|
13
|
-
ExampleTag:
|
14
|
-
enabled: false
|
15
|
-
ReturnTag:
|
16
|
-
enabled: true
|
17
|
-
exclude: []
|
18
|
-
Summary::Presence:
|
19
|
-
enabled: true
|
20
|
-
exclude: []
|
21
|
-
Summary::Length:
|
22
|
-
enabled: true
|
23
|
-
exclude: []
|
24
|
-
Summary::Delimiter:
|
25
|
-
enabled: true
|
26
|
-
exclude: []
|
27
|
-
Summary::SingleLine:
|
28
|
-
enabled: true
|
29
|
-
exclude: []
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at stas@nerd.ro. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Dockerfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
FROM postgres:10.5-alpine
|
2
|
-
|
3
|
-
RUN apk add --no-cache git build-base ruby ruby-full ruby-dev
|
4
|
-
|
5
|
-
RUN gem install -q --no-ri --no-rdoc -v '~> 1' bundler
|
6
|
-
|
7
|
-
RUN mkdir /gem
|
8
|
-
WORKDIR /gem
|
9
|
-
|
10
|
-
COPY ./ ./
|
11
|
-
RUN bundle install --no-cache
|
12
|
-
|
13
|
-
ENV DATABASE_URL=postgresql://postgres@localhost/postgres?pool=5
|
14
|
-
|
15
|
-
ENTRYPOINT []
|
16
|
-
|
17
|
-
CMD ["sh", "-c", "(nohup /docker-entrypoint.sh postgres > /dev/null &) && sleep 3 && bundle install && bundle exec rake"]
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
active_record-pgcrypto (0.1.1)
|
5
|
-
activerecord
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activemodel (5.2.3)
|
11
|
-
activesupport (= 5.2.3)
|
12
|
-
activerecord (5.2.3)
|
13
|
-
activemodel (= 5.2.3)
|
14
|
-
activesupport (= 5.2.3)
|
15
|
-
arel (>= 9.0)
|
16
|
-
activesupport (5.2.3)
|
17
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>= 0.7, < 2)
|
19
|
-
minitest (~> 5.1)
|
20
|
-
tzinfo (~> 1.1)
|
21
|
-
arel (9.0.0)
|
22
|
-
ast (2.4.0)
|
23
|
-
concurrent-ruby (1.1.5)
|
24
|
-
diff-lcs (1.3)
|
25
|
-
docile (1.3.2)
|
26
|
-
ffaker (2.11.0)
|
27
|
-
i18n (1.6.0)
|
28
|
-
concurrent-ruby (~> 1.0)
|
29
|
-
jaro_winkler (1.5.3)
|
30
|
-
json (2.2.0)
|
31
|
-
minitest (5.11.3)
|
32
|
-
parallel (1.17.0)
|
33
|
-
parser (2.6.3.0)
|
34
|
-
ast (~> 2.4.0)
|
35
|
-
pg (1.1.4)
|
36
|
-
rainbow (3.0.0)
|
37
|
-
rake (12.3.2)
|
38
|
-
rspec (3.8.0)
|
39
|
-
rspec-core (~> 3.8.0)
|
40
|
-
rspec-expectations (~> 3.8.0)
|
41
|
-
rspec-mocks (~> 3.8.0)
|
42
|
-
rspec-core (3.8.2)
|
43
|
-
rspec-support (~> 3.8.0)
|
44
|
-
rspec-expectations (3.8.4)
|
45
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.8.0)
|
47
|
-
rspec-mocks (3.8.1)
|
48
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.8.0)
|
50
|
-
rspec-support (3.8.2)
|
51
|
-
rubocop (0.72.0)
|
52
|
-
jaro_winkler (~> 1.5.1)
|
53
|
-
parallel (~> 1.10)
|
54
|
-
parser (>= 2.6)
|
55
|
-
rainbow (>= 2.2.2, < 4.0)
|
56
|
-
ruby-progressbar (~> 1.7)
|
57
|
-
unicode-display_width (>= 1.4.0, < 1.7)
|
58
|
-
rubocop-performance (1.4.0)
|
59
|
-
rubocop (>= 0.71.0)
|
60
|
-
rubocop-rspec (1.33.0)
|
61
|
-
rubocop (>= 0.60.0)
|
62
|
-
ruby-progressbar (1.10.1)
|
63
|
-
simplecov (0.17.0)
|
64
|
-
docile (~> 1.1)
|
65
|
-
json (>= 1.8, < 3)
|
66
|
-
simplecov-html (~> 0.10.0)
|
67
|
-
simplecov-html (0.10.2)
|
68
|
-
thread_safe (0.3.6)
|
69
|
-
tzinfo (1.2.5)
|
70
|
-
thread_safe (~> 0.1)
|
71
|
-
unicode-display_width (1.6.0)
|
72
|
-
yard (0.9.20)
|
73
|
-
yardstick (0.9.9)
|
74
|
-
yard (~> 0.8, >= 0.8.7.2)
|
75
|
-
|
76
|
-
PLATFORMS
|
77
|
-
ruby
|
78
|
-
|
79
|
-
DEPENDENCIES
|
80
|
-
active_record-pgcrypto!
|
81
|
-
bundler
|
82
|
-
ffaker
|
83
|
-
pg
|
84
|
-
rake
|
85
|
-
rspec
|
86
|
-
rubocop-performance
|
87
|
-
rubocop-rspec
|
88
|
-
simplecov
|
89
|
-
yardstick
|
90
|
-
|
91
|
-
BUNDLED WITH
|
92
|
-
1.17.2
|
data/Rakefile
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
require 'rubocop/rake_task'
|
4
|
-
require 'yaml'
|
5
|
-
require 'yardstick/rake/verify'
|
6
|
-
|
7
|
-
desc('Documentation stats and measurements')
|
8
|
-
task('qa:docs') do
|
9
|
-
yaml = YAML.load_file('.yardstick.yml')
|
10
|
-
config = Yardstick::Config.coerce(yaml)
|
11
|
-
measure = Yardstick.measure(config)
|
12
|
-
measure.puts
|
13
|
-
coverage = Yardstick.round_percentage(measure.coverage * 100)
|
14
|
-
exit(1) if coverage < config.threshold
|
15
|
-
end
|
16
|
-
|
17
|
-
RuboCop::RakeTask.new('qa:code')
|
18
|
-
|
19
|
-
desc('Run QA tasks')
|
20
|
-
task(qa: ['qa:docs', 'qa:code'])
|
21
|
-
|
22
|
-
RSpec::Core::RakeTask.new(spec: :qa)
|
23
|
-
task(default: :spec)
|
@@ -1,35 +0,0 @@
|
|
1
|
-
lib = File.expand_path('lib', __dir__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'active_record/pgcrypto/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'active_record-pgcrypto'
|
7
|
-
spec.version = ActiveRecord::PGCrypto::VERSION
|
8
|
-
spec.authors = ['Stas SUȘCOV']
|
9
|
-
spec.email = ['stas@nerd.ro']
|
10
|
-
|
11
|
-
spec.summary = 'PGCrypto for ActiveRecord'
|
12
|
-
spec.description = 'PostgreSQL PGCrypto support for ActiveRecord models.'
|
13
|
-
spec.homepage = 'https://github.com/stas/active_record-pgcrypto'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
19
|
-
end
|
20
|
-
spec.require_paths = ['lib']
|
21
|
-
|
22
|
-
spec.add_dependency 'activerecord', ENV['RAILS_VERSION']
|
23
|
-
|
24
|
-
pg_version = '< 1' if ENV['RAILS_VERSION'].to_s.split(' ').last.to_i == 4
|
25
|
-
|
26
|
-
spec.add_development_dependency 'bundler'
|
27
|
-
spec.add_development_dependency 'ffaker'
|
28
|
-
spec.add_development_dependency 'pg', pg_version
|
29
|
-
spec.add_development_dependency 'rake'
|
30
|
-
spec.add_development_dependency 'rspec'
|
31
|
-
spec.add_development_dependency 'rubocop-performance'
|
32
|
-
spec.add_development_dependency 'rubocop-rspec'
|
33
|
-
spec.add_development_dependency 'simplecov'
|
34
|
-
spec.add_development_dependency 'yardstick'
|
35
|
-
end
|