cpee-model-management 1.0.5 → 1.0.10

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: 2301d22c5a02dcace2fa736c3b41b88d02866c2cb2f3b68b2554e0766224486e
4
- data.tar.gz: d8f20b6c8c5c620dab0f582566a3445f6b48498cecd36ea7670096d80319166c
3
+ metadata.gz: 9be3465ba484376cc2be761b4d4af2882bfdb5b64d13cb4630e33919682054d4
4
+ data.tar.gz: e34f9311c42ff440cc4a8e00f082027b6810d17446e431e1f556e510455a39f1
5
5
  SHA512:
6
- metadata.gz: c8de486ecdffc9c0cf93a7ca043e0d1363210d679223528270f9aa02e97aa2106386bb9a0240237f0c115321ea58127e13d0c24e33e414695ee1896676e88fa7
7
- data.tar.gz: 711f92a0d044bd8bfc77cb56cd899df56343fd9fe80f9bc92170f4d86b0c5cced06edfd95f273879dbc59f59a27deaa7be4a25b5e572668621c062df7b9d82bd
6
+ metadata.gz: 907fff8cc59838e2c9272368ef4606d11324fcb5dcf9f9218e67c0c9a30f0ce462a920f56e9d5d5da19854eb73b7eec6670868672a1cca7c4022a49429776563
7
+ data.tar.gz: 9039e345f7f75f631d0485702db06aba021fa4412623793ca8a628c31efcee9841c732debb65943ef9d8b88b9f07bc97a8542119086b9a493900e53ec76728ec
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-model-management"
3
- s.version = "1.0.5"
3
+ s.version = "1.0.10"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "(Lifecycle) manage your process models in a directory or git repo."
7
7
 
8
8
  s.description = "see http://cpee.org"
9
9
 
10
- s.files = Dir['{server/**/*,tools/**/*,lib/**/*}'] + %w(LICENSE Rakefile cpee-model-management.gemspec README.md AUTHORS)
10
+ s.files = Dir['{server/*,tools/**/*,lib/**/*}'] + %w(LICENSE Rakefile cpee-model-management.gemspec README.md AUTHORS)
11
11
  s.require_path = 'lib'
12
12
  s.extra_rdoc_files = ['README.md']
13
13
  s.bindir = 'tools'
@@ -35,36 +35,39 @@ module CPEE
35
35
  Dir.chdir(File.join(models,File.dirname(old)))
36
36
  p1 = Pathname.new(File.dirname(old))
37
37
  p2 = Pathname.new(File.dirname(new))
38
- old = File.basename(old)
39
- new = File.join(p1.relative_path_from(p1).to_s,File.basename(new))
40
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{old}" "#{new}" 2>/dev/null`
41
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{old + '.active'}" 2>/dev/null`
42
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{old + '.active-uuid'}" 2>/dev/null`
43
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{old + '.author'}" "#{new + '.author'}" 2>/dev/null`
44
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{old + '.creator'}" "#{new + '.creator'}" 2>/dev/null`
45
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{old + '.stage'}" "#{new + '.stage'}" 2>/dev/null`
38
+ told = File.basename(old)
39
+ tnew = File.join(p1.relative_path_from(p1).to_s,File.basename(new))
40
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told}" "#{tnew}" 2>/dev/null`
41
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{told + '.active'}" 2>/dev/null`
42
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{told + '.active-uuid'}" 2>/dev/null`
43
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told + '.author'}" "#{tnew + '.author'}" 2>/dev/null`
44
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told + '.creator'}" "#{tnew + '.creator'}" 2>/dev/null`
45
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple mv "#{told + '.stage'}" "#{tnew + '.stage'}" 2>/dev/null`
46
46
  Dir.chdir(cdir)
47
+ CPEE::ModelManagement::fs_mv(models,old,new) # fallback
47
48
  end
48
49
  def self::git_rm(models,new)
49
50
  cdir = Dir.pwd
50
51
  Dir.chdir(File.join(models,File.dirname(new)))
51
- new = File.basename(new)
52
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{new}" 2>/dev/null`
53
- FileUtils.rm_rf(new)
54
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{new}.active" 2>/dev/null`
55
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{new}.active-uuid" 2>/dev/null`
56
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{new}.author" 2>/dev/null`
57
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{new}.creator" 2>/dev/null`
58
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{new}.stage" 2>/dev/null`
52
+ tnew = File.basename(new)
53
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}" 2>/dev/null`
54
+ FileUtils.rm_rf(tnew)
55
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.active" 2>/dev/null`
56
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.active-uuid" 2>/dev/null`
57
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.author" 2>/dev/null`
58
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.creator" 2>/dev/null`
59
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{tnew}.stage" 2>/dev/null`
59
60
  Dir.chdir(cdir)
