spstrigger_execute 0.4.6 → 0.4.7

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
  SHA1:
3
- metadata.gz: e8ff58b7f36b70e8c1f169369a6cd8a8ef89a63d
4
- data.tar.gz: bc399399205429818912b5109db59ff53af1f950
3
+ metadata.gz: 54733c7cf3c98b166c5f9f95c063b3f1169c2261
4
+ data.tar.gz: f6fd39b7143d0a2061e88f1c51a0eb57064483be
5
5
  SHA512:
6
- metadata.gz: 9b6021e2e6d046e7bf00866de995f1b965702cfd1057e04d8580857d3adca1ac85dfc152a6d33228f860c0b6cf8ec9f0b68931b2ce3892e590ec6989aceb5bbe
7
- data.tar.gz: ce4e31aa1e4d49ce93fb7b0f948570bc44a56f8b9def5617b8a855ff908161f88cf3c4c9af1b0a871fcdf35fa3d1b2bed9fa5f0a1608d32f2d33b93ba56683d9
6
+ metadata.gz: ee4eb71de594b313107b3a651083520bbd16422228e6d1cd20f7380fd22e945ccd76f4ab4274e5407d238b62d2f6ddabe95a200eb9c52b65be089239d483f5f2
7
+ data.tar.gz: 5c7fd03fdd574fbd138ed9469f74062d041dfa85eab572f387888a10cff0496c0df787a1670f672b2057405d73a5e617b5f779e2e8ffe0e23047358dcf74b8b7
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- N%_l�'TS��� ��\�\�w���5��_�/G��Ǧ��I�A��/�!qw|�5 /�W�����KX�%�7<�#��� ]SxOI=:5�����\�x���*��X����[� �+��y����_�ڵEe�tY�W�Mx9�A��ߜ
1
+ ˌ��ë"����&Bb0c������M0����a�!�>���O��� �#�V��������1%���$KB������)x���B b��4h����d~��4X�
2
+ q�ϱ�G��9%�K�D�'Ӊ�@]����j4~7q���g�P-��?Ŀ�74�G�}�x��G��~x�o���L�
@@ -9,10 +9,11 @@ require 'xmlregistry_objects'
9
9
 
10
10
  class SPSTriggerExecute
11
11
 
12
- def initialize(x, reg=nil, polyrexdoc=nil, rws=nil, logfile: nil)
12
+ def initialize(x, reg=nil, polyrexdoc=nil, rws=nil, log: nil)
13
13
 
14
- @log = Logger.new logfile,'daily' if logfile
15
- @rws = rws
14
+ log.info 'SPSTriggerExecute/initialize: active' if log
15
+
16
+ @rws, @log = rws, log
16
17
 
17
18
  @patterns = if x.is_a? Dynarex then
18
19
 
@@ -23,24 +24,35 @@ class SPSTriggerExecute
23
24
  else
24
25
 
25
26
  buffer, _ = RXFHelper.read x
26
- dx = buffer[/^<\?dynarex /] ? Dynarex.new.import(buffer) : Dynarex.new(buffer)
27
+ dx = buffer[/^<\?dynarex /] ? Dynarex.new.import(buffer) : \
28
+ Dynarex.new(buffer)
27
29
  dx.to_h
28
30
 
29
31
  end
30
-
32
+
33
+
34
+
31
35
  if reg and polyrexdoc then
32
-
33
- xro = XMLRegistryObjects.new(reg, polyrexdoc)
36
+ log.info 'SPSTriggerExecute/initialize: before reg' if log
37
+ puts 'reg: ' + reg.inspect
38
+ xro = XMLRegistryObjects.new(reg, polyrexdoc, log: log)
39
+ log.info 'SPSTriggerExecute/initialize: after reg' if log
34
40
  @h = xro.to_h
35
41
  define_methods = @h.keys.map {|x| "def #{x}() @h[:#{x}] end"}
36
42
  instance_eval define_methods.join("\n")
