mikras_utils 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d40acc7f4c2837481e47b7f46cc1dbcb79af1259fbafc8ad48284592da8f585e
|
4
|
+
data.tar.gz: 7d1a196b2b3a56394c7359877386eb4fd4cd7c5e54867754c2b8d94d9f51582a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4134754e87c32513569e8f2050da0fb0ce9518cb0ab17a105c84e48a55449a5de59389a0e5a711e6076fb6228f8d471dbe03b3ff1a1a665b63b242787737a7f8
|
7
|
+
data.tar.gz: f84cbcdf08dab513d0dcc8a129e122444ccf46b6e5018012ce8f944660b48d2346f80e4b8aa2f3e4c4f72d9210e8e5c55176de5cd2b17659a4b6e5aaa9087cb1
|
@@ -21,6 +21,7 @@ module MkAcl
|
|
21
21
|
private
|
22
22
|
def clean_tables
|
23
23
|
puts %(
|
24
|
+
delete from acl_portal.acl_timestamps;
|
24
25
|
delete from acl_portal.acl_rules;
|
25
26
|
delete from acl_portal.acl_actions;
|
26
27
|
delete from acl_portal.acl_tables;
|
@@ -68,8 +69,13 @@ module MkAcl
|
|
68
69
|
|
69
70
|
action.timestamps.each { |timestamp|
|
70
71
|
puts %(
|
71
|
-
insert into acl_portal.acl_timestamps (action_id, watch, stamp)
|
72
|
-
values (
|
72
|
+
insert into acl_portal.acl_timestamps (action_id, watch, assign, stamp)
|
73
|
+
values (
|
74
|
+
:action_id,
|
75
|
+
#{conn.quote_value(timestamp.watch)},
|
76
|
+
#{conn.quote_value(timestamp.assign)},
|
77
|
+
#{conn.quote_value(timestamp.stamp)}
|
78
|
+
);
|
73
79
|
).align
|
74
80
|
puts
|
75
81
|
}
|
@@ -88,14 +88,23 @@ module MkAcl
|
|
88
88
|
case timestamps
|
89
89
|
when String
|
90
90
|
timestamps.split.each { |watch_field|
|
91
|
-
|
91
|
+
case watch_field
|
92
|
+
when /^(.*)(?:_by_id|_to_id)$/
|
93
|
+
Timestamp.new(table, watch_field, nil, "#{$1}_at")
|
94
|
+
when /^(created|updated|deleted)_at$/
|
95
|
+
Timestamp.new(table, nil, "#{$1}_by_id", watch_field)
|
96
|
+
else
|
97
|
+
raise ArgumentError, "Illegal timestamp specifier: #{watch_field.inspect}"
|
98
|
+
end
|
92
99
|
}
|
100
|
+
|
93
101
|
when Array
|
94
102
|
for entry in timestamps
|
95
103
|
timestamp = Timestamp.new(table)
|
96
104
|
for key, value in entry
|
97
105
|
case key
|
98
106
|
when :watch; timestamp.watch = value
|
107
|
+
when :assign; timestamp.assign = value
|
99
108
|
when :stamp; timestamp.stamp = value
|
100
109
|
else
|
101
110
|
error "Illegal field '#{key}' in #{table} timestamps"
|
@@ -188,24 +188,16 @@ module MkAcl
|
|
188
188
|
attr_reader :action
|
189
189
|
forward_to :action, :table, :name
|
190
190
|
attr_accessor :watch
|
191
|
+
attr_accessor :assign
|
191
192
|
attr_accessor :stamp
|
192
193
|
|
193
|
-
|
194
|
-
|
195
|
-
|
194
|
+
# def created_at?() = watch == "insert"
|
195
|
+
# def updated_at?() = watch == "update"
|
196
|
+
# def deleted_at?() = watch == "delete"
|
196
197
|
|
197
|
-
def initialize(action, watch = nil, stamp = nil)
|
198
|
+
def initialize(action, watch = nil, assign = nil, stamp = nil)
|
198
199
|
@action = action
|
199
|
-
|
200
|
-
case watch
|
201
|
-
when /^(.*)(?:_by_id|_to_id)$/
|
202
|
-
@watch, @stamp = watch, stamp || "#{$1}_at"
|
203
|
-
when "created_at", "updated_at", "deleted_at"
|
204
|
-
@watch, @stamp = nil, watch
|
205
|
-
else
|
206
|
-
@watch, @stamp = watch, stamp
|
207
|
-
end
|
208
|
-
|
200
|
+
@watch, @assign, @stamp = watch, assign, stamp
|
209
201
|
action.send :attach_timestamp, self
|
210
202
|
end
|
211
203
|
|
@@ -213,6 +205,7 @@ module MkAcl
|
|
213
205
|
|
214
206
|
def dump
|
215
207
|
puts "watch: #{watch}"
|
208
|
+
puts "watch: #{assign}"
|
216
209
|
puts "stamp: #{stamp}"
|
217
210
|
end
|
218
211
|
end
|
data/lib/mikras_utils/version.rb
CHANGED