hairtrigger 0.2.23 → 0.2.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/hair_trigger.rb +6 -4
- data/lib/hair_trigger/builder.rb +6 -6
- data/lib/hair_trigger/schema_dumper.rb +1 -1
- data/lib/hair_trigger/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3a4b255f8184decc442a9c455f5b8a5a5c9bd48
|
4
|
+
data.tar.gz: b6c202c7328de121c67161cc4d31d83926076044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eb6f48db749f2841ee9a0b986dbaf9cf2d93f48f687822e8a6dda52c90e45165fba783510e7fb1e5ec8a490ce4a6dd58df5f2ebd04567e3d2839f87ef82815f
|
7
|
+
data.tar.gz: c8eebfc8a7a45d4987f1d6ea5281a06c333a4eee929830a73a78521c442983b1743f14a4f677fb31de9d4a7ce6b144f67000f84cd7c068d08160ef260bb815cf
|
data/README.md
CHANGED
data/lib/hair_trigger.rb
CHANGED
@@ -226,7 +226,9 @@ end
|
|
226
226
|
end
|
227
227
|
end
|
228
228
|
|
229
|
-
|
230
|
-
ActiveRecord::
|
231
|
-
ActiveRecord::
|
232
|
-
ActiveRecord::
|
229
|
+
ActiveSupport.on_load(:active_record) do
|
230
|
+
ActiveRecord::Base.send :extend, HairTrigger::Base
|
231
|
+
ActiveRecord::Migration.send :include, HairTrigger::Migrator
|
232
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval { include HairTrigger::Adapter }
|
233
|
+
ActiveRecord::SchemaDumper.class_eval { include HairTrigger::SchemaDumper }
|
234
|
+
end
|
data/lib/hair_trigger/builder.rb
CHANGED
@@ -137,22 +137,22 @@ module HairTrigger
|
|
137
137
|
methods.each do |method|
|
138
138
|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
|
139
139
|
alias #{method}_orig #{method}
|
140
|
-
def #{method}(*args)
|
140
|
+
def #{method}(*args, &block)
|
141
141
|
@chained_calls << :#{method}
|
142
142
|
if @triggers || @trigger_group
|
143
143
|
@errors << ["mysql doesn't support #{method} within a trigger group", :mysql] unless [:name, :where, :all, :of].include?(:#{method})
|
144
144
|
end
|
145
|
-
set_#{method}(*args, &(block_given? ?
|
145
|
+
set_#{method}(*args, &(block_given? ? block : nil))
|
146
146
|
end
|
147
|
-
def set_#{method}(*args)
|
147
|
+
def set_#{method}(*args, &block)
|
148
148
|
if @triggers # i.e. each time we say t.something within a trigger group block
|
149
149
|
@chained_calls.pop # the subtrigger will get this, we don't need it
|
150
150
|
@chained_calls = @chained_calls.uniq
|
151
151
|
@triggers << trigger = clone
|
152
|
-
trigger.#{method}(*args, &(block_given? ?
|
152
|
+
trigger.#{method}(*args, &(block_given? ? block : nil))
|
153
153
|
else
|
154
|
-
#{method}_orig(*args)
|
155
|
-
maybe_execute(&
|
154
|
+
#{method}_orig(*args, &block)
|
155
|
+
maybe_execute(&block) if block_given?
|
156
156
|
self
|
157
157
|
end
|
158
158
|
end
|
@@ -67,7 +67,7 @@ module HairTrigger
|
|
67
67
|
def normalize_trigger(name, definition, type)
|
68
68
|
@adapter_name = @connection.adapter_name.downcase.to_sym
|
69
69
|
|
70
|
-
return definition unless @adapter_name == :postgresql
|
70
|
+
return definition unless @adapter_name == :postgresql || @adapter_name == :postgis
|
71
71
|
# because postgres does not preserve the original CREATE TRIGGER/
|
72
72
|
# FUNCTION statements, its decompiled reconstruction will not match
|
73
73
|
# ours. we work around it by creating our generated trigger/function,
|
data/lib/hair_trigger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hairtrigger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Jensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
102
|
+
rubygems_version: 2.5.2.3
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: easy database triggers for active record
|