37
- log 'define_methods : ' + self.public_methods.sort.inspect
43
+
44
+ if log then
45
+ log.info 'SPSTriggerExecute/initialize: define_methods : ' +
46
+ self.public_methods.sort.inspect
47
+ end
38
48
  end
39
49
 
40
50
  end
41
51
 
42
- def match_and_execute(topicx, message)
43
- results = find_match topicx, message
52
+ def match_and_execute(topic: nil, message: message)
53
+
54
+ @log.info 'SPSTriggerExecute/match_and_execute: active' if @log
55
+ results = find_match topic, message
44
56
  prepare_jobs(results)
45
57
  end
46
58
 
@@ -53,8 +65,9 @@ class SPSTriggerExecute
53
65
 
54
66
  private
55
67
 
56
- def find_match(topicx, message)
57
-
68
+ def find_match(topicx=nil, message)
69
+
70
+
58
71
  @patterns.map.with_index.inject([]) do |r, row|
59
72
 
60
73
  h, i = row
@@ -64,18 +77,19 @@ class SPSTriggerExecute
64
77
 
65
78
  index ||= i + 1
66
79
 
67
- # note: the index is only present if there is a duplicate Dynarex record default key
80
+ # note: the index is only present if there is a duplicate
81
+ # Dynarex record default key
68
82
 
69
83
  t, m = topic.length > 0, msg.length > 0
70
84
 
71
- result = if t && m then
85
+ result = if topicx && t && m then
72
86
 
