cpee-frames 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: f185881405a4d448a676a5aefbb6a5edd722fd430075b42cb1439c929d511125
4
- data.tar.gz: 93bf3f7767e6e5bd19f3a8d27bbf7769ab7954f512444ea726f00402db32b704
3
+ metadata.gz: d33782c18a633f94faa8add964f95d0f44912516775c14538e6d12bdbc486505
4
+ data.tar.gz: fc7719677b5caa0f0a74b9536102c5d65ee2482e62201d1f64c0191a249b71f3
5
5
  SHA512:
6
- metadata.gz: 9a863dcefcbb9d3090c7bee148d2c66d37323772c8ed40d7f0e269ab866c84f76b213c1cd7bdb6ec10f51a79b562cf9f60fca9e1c4d815b1cfbaa8b95b0ba04d
7
- data.tar.gz: 03ab2e9889d33eed886334e378c526801925e0eb641baf2eb3b8200c1529b395a2af6451b127db69d487fedbebeceab89cd33391411b41f3743cb4d825919588
6
+ metadata.gz: 4dda8dac7b5c65ff3d4a87681e843cfae72be0cbb5ae103727bdfa374a12dd6742fb1966ce4e70d457c16c4732e51abed31c7499a59c8adb778bcc92b556a410
7
+ data.tar.gz: 5d75b601db50a612e2b31d4200c7cefd4647c3eb0f864772b6585d94b5f71e7d122d320b0d0a7c709b31cc6bc77f4617aea17337108c47953a88ea6977e29375
data/cpee-frames.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-frames"
3
- s.version = "1.0.1"
3
+ s.version = "1.0.2"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "GPL-3.0"
6
6
  s.summary = "Dashboard management service with UI and backend for the cpee.org family of workflow management tools"
@@ -69,21 +69,22 @@ module CPEE
69
69
 
70
70
  class InitFrame < Riddl::Implementation #{{{
71
71
  def response
72
- Dir.mkdir(File.join('data',@r.last)) rescue nil
72
+ data_dir = @a[1]
73
+ Dir.mkdir(File.join(data_dir,@r.last)) rescue nil
73
74
 
74
75
  if !@p[0].value.to_s.empty?
75
- File.write(File.join('data',@r.last,'style.url'),@p[0].value)
76
+ File.write(File.join(data_dir,@r.last,'style.url'),@p[0].value)
76
77
  end
77
78
 
78
- File.write(File.join('data',@r.last,'frames.json'),JSON.dump(JSON.parse('{"data":[]}')))
79
+ File.write(File.join(data_dir,@r.last,'frames.json'),JSON.dump(JSON.parse('{"data":[]}')))
79
80
 
80
81
  #for handler
81
- File.write(File.join('data',@r.last,'dataelements.json'),JSON.dump(JSON.parse('{"data":[]}')))
82
+ File.write(File.join(data_dir,@r.last,'dataelements.json'),JSON.dump(JSON.parse('{"data":[]}')))
82
83
 
83
- File.write(File.join('data',@r.last,'info.json'),JSON.dump(JSON.parse('{"x_amount":' + @p[2].value + ', "y_amount":' + @p[3].value + ', "lang":"' + @p[4].value + '", "langs":["' + @p[4].value + '"], "document_name": "' + @p[5].value + '"}')))
84
+ File.write(File.join(data_dir,@r.last,'info.json'),JSON.dump(JSON.parse('{"x_amount":' + @p[2].value + ', "y_amount":' + @p[3].value + ', "lang":"' + @p[4].value + '", "langs":["' + @p[4].value + '"], "document_name": "' + @p[5].value + '"}')))
84
85
 
85
- File.write(File.join('data',@r.last,'callback'),@h['CPEE_CALLBACK'])
86
- File.write(File.join('data',@r.last,'cpeeinstance.url'),@h['CPEE_INSTANCE_URL'])
86
+ File.write(File.join(data_dir,@r.last,'callback'),@h['CPEE_CALLBACK'])
87
+ File.write(File.join(data_dir,@r.last,'cpeeinstance.url'),@h['CPEE_INSTANCE_URL'])
87
88
 
88
89
  @a[0].send('new')
89
90
  nil
@@ -92,7 +93,8 @@ module CPEE
92
93
 
93
94
  class NewFrameSet < Riddl::Implementation
94
95
  def response
95
- path = File.join('data',@r.last,'frames.json')
96
+ data_dir = @a[1]
97
+ path = File.join(data_dir,@r.last,'frames.json')
96
98
  file = File.read(path)
97
99
  data_hash = JSON::parse(file)