61
+ CPEE::ModelManagement::fs_rm(models,new) # fallback
60
62
  end
61
63
  def self::git_shift(models,new)
62
64
  cdir = Dir.pwd
63
65
  Dir.chdir(File.join(models,File.dirname(new)))
64
- new = File.basename(new)
65
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{new}.active" 2>/dev/null`
66
- `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{new}.active-uuid" 2>/dev/null`
66
+ nnew = File.basename(new)
67
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{nnew}.active" 2>/dev/null`
68
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple rm -rf "#{nnew}.active-uuid" 2>/dev/null`
67
69
  Dir.chdir(cdir)
70
+ CPEE::ModelManagement::fs_shift(models,new) # fallback
68
71
  end
69
72
  def self::git_commit(models,new,author)
70
73
  rp = File.realpath(models)
@@ -74,7 +77,7 @@ module CPEE
74
77
  def self::fs_mv(models,old,new)
75
78
  fname = File.join(models,old)
76
79
  fnname = File.join(models,new)
77
- FileUtils.mv(fname,fnname)
80
+ FileUtils.mv(fname,fnname) rescue nil
78
81
  File.delete(fname + '.active',fnname + '.active') rescue nil
79
82
  File.delete(fname + '.active-uuid',fnname + '.active-uuid') rescue nil
80
83
  FileUtils.mv(fname + '.author',fnname + '.author') rescue nil
@@ -104,7 +107,6 @@ module CPEE
104
107
  fname = File.join(models,new)
105
108
  File.delete(fname + '.active') rescue nil
106
109
  File.delete(fname + '.active-uuid') rescue nil
107
- Dir.chdir(cdir)
108
110
  end
109
111
 
110
112
  def self::git_dir(models,file)
@@ -187,14 +189,15 @@ module CPEE
187
189
  where = @a[0] == :main ? '' : Riddl::Protocols::Utils::unescape(@r.last)
188
190
  views = @a[1]
189
191
  models = @a[2]
190
- stage = @p[0]&.value || 'draft'
191
- stage = views[stage] if views && views[stage]
192
+ stage = [@p[0]&.value] || ['draft']
193
+ stage << views[stage[0]] if views && views[stage[0]]
194
+
192
195
 
193
196
  names = Dir.glob(File.join(models,where,'*.dir')).map do |f|
194
197
  { :type => :dir, :name => File.basename(f), :creator => File.read(f + '.creator'), :date => File.mtime(f).xmlschema }
195
198
  end.compact.uniq.sort_by{ |e| e[:name] } + Dir.glob(File.join(models,where,'*.xml')).map do |f|
196
199
  fstage = File.read(f + '.stage').strip rescue 'draft'
197
- { :type => :file, :name => File.basename(f), :creator => File.read(f + '.creator'), :author => File.read(f + '.author'), :stage => fstage, :date => File.mtime(f).xmlschema } if fstage == stage
200
+ { :type => :file, :name => File.basename(f), :creator => File.read(f + '.creator'), :author => File.read(f + '.author'), :stage => fstage, :date => File.mtime(f).xmlschema } if stage.include?(fstage)
198
201
  end.compact.uniq.sort_by{ |e| e[:name] }
199
202
 
200
203
  Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(names))
@@ -204,14 +207,14 @@ module CPEE
204
207
  def response
205
208
  views = @a[0]
206
209
  models = @a[1]
207
- stage = @p[0]&.value || 'draft'
208
- stage = views[stage] if views && views[stage]
210
+ stage = [@p[0]&.value] || ['draft']
211
+ stage << views[stage[0]] if views && views[stage[0]]
209
212
 
210
213
  names = Dir.glob(File.join(models,'*.dir/*.xml')).map do |f|
211
214
  { :type => :file, :name => File.join(File.basename(File.dirname(f)),File.basename(f)), :creator => File.read(f + '.creator'), :date => File.mtime(f).xmlschema }
212
215
  end.compact.uniq.sort_by{ |e| e[:name] } + Dir.glob(File.join(models,'*.xml')).map do |f|
213
216
  fstage = File.read(f + '.stage').strip rescue 'draft'
214
- { :type => :file, :name => File.basename(f), :creator => File.read(f + '.creator'), :author => File.read(f + '.author'), :stage => fstage, :date => File.mtime(f).xmlschema } if fstage == stage
217
+ { :type => :file, :name => File.basename(f), :creator => File.read(f + '.creator'), :author => File.read(f + '.author'), :stage => fstage, :date => File.mtime(f).xmlschema } if stage.include?(fstage)
215
218
  end.compact.uniq.sort_by{ |e| e[:name] }
216
219
 
217
220
  Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(names))
data/server/model.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <testset xmlns="http://cpee.org/ns/properties/2.0">
2
2
  <dataelements/>
3
- <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
3
+ <executionhandler>ruby</executionhandler>
4
4
  <endpoints>
5
5
  <machine>machine</machine>
6
6
  <sensor>sensor</sensor>
data/server/testset.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <testset xmlns="http://cpee.org/ns/properties/2.0">
2
2
  <dataelements/>
3
- <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
3
+ <executionhandler>ruby</executionhandler>
4
4
  <endpoints>
5
5
  <timeout>https://cpee.org/services/timeout.php</timeout>
6
6
  <subprocess>https://cpee.org/flow/start/url/</subprocess>
data/tools/cpee-moma CHANGED
@@ -66,6 +66,19 @@ elsif command == 'convert'
66
66
  name = File.basename(f,'.xml')
67
67
  creator = author = design_dir = design_stage = nil
68
68
 
69
+ if doc.find('/x:testset/x:attributes').length == 0
70
+ n = doc.root.add('x:attributes')
71
+ end
72
+
73
+ if doc.find('/x:testset/x:attributes/x:theme').length == 0
74
+ n = doc.find('/x:testset/x:attributes').first
75
+ n.add('x:theme','extended')
76
+ end
77
+ if doc.find('/x:testset/x:attributes/x:info').length == 0
78
+ n = doc.find('/x:testset/x:attributes').first
79
+ n.add('x:info',name)
80
+ end
81
+
69
82
  if (dt = doc.find('/x:testset/x:attributes/x:creator')).length > 0
70
83
  dt.each do |e|
71
84
  creator = e.text
@@ -102,12 +115,14 @@ elsif command == 'convert'
102
115
  end
103
116
  File.write(f + '.stage',design_stage)
104
117
 
118
+ dd = ENV['PWD'] || Dir.pwd
119
+ ma = dd.scan(/\/([^\/]+\.dir)/)
120
+ design_dir = ma.join('/')
105
121
  if (dt = doc.find('/x:testset/x:attributes/x:design_dir')).length > 0
106
122
  dt.each do |e|
107
- design_dir = e.text
123
+ e.text = design_dir
108
124
  end
109
125
  else
110
- design_dir = Dir.pwd.sub(/^.*?models\/?/,'')
111
126
  doc.find('/x:testset/x:attributes').each do |e|
112
127
  e.add('x:design_dir',design_dir)
113
128
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-model-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  autorequire:
9
9
  bindir: tools
10
10
  cert_chain: []
11
- date: 2021-03-27 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riddl
@@ -56,12 +56,6 @@ files:
56
56
  - lib/cpee-model-management/moma.xml
57
57
  - lib/cpee-model-management/stages
58
58
  - server/model.xml
59
- - server/models/agar.xml
60
- - server/models/agar.xml.active
61
- - server/models/agar.xml.active-uuid
62
- - server/models/agar.xml.author
63
- - server/models/agar.xml.creator
64
- - server/models/agar.xml.stage
65
59
  - server/moma
66
60
  - server/moma.conf
67
61
  - server/testset.xml
@@ -1,25 +0,0 @@
1
- <testset xmlns="http://cpee.org/ns/properties/2.0">
2
- <dataelements/>
3
- <handlerwrapper>DefaultHandlerWrapper</handlerwrapper>
4
- <endpoints>
5
- <timeout>https://cpee.org/services/timeout.php</timeout>
6
- <subprocess>https://cpee.org/flow/start/url/</subprocess>
7
- </endpoints>
8
- <description>
9
- <description xmlns="http://cpee.org/ns/description/1.0"/>
10
- </description>
11
- <transformation>
12
- <description type="copy"/>
13
- <dataelements type="none"/>
14
- <endpoints type="none"/>
15
- </transformation>
16
- <attributes>
17
- <info>agar</info>
18
- <creator>Christine Ashcreek</creator>
19
- <author>Christine Ashcreek</author>
20
- <modeltype>CPEE</modeltype>
21
- <theme>extended</theme>
22
- <design_dir/>
23
- <design_stage>development</design_stage>
24
- </attributes>
25
- </testset>
@@ -1 +0,0 @@
1
- https://cpee.org/flow/engine/4842
@@ -1 +0,0 @@
1
- 6945f9e2-105a-4b14-84e6-3a4ca6921e93
@@ -1 +0,0 @@
1
- Christine Ashcreek
@@ -1 +0,0 @@
1
- Christine Ashcreek
@@ -1 +0,0 @@
1
- development