rubocop update and resolutions
This commit is contained in:
parent
9362f506ee
commit
b063f188b9
@ -41,7 +41,6 @@ Style/StringLiterals:
|
|||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Exclude:
|
Exclude:
|
||||||
- db/migrate/**/*
|
- db/migrate/**/*
|
||||||
- app/services/crypt_serializer.rb
|
|
||||||
|
|
||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Max: 110
|
Max: 110
|
||||||
@ -54,3 +53,6 @@ Metrics/LineLength:
|
|||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
- db/migrate/*
|
- db/migrate/*
|
||||||
|
|
||||||
|
Rails:
|
||||||
|
Enabled: true
|
||||||
|
1
.ruby_version
Normal file
1
.ruby_version
Normal file
@ -0,0 +1 @@
|
|||||||
|
2.3.1
|
@ -32,5 +32,6 @@ end
|
|||||||
guard :rubocop do
|
guard :rubocop do
|
||||||
watch(/.+\.rb$/)
|
watch(/.+\.rb$/)
|
||||||
watch(/Rakefile/)
|
watch(/Rakefile/)
|
||||||
|
watch(/.rubocop.yml/)
|
||||||
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
||||||
end
|
end
|
||||||
|
@ -26,15 +26,25 @@ class CryptSerializer
|
|||||||
raise "Attribute was supposed to be a `String`, but was instead a `#{value.class}`"
|
raise "Attribute was supposed to be a `String`, but was instead a `#{value.class}`"
|
||||||
end
|
end
|
||||||
|
|
||||||
cipher.encrypt
|
build_cipher value
|
||||||
parts = [cipher.random_key, cipher.random_iv, cipher.update(value) + cipher.final]
|
|
||||||
Base64.urlsafe_encode64 Marshal.dump(parts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def decrypt(value)
|
def decrypt(value)
|
||||||
return value if value.nil?
|
return value if value.nil?
|
||||||
|
|
||||||
parts = Marshal.load Base64.urlsafe_decode64(value)
|
parts = Marshal.load Base64.urlsafe_decode64(value)
|
||||||
|
decode_cipher parts
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def build_cipher value
|
||||||
|
cipher.encrypt
|
||||||
|
parts = [cipher.random_key, cipher.random_iv, cipher.update(value) + cipher.final]
|
||||||
|
Base64.urlsafe_encode64 Marshal.dump(parts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def decode_cipher parts
|
||||||
cipher.decrypt
|
cipher.decrypt
|
||||||
cipher.key = parts[0]
|
cipher.key = parts[0]
|
||||||
cipher.iv = parts[1]
|
cipher.iv = parts[1]
|
||||||
|
@ -16,7 +16,7 @@ default: &default
|
|||||||
host: <%= ENV['mysql_host'] %>
|
host: <%= ENV['mysql_host'] %>
|
||||||
username: <%= ENV['mysql_usr'] %>
|
username: <%= ENV['mysql_usr'] %>
|
||||||
password: <%= ENV['mysql_pwd'] %>
|
password: <%= ENV['mysql_pwd'] %>
|
||||||
socket: /var/run/mysqld/mysqld.sock
|
# socket: /var/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *default
|
<<: *default
|
||||||
|
Loading…
Reference in New Issue
Block a user