98
100
 
@@ -117,7 +119,7 @@ module CPEE
117
119
  File.write(path, JSON.dump(data_hash))
118
120
 
119
121
  #only send active url to client
120
- infofile = File.join('data',@r.last,'info.json')
122
+ infofile = File.join(data_dir,@r.last,'info.json')
121
123
  infojson = JSON::parse(File.read(infofile))
122
124
  hash["url"] = urls.find{ |h| h['lang'] == infojson["lang"]}['url']
123
125
 
@@ -137,7 +139,8 @@ module CPEE
137
139
 
138
140
  class NewFrameWait < Riddl::Implementation
139
141
  def response
140
- path = File.join('data',@r.last,'frames.json')
142
+ data_dir = @a[1]
143
+ path = File.join(data_dir,@r.last,'frames.json')
141
144
  file = File.read(path)
142
145
  data_hash = JSON::parse(file)
143
146
 
@@ -161,11 +164,11 @@ module CPEE
161
164
  File.write(path, JSON.dump(data_hash))
162
165
 
163
166
  #only send active url to client
164
- infofile = File.join('data',@r.last,'info.json')
167
+ infofile = File.join(data_dir,@r.last,'info.json')
165
168
  infojson = JSON::parse(File.read(infofile))
166
169
  hash["url"] = urls.find{ |h| h['lang'] == infojson["lang"]}['url']
167
170
 
168
- File.write(File.join('data',@r.last,'callback'),@h['CPEE_CALLBACK'])
171
+ File.write(File.join(data_dir,@r.last,'callback'),@h['CPEE_CALLBACK'])
169
172
 
170
173
 
171
174
  @a[0].send(JSON.dump(hash))
@@ -173,7 +176,7 @@ module CPEE
173
176
  File.write(path, JSON.dump(data_hash))
174
177
  hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: "empty", showbutton: @p[5].value, style: @p[6].value, default: "{}", callback: @h['CPEE_CALLBACK']};
175
178
 
176
- File.write(File.join('data',@r.last,'callback'),@h['CPEE_CALLBACK'])
179
+ File.write(File.join(data_dir,@r.last,'callback'),@h['CPEE_CALLBACK'])
177
180
 
178
181
 
179
182
  @a[0].send(JSON.dump(hash))
@@ -190,7 +193,8 @@ module CPEE
190
193
 
191
194
  class DeleteFrame < Riddl::Implementation
192
195
  def response
193
- path = File.join('data',@r.last,'frames.json')
196
+ data_dir = @a[1]
197
+ path = File.join(data_dir,@r.last,'frames.json')
194
198
  file = File.read(path)
195
199
  data_hash = JSON::parse(file)
196
200
 
@@ -216,8 +220,9 @@ module CPEE
216
220
 
217
221
  class Delete < Riddl::Implementation
218
222
  def response
223
+ data_dir = @a[1]
219
224
  pp "in delete"
220
- if cbu = File.read(File.join('data',@r.last,'callback'))
225
+ if cbu = File.read(File.join(data_dir,@r.last,'callback'))
221
226
  pp "XYZ"
222
227
  send = { 'operation' => @p[0].value }
223
228
  case send['operation']
@@ -229,11 +234,11 @@ module CPEE
229
234
  Typhoeus.put(cbu, body: JSON::generate(send), headers: { 'content-type' => 'application/json'})
230
235
  end
231
236
 
232
- #File.unlink(File.join('data',@r.last,'callback')) rescue nil
233
- #File.unlink(File.join('data',@r.last,'cpeeinstance.url')) rescue nil
234
- #File.unlink(File.join('data',@r.last,'style.url')) rescue nil
235
- #File.unlink(File.join('data',@r.last,'document.xml')) rescue nil
236
- #File.unlink(File.join('data',@r.last,'info.json')) rescue nil
237
+ #File.unlink(File.join(data_dir,@r.last,'callback')) rescue nil
238
+ #File.unlink(File.join(data_dir,@r.last,'cpeeinstance.url')) rescue nil
239
+ #File.unlink(File.join(data_dir,@r.last,'style.url')) rescue nil
240
+ #File.unlink(File.join(data_dir,@r.last,'document.xml')) rescue nil
241
+ #File.unlink(File.join(data_dir,@r.last,'info.json')) rescue nil
237
242
 
238
243
  @a[0].send('reset')
239
244
  nil
@@ -242,10 +247,11 @@ module CPEE
242
247
 
243
248
  class GetFrames < Riddl::Implementation #{{{
244
249
  def response
