pgcrypto 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/CHANGES +5 -0
  2. data/Gemfile +1 -0
  3. data/VERSION +1 -1
  4. data/lib/pgcrypto.rb +9 -12
  5. data/pgcrypto.gemspec +5 -2
  6. metadata +19 -3
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ 0.2.6
2
+ * We now use the BigSpoon library to hook into reload, because
3
+ it's SO MUCH MORE AWESOME THAN THE GARBAGE MOST PEOPLE USE.
4
+ Welp. It's been nice coding with y'all.
5
+
1
6
  0.2.5
2
7
  * PGCrypto now hooks into ActiveRecord::Base#reload in order to
3
8
  reset encrypted column values as expected when calling reload.
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'activerecord', '>= 3.2', :require => 'active_record'
4
+ gem 'big_spoon'
4
5
 
5
6
  group :development do
6
7
  gem 'jeweler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -24,6 +24,15 @@ module PGCrypto
24
24
 
25
25
  has_many :pgcrypto_columns, :as => :owner, :autosave => true, :class_name => 'PGCrypto::Column', :dependent => :delete_all
26
26
 
27
+ hooks do
28
+ before(:reload) do
29
+ self.class.pgcrpyto_columns.each do |column_name, options|
30
+ reset_attribute! column_name
31
+ changed_attributes.delete(column_name)
32
+ end
33
+ end
34
+ end
35
+
27
36
  pgcrypto_column_names.map(&:to_s).each do |column_name|
28
37
  # Stash the encryption type in our module so various monkeypatches can access it later!
29
38
  PGCrypto[table_name][column_name] = options.symbolize_keys
@@ -72,14 +81,6 @@ module PGCrypto
72
81
  end
73
82
 
74
83
  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
-
83
84
  def select_pgcrypto_column(column_name)
84
85
  return nil if new_record?
85
86
  # Now here's the fun part. We want the selector on PGCrypto columns to do the decryption
@@ -112,8 +113,4 @@ PGCrypto.keys[:public] = {:path => '.pgcrypto'} if File.file?('.pgcrypto')
112
113
  if defined? ActiveRecord::Base
113
114
  ActiveRecord::Base.extend PGCrypto::ClassMethods
114
115
  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
119
116
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "pgcrypto"
8
- s.version = "0.2.5"
8
+ s.version = "0.2.6"
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"]
12
- s.date = "2012-08-11"
12
+ s.date = "2012-08-12"
13
13
  s.description = "\n PGCrypto is an ActiveRecord::Base extension that allows you to asymmetrically\n encrypt PostgreSQL columns with as little trouble as possible. It's totally\n freaking rad.\n "
14
14
  s.email = "flip@x451.com"
15
15
  s.extra_rdoc_files = [
@@ -53,13 +53,16 @@ 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_runtime_dependency(%q<big_spoon>, [">= 0"])
56
57
  s.add_development_dependency(%q<jeweler>, [">= 0"])
57
58
  else
58
59
  s.add_dependency(%q<activerecord>, [">= 3.2"])
60
+ s.add_dependency(%q<big_spoon>, [">= 0"])
59
61
  s.add_dependency(%q<jeweler>, [">= 0"])
60
62
  end
61
63
  else
62
64
  s.add_dependency(%q<activerecord>, [">= 3.2"])
65
+ s.add_dependency(%q<big_spoon>, [">= 0"])
63
66
  s.add_dependency(%q<jeweler>, [">= 0"])
64
67
  end
65
68
  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.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-11 00:00:00.000000000 Z
12
+ date: 2012-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -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: big_spoon
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
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
  - !ruby/object:Gem::Dependency
31
47
  name: jeweler
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -92,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
108
  version: '0'
93
109
  segments:
94
110
  - 0
95
- hash: -1268507522352153843
111
+ hash: 1267524504259079561
96
112
  required_rubygems_version: !ruby/object:Gem::Requirement
97
113
  none: false
98
114
  requirements: