sequel-devise 0.0.9 → 0.0.11

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
  SHA1:
3
- metadata.gz: 2a05872d5e029c5f63a84d06f0b944aeb1677dee
4
- data.tar.gz: 97d0fac7d893a05ec65eb173e4d539c8642f5d77
3
+ metadata.gz: 80142c94ae893738707632a5b8feacdf20805300
4
+ data.tar.gz: 3d5eef8d5ef5789641f7553421d4d98bdec85818
5
5
  SHA512:
6
- metadata.gz: 47682c90fcba4b707ae454eb0143dcdc312624cd89396a564d62e02d369322d6f28f113aaec32097a50bcebf4da86d5936a45735e4159e270d0c429d3a1cd654
7
- data.tar.gz: dc950790fa7d1f97dd68a10074df071b39eef81a086d6040cef40c9f46b56a5f5108dcc5acf255fcdc0f06eb01df0be3135280201e65074254aa0c6c32477de5
6
+ metadata.gz: 8dd4cdc4caa582b464d2871639dd46c4801bb030c2a5ef269c4b5a4e4785691db32d440e681ae2037f7208cd80343dd644312af477ea912c73ba764f14d1abaa
7
+ data.tar.gz: 0a6458524fc1383b220888b2f4679bc468da7b91292e217892c05df5dbc79c1a07c28044cab9c2a0531a88b10b388ea53d23c245403c049e3663f7c6cace4e70
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Allows the usage of a Sequel::Model class as a Devise mapping.
4
4
 
5
+ This gem was previously developed at [rosenfeld/sequel-devise](https://github.com/rosenfeld/sequel-devise).
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -78,3 +80,6 @@ remaining of your application just use your regular user class:
78
80
  4. Push to the branch (`git push origin my-new-feature`)
79
81
  5. Create new Pull Request
80
82
 
83
+ ## Acknowledgements
84
+
85
+ Thanks to [@rosenfeld](https://github.com/rosenfeld) for creating this gem before we started maintaining it!
@@ -1,5 +1,5 @@
1
1
  module Sequel
2
2
  module Devise
3
- VERSION = "0.0.9"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
@@ -71,13 +71,13 @@ module Sequel
71
71
  include OverrideFixes
72
72
  end
73
73
 
74
- Model::HOOKS.each do |hook|
74
+ Model::HOOKS.reject { |hook| hook == :after_commit }.each do |hook|
75
75
  define_method(hook) do |method = nil, options = {}, &block|
76
76
  if Symbol === (if_method = options[:if])
77
77
  orig_block = block
78
78
  block = nil
79
79
  method_without_if = method
80
- method = :"_sequel_hook_with_if_#{method}"
80
+ method = :"_sequel_#{hook}_hook_with_if_#{method}"
81
81
  define_method(method) do
82
82
  return unless send if_method
83
83
  send method_without_if
@@ -88,6 +88,39 @@ module Sequel
88
88
  super method, &block
89
89
  end
90
90
  end
91
+
92
+ define_method(:after_commit) do |method = nil, options = {}, &block|
93
+ if Symbol === (if_method = options[:if])
94
+ orig_block = block
95
+ block = nil
96
+ method_without_if = method
97
+ method = :"_sequel_after_commit_hook_with_if_#{method}"
98
+ define_method(method) do
99
+ return unless send if_method
100
+ send method_without_if
101
+ instance_eval &orig_block if orig_block
102
+ end
103
+ private method
104
+ end
105
+
106
+ commit_method = :"_sequel_after_commit_hook__actual_commit_#{method}"
107
+ define_method(commit_method) do
108
+ db.after_commit do
109
+ send method
110
+ instance_eval &block if block
111
+ end
112
+ end
113
+ private commit_method
114
+
115
+ case options[:on]
116
+ when :create
117
+ send :after_create, commit_method
118
+ when :update
119
+ send :after_update, commit_method
120
+ else
121
+ send :after_save, commit_method
122
+ end
123
+ end
91
124
  end
92
125
  end
93
126
  end
@@ -2,11 +2,11 @@
2
2
  require File.expand_path('../lib/sequel-devise/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Rodrigo Rosenfeld Rosas"]
6
- gem.email = ["rr.rosas@gmail.com"]
5
+ gem.authors = ["Rodrigo Rosenfeld Rosas", "Eugen Kuksa"]
6
+ gem.email = ["kuksa.eugen@gmail.com"]
7
7
  gem.description = %q{Devise support for Sequel models}
8
8
  gem.summary = %q{Enable Devise support by adding plugin :devise to your Sequel Model}
9
- gem.homepage = "https://github.com/rosenfeld/sequel-devise"
9
+ gem.homepage = "https://github.com/ontohub/sequel-devise"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Rosenfeld Rosas
8
+ - Eugen Kuksa
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-07-08 00:00:00.000000000 Z
12
+ date: 2017-06-13 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: devise
@@ -40,7 +41,7 @@ dependencies:
40
41
  version: '0'
41
42
  description: Devise support for Sequel models
42
43
  email:
43
- - rr.rosas@gmail.com
44
+ - kuksa.eugen@gmail.com
44
45
  executables: []
45
46
  extensions: []
46
47
  extra_rdoc_files: []
@@ -54,7 +55,7 @@ files:
54
55
  - lib/sequel-devise/version.rb
55
56
  - lib/sequel/plugins/devise.rb
56
57
  - sequel-devise.gemspec
57
- homepage: https://github.com/rosenfeld/sequel-devise
58
+ homepage: https://github.com/ontohub/sequel-devise
58
59
  licenses: []
59
60
  metadata: {}
60
61
  post_install_message:
@@ -73,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  version: '0'
74
75
  requirements: []
75
76
  rubyforge_project:
76
- rubygems_version: 2.5.1
77
+ rubygems_version: 2.6.11
77
78
  signing_key:
78
79
  specification_version: 4
79
80
  summary: Enable Devise support by adding plugin :devise to your Sequel Model