245
- fname = File.join('data',@r[-2],'frames.json')
250
+ data_dir = @a[0]
251
+ fname = File.join(data_dir,@r[-2],'frames.json')
246
252
  if File.exists? fname
247
253
 
248
- infofile = File.join('data',@r[-2],'info.json')
254
+ infofile = File.join(data_dir,@r[-2],'info.json')
249
255
  infojson = JSON::parse(File.read(infofile))
250
256
 
251
257
  #remove not used languages
@@ -264,8 +270,9 @@ module CPEE
264
270
 
265
271
  class SetDataElements < Riddl::Implementation #{{{
266
272
  def response
273
+ data_dir = @a[0]
267
274
  savejson = @p.map { |o| Hash[o.name, o.value] }.to_json
268
- path = File.join('data',@r[0],'dataelements.json')
275
+ path = File.join(data_dir,@r[0],'dataelements.json')
269
276
  File.write(path, savejson)
270
277
 
271
278
  #puts xyz
@@ -278,7 +285,7 @@ module CPEE
278
285
  #puts @p[0].name
279
286
  #puts @p[0].value
280
287
 
281
- #fname = File.join('data',@r[-2],'dataelements.json')
288
+ #fname = File.join(data_dir,@r[-2],'dataelements.json')
282
289
  #if File.exists? fname
283
290
  # Riddl::Parameter::Complex.new('value','application/json',File.read(fname))
284
291
  #else
@@ -289,7 +296,8 @@ module CPEE
289
296
 
290
297
  class GetDataElements < Riddl::Implementation #{{{
291
298
  def response
292
- fname = File.join('data',@r[-2],'dataelements.json')
299
+ data_dir = @a[0]
300
+ fname = File.join(data_dir,@r[-2],'dataelements.json')
293
301
  if File.exists? fname
294
302
  Riddl::Parameter::Complex.new('value','application/json',File.read(fname))
295
303
  else
@@ -300,7 +308,8 @@ module CPEE
300
308
 
301
309
  class GetInfo < Riddl::Implementation #{{{
302
310
  def response
303
- fname = File.join('data',@r[-2],'info.json')
311
+ data_dir = @a[0]
312
+ fname = File.join(data_dir,@r[-2],'info.json')
304
313
  if File.exists? fname
305
314
  Riddl::Parameter::Complex.new('value','application/json',File.read(fname))
306
315
  else
@@ -311,7 +320,8 @@ module CPEE
311
320
 
312
321
  class GetLangs < Riddl::Implementation #{{{
313
322
  def response
314
- fname = File.join('data',@r[-2],'info.json')
323
+ data_dir = @a[0]
324
+ fname = File.join(data_dir,@r[-2],'info.json')
315
325
  if File.exists? fname
316
326
  infojson = JSON::parse(File.read(fname))
317
327
  Riddl::Parameter::Complex.new('value','application/json',infojson["langs"])
@@ -323,7 +333,8 @@ module CPEE
323
333
 
324
334
  class SetLang < Riddl::Implementation #{{{
325
335
  def response
326
- fname = File.join('data',@r[-2],'info.json')
336
+ data_dir = @a[1]
337
+ fname = File.join(data_dir,@r[-2],'info.json')
327
338
  if File.exists? fname
328
339
  infojson = JSON::parse(File.read(fname))
329
340
  infojson["lang"] = @p[0].value
@@ -348,7 +359,8 @@ module CPEE
348
359
 
349
360
  class GetStyle < Riddl::Implementation #{{{
350
361
  def response
351
- fname = File.join('data',@r[-2],'style.url')
362
+ data_dir = @a[0]
363
+ fname = File.join(data_dir,@r[-2],'style.url')
352
364
  if File.exists? fname
353
365
  Riddl::Parameter::Complex.new('url','text/plain',File.read(fname).strip)
354
366
  else
@@ -359,7 +371,8 @@ module CPEE
359
371
 
360
372
  class GetCpeeInstance < Riddl::Implementation #{{{
361
373
  def response
362
- fname = File.join('data',@r[-2],'cpeeinstance.url')
374
+ data_dir = @a[0]
375
+ fname = File.join(data_dir,@r[-2],'cpeeinstance.url')
363
376
  if File.exists? fname
364
377
  Riddl::Parameter::Complex.new('url','text/plain',File.read(fname).strip)
365
378
  else
@@ -376,6 +389,7 @@ module CPEE
376
389
 
377
390
  class Handler < Riddl::Implementation
378
391
  def response
392
+ data_dir = @a[1]
379
393
  topic = @p[1].value
380
394
  event_name = @p[2].value