73
87
  r1 = topicx.match(/#{topic}/)
74
88
  r2 = message.match(/#{msg}/)
75
89
 
76
90
  {topic: r1, msg: r2, index: index} if r1 && r2
77
91
 
78
- elsif t then
92
+ elsif topicx && t then
79
93
 
80
94
  r1 = topicx.match(/#{topic}/)
81
95
  {topic: r1, index: index} if r1
@@ -90,7 +104,10 @@ class SPSTriggerExecute
90
104
 
91
105
  if result and conditions.length > 0 then
92
106
 
93
- log 'conditions: ' + conditions.inspect
107
+ if @log then
108
+ @log.info 'SPSTriggerExecute/find_match: conditions: ' +
109
+ conditions.inspect
110
+ end
94
111
 
95
112
  named_match = message.match(/#{msg}/)
96
113
 
@@ -105,9 +122,14 @@ class SPSTriggerExecute
105
122
  else ''
106
123
  end
107
124
 
125
+
108
126
  success = eval (variable_assignment + conditions)
109
127
 
110
- log 'success : ' + success.inspect
128
+ if @log then
129
+ @log.info 'SPSTriggerExecute/find_match: success : ' +
130
+ success.inspect
131
+ end
132
+
111
133
  result = nil unless success
112
134
  end
113
135
 
@@ -116,30 +138,36 @@ class SPSTriggerExecute
116
138
  end
117
139
  end
118
140
 
119
- def log(s)
120
- if @log then
121
- @logger.debug s
122
- end
123
- end
124
141
 
125
142
  # not yet implemented
143
+ =begin
126
144
  def method_missing(method_name, *args)
127
- puts 'method_missing called'
145
+
128
146
  job = args.shift
129
147
  # Rsc object call goes here
148
+ @log.debug 'package: ' + package.inspect
130
149
  @rws.run_job package=method_name, job, {}, args
131
150
  end
151
+ =end
132
152
 
133
153
  def prepare_jobs(results)
154
+
155
+ @log.info 'SPSTriggerExecute/prepare_jobs: active' if @log
134
156
 
135
157
  results.inject([]) do |r,h|
158
+
159
+ if @log then
160
+ @log.info 'SPSTriggerExecute/prepare_jobs: inside inject h: ' +
161
+ h.inspect
162
+ end
136
163
 
137
164
  a = []
138
165
  a += h[:topic].captures if h[:topic] && h[:topic].captures.any?
139
166
  a += h[:msg].captures if h[:msg]
140
167
 
141
168
  jobs = @patterns[h[:index].to_i - 1][:job]
142
-
169
+
170
+
143
171
  jobs.split(/\s*;\s*/).each do |job|
144
172
 
145
173
  job_args = job.split + a
@@ -173,7 +201,9 @@ class SPSTriggerExecute
173
201
 
174
202
  end
175
203
  end
176
-
204
+
205
+ @log.info 'SPSTriggerExecute/prepare_jobs: result: ' if @log
206
+
177
207
  r
178
208
 
179
209
  end
@@ -190,4 +220,4 @@ class SPSTriggerExecute
190
220
  t
191
221
  end
192
222
 
193
- end
223
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spstrigger_execute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -12,26 +12,26 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
14
  YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE1MDMwNTIxMDc0NVoXDTE2MDMwNDIxMDc0NVowSDESMBAG
15
+ 8ixkARkWAmV1MB4XDTE3MTAyOTEwMjIwM1oXDTE4MTAyOTEwMjIwM1owSDESMBAG
16
16
  A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
17
  Ej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CYGA1UdEgQfMB2BG2dlbW1h
26
- c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEADBNEPtB4
27
- Inogq8wKBtu3KBbKrE/yvnbk7hsRE11mlRiQOiKZDqsw8/Y9D/yRSH4dY3Gq3xQY
28
- W2XxMR0okW/bPfSq3IU/gjukc6yqI7A3rU4F7+idbHIhiHLhtS6oaaCFCwIWT8nU
29
- YpibuWDr8aRAOfhsU0kLOJbJgSetnWBqOaxGXD17OtmQUkK9iMTbdxRotRXauHWb
30
- flYpNYm4CG+D4ZdG69glQaJLQ/qBbtLVwwnrsmVyEeWMIKCws0ttVzM1PO54I83p
31
- rlSMrvljzPJPts27UIPIfU02mkTZzELneWPUEQlIK/ADjdiGu2uxlWT5g77gwM+g
32
- fYtWdC+NEqa0rg==
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEANq0T/0Wo
27
+ vWGM1aDHmvxq0bmOn7BBtXCODQY410+OWlne1smLJfEKhW9lcyPW7KW5WiSt+HRD
28
+ mtL30aH2fOBx26IvnjIQeZgQrDZEicM58ZWtWU1EqUHNc7z/+YFXk693iDp2cCt4
29
+ tCKOGXHyYQfEdfa7B5jhUthtWyMQnvIX2k3gTEB1keesGCvKxFDdh6pSBXpgge2T
30
+ FBo7GZfN5O1E1SqOqPCgwGBZwF9C46Iu2HXroM9vxhNgT2N893mWYlNmmDxB6VFD
31
+ Fb4PX9Gy1KygSUYIf5FBCAghq1QMa/KLXbYAar3QWRmU/0Uke/W3lSJt9OuQNJlF
32
+ na7EIuI+Z46Jhw==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-10-07 00:00:00.000000000 Z
34
+ date: 2017-10-29 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
@@ -39,20 +39,20 @@ dependencies:
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.5'
42
+ version: '1.7'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.5.12
45
+ version: 1.7.26
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '1.5'
52
+ version: '1.7'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.5.12
55
+ version: 1.7.26
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: chronic_between
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -62,7 +62,7 @@ dependencies:
62
62
  version: '0.3'
63
63
  - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: 0.3.0
65
+ version: 0.3.1
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
@@ -72,29 +72,29 @@ dependencies:
72
72
  version: '0.3'
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.3.0
75
+ version: 0.3.1
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: xmlregistry_objects
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.5'
82
+ version: '0.7'
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- version: 0.5.1
85
+ version: 0.7.4
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: '0.5'
92
+ version: '0.7'
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 0.5.1
95
+ version: 0.7.4
96
96
  description:
97
- email: james@r0bertson.co.uk
97
+ email: james@jamesrobertson.eu
98
98
  executables: []
99
99
  extensions: []
100
100
  extra_rdoc_files: []
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.4.8
123
+ rubygems_version: 2.6.13
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: An SPS client built for reponding to messages which match keywords and conditions.
metadata.gz.sig CHANGED
Binary file