pgcrypto 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/Gemfile +4 -2
- data/VERSION +1 -1
- data/lib/pgcrypto.rb +16 -0
- data/pgcrypto.gemspec +4 -1
- data/spec/lib/pgcrypto_spec.rb +8 -0
- metadata +18 -2
data/CHANGES
CHANGED
data/Gemfile
CHANGED
@@ -2,13 +2,15 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'activerecord', '>= 3.2', :require => 'active_record'
|
4
4
|
|
5
|
+
group :development do
|
6
|
+
gem 'jeweler'
|
7
|
+
end
|
8
|
+
|
5
9
|
group :test do
|
6
10
|
gem 'database_cleaner', '>= 0.7'
|
7
11
|
gem 'fuubar'
|
8
12
|
gem 'guard-rspec'
|
9
|
-
gem 'jeweler'
|
10
13
|
gem 'pg', '>= 0.11'
|
11
|
-
gem 'rake'
|
12
14
|
gem 'rspec', rspec_version = '>= 2.6'
|
13
15
|
gem 'simplecov', :require => false
|
14
16
|
gem 'terminal-notifier'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
data/lib/pgcrypto.rb
CHANGED
@@ -65,9 +65,21 @@ module PGCrypto
|
|
65
65
|
default_scope includes(:pgcrypto_columns)
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
def pgcrpyto_columns
|
70
|
+
PGCrypto[table_name]
|
71
|
+
end
|
68
72
|
end
|
69
73
|
|
70
74
|
module InstanceMethods
|
75
|
+
def reload_with_pgcrypto(*args)
|
76
|
+
self.class.pgcrpyto_columns.each do |column_name, options|
|
77
|
+
reset_attribute! column_name
|
78
|
+
changed_attributes.delete(column_name)
|
79
|
+
end
|
80
|
+
reload_without_pgcrypto *args
|
81
|
+
end
|
82
|
+
|
71
83
|
def select_pgcrypto_column(column_name)
|
72
84
|
return nil if new_record?
|
73
85
|
# Now here's the fun part. We want the selector on PGCrypto columns to do the decryption
|
@@ -100,4 +112,8 @@ PGCrypto.keys[:public] = {:path => '.pgcrypto'} if File.file?('.pgcrypto')
|
|
100
112
|
if defined? ActiveRecord::Base
|
101
113
|
ActiveRecord::Base.extend PGCrypto::ClassMethods
|
102
114
|
ActiveRecord::Base.send :include, PGCrypto::InstanceMethods
|
115
|
+
ActiveRecord::Base.class_eval do
|
116
|
+
alias :reload_without_pgcrypto :reload
|
117
|
+
alias :reload :reload_with_pgcrypto
|
118
|
+
end
|
103
119
|
end
|
data/pgcrypto.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "pgcrypto"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Flip Sasser"]
|
@@ -53,11 +53,14 @@ Gem::Specification.new do |s|
|
|
53
53
|
|
54
54
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
55
|
s.add_runtime_dependency(%q<activerecord>, [">= 3.2"])
|
56
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
56
57
|
else
|
57
58
|
s.add_dependency(%q<activerecord>, [">= 3.2"])
|
59
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
58
60
|
end
|
59
61
|
else
|
60
62
|
s.add_dependency(%q<activerecord>, [">= 3.2"])
|
63
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
data/spec/lib/pgcrypto_spec.rb
CHANGED
@@ -74,5 +74,13 @@ describe PGCrypto do
|
|
74
74
|
model.test_column = 'i am clean'
|
75
75
|
model.test_column_changed?.should_not be_true
|
76
76
|
end
|
77
|
+
|
78
|
+
it "should reload with the class" do
|
79
|
+
model = PGCryptoTestModel.create!(:test_column => 'i am clean')
|
80
|
+
model.test_column = 'i am dirty'
|
81
|
+
model.reload
|
82
|
+
model.test_column.should == 'i am clean'
|
83
|
+
model.test_column_changed?.should_not be_true
|
84
|
+
end
|
77
85
|
end
|
78
86
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgcrypto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.2'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: jeweler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
description: ! "\n PGCrypto is an ActiveRecord::Base extension that allows you
|
31
47
|
to asymmetrically\n encrypt PostgreSQL columns with as little trouble as possible.
|
32
48
|
It's totally\n freaking rad.\n "
|
@@ -76,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
92
|
version: '0'
|
77
93
|
segments:
|
78
94
|
- 0
|
79
|
-
hash: -
|
95
|
+
hash: -1268507522352153843
|
80
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
97
|
none: false
|
82
98
|
requirements:
|