381
395
  notification = JSON.parse(@p[3].value.read)
@@ -394,7 +408,7 @@ module CPEE
394
408
  if content['values']&.any?
395
409
  #puts alldata['ausfuehrungen']
396
410
  puts "writing file"
397
- path = File.join('data',@r[0],'dataelements.json')
411
+ path = File.join(data_dir,@r[0],'dataelements.json')
398
412
  File.write(path, JSON.dump(content['values']))
399
413
  end
400
414
 
@@ -486,49 +500,49 @@ module CPEE
486
500
  opts[:signals2]["handler"] ||= Signaling.new
487
501
 
488
502
  run Get, "test" if get
489
- run InitFrame, opts[:signals][idx] if post 'input'
503
+ run InitFrame, opts[:signals][idx], opts[:data_dir] if post 'input'
490
504
 
491
- run NewFrameSet, opts[:signals][idx] if put 'sframe'
492
- run NewFrameWait, opts[:signals][idx] if put 'wframe'
505
+ run NewFrameSet, opts[:signals][idx], opts[:data_dir] if put 'sframe'
506
+ run NewFrameWait, opts[:signals][idx], opts[:data_dir] if put 'wframe'
493
507
 
494
- run DeleteFrame, opts[:signals][idx] if post 'deleteframe'
508
+ run DeleteFrame, opts[:signals][idx], opts[:data_dir] if post 'deleteframe'
495
509
 
496
510
  on resource 'handler' do
497
- run Handler, opts[:signals2]["handler"] if post
511
+ run Handler, opts[:signals2]["handler"], opts[:data_dir] if post
498
512
  on resource 'sse' do
499
513
  run SSE2, opts[:signals2]["handler"] if sse
500
514
  end
501
515
  end
502
516
 
503
- run Delete, opts[:signals][idx] if delete 'opa'
504
- run Delete, opts[:signals][idx] if delete 'opb'
505
- run Delete, opts[:signals][idx] if delete 'opc'
517
+ run Delete, opts[:signals][idx], opts[:data_dir] if delete 'opa'
518
+ run Delete, opts[:signals][idx], opts[:data_dir] if delete 'opb'
519
+ run Delete, opts[:signals][idx], opts[:data_dir] if delete 'opc'
506
520
  on resource 'sse' do
507
521
  run SSE, opts[:signals][idx] if sse
508
522
  end
509
523
  on resource 'languages' do
510
- run GetLangs if get
511
- run SetLang, opts[:signals][idx] if post 'lang'
524
+ run GetLangs, opts[:data_dir] if get
525
+ run SetLang, opts[:signals][idx], opts[:data_dir] if post 'lang'
512
526
  end
513
527
  on resource 'style.url' do
514
- run GetStyle if get
528
+ run GetStyle, opts[:data_dir] if get
515
529
  end
516
530
  on resource 'cpeeinstance.url' do
517
- run GetCpeeInstance if get
531
+ run GetCpeeInstance, opts[:data_dir] if get
518
532
  end
519
533
  on resource 'info.json' do
520
- run GetInfo if get
534
+ run GetInfo, opts[:data_dir] if get
521
535
  end
522
536
  on resource 'frames.json' do
523
- run GetFrames if get
537
+ run GetFrames, opts[:data_dir] if get
524
538
  end
525
539
  on resource 'test' do
526
540
  run OutputTest if put
527
541
  end
528
542
 
529
543
  on resource 'dataelements.json' do
530
- run SetDataElements if post
531
- run GetDataElements if get
544
+ run SetDataElements, opts[:data_dir] if post
545
+ run GetDataElements, opts[:data_dir] if get
532
546
  end
533
547
  end
534
548
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-frames
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuell Gall
8
8
  - Juergen 'eTM' Mangler
9
- autorequire:
9
+ autorequire:
10
10
  bindir: tools
11
11
  cert_chain: []
12
- date: 2023-02-21 00:00:00.000000000 Z
12
+ date: 2023-02-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: riddl
@@ -75,7 +75,7 @@ homepage: https://github.com/ManuelGall/cpee-frames
75
75
  licenses:
76
76
  - GPL-3.0
77
77
  metadata: {}
78
- post_install_message:
78
+ post_install_message:
79
79
  rdoc_options: []
80
80
  require_paths:
81
81
  - lib
@@ -90,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubygems_version: 3.1.2
94
- signing_key:
93
+ rubygems_version: 3.3.26
94
+ signing_key:
95
95
  specification_version: 4
96
96
  summary: Dashboard management service with UI and backend for the cpee.org family
97
97
  of workflow management tools