cpee-model-management 1.0.4 → 1.0.9

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: 504bfe76b398c792c308759dca4d15f4ff0f52bf2186649c624509d02747a8e7
4
- data.tar.gz: 42be25ce8177501439234d6c005a5ef7bc316fb367aca7d19e81c3beadfc2493
3
+ metadata.gz: ff58402244bdf7eadbd79cebb7c4ef42f302b45354da3bc1634bd866ba273eec
4
+ data.tar.gz: 3dc2729da1856011a97a42c487117fe2cc7f4e6587e6e54934559bccc68b7148
5
5
  SHA512:
6
- metadata.gz: 8bd35e768b95189b892e53dcecd2b1ec5d379d63f64e7e3b92e0964d5f3eb8cb4f5594d2c0030afa65b7983abf22f348484c9240347b346a4ddc90000a228390
7
- data.tar.gz: 74dc53bb8bba14ec0be5c7836dd72f91caac5961c0b9f3dd5e6c6be6eba7261c97a73435027b3bdc43880892ff0093c3c57556dc2b56167107f60d417552fad1
6
+ metadata.gz: 130154f25420d1901fa5dd8e83f15e2eecb6609660d7fd2e30f43e202b7a1a25fbc02e408bcf0575e5d4de6dffad5cdd2561926a4824a6127b9a72c2854e0267
7
+ data.tar.gz: 6be4a1c311486e3364ce6e96192ca4b654e625ae102204150b34989384ba617abe5b7ba77c40b9f59233f61dfa7185c3d88917dd685629cbd1355c2b87bc62b3
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-model-management"
3
- s.version = "1.0.4"
3
+ s.version = "1.0.9"
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'
@@ -4,11 +4,11 @@ author = ARGV[2]
4
4
 
5
5
  Dir.chdir(File.join(models,File.dirname(new)))
6
6
  new = File.basename(new)
7
- `git add "#{new}" 2>/dev/null`
8
- `git add "#{new}.active" 2>/dev/null`
9
- `git add "#{new}.active-uuid" 2>/dev/null`
10
- `git add "#{new}.author" 2>/dev/null`
11
- `git add "#{new}.creator" 2>/dev/null`
12
- `git add "#{new}.stage" 2>/dev/null`
13
- `git commit -m "#{author.gsub(/"/,"'")}"`
14
- `git push` rescue nil
7
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}" 2>/dev/null`
8
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.active" 2>/dev/null`
9
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.active-uuid" 2>/dev/null`
10
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.author" 2>/dev/null`
11
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.creator" 2>/dev/null`
12
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple add "#{new}.stage" 2>/dev/null`
13
+ `git -c user.name='Christine Ashcreek' -c user.email=dev@null.com -c push.default=simple commit -m "#{author.gsub(/"/,"'")}"`
14
+ `GIT_TERMINAL_PROMPT=0 git push` rescue nil
@@ -23,6 +23,7 @@ require 'riddl/client'
23
23
  require 'riddl/protocols/utils'
24
24
  require 'fileutils'
25
25
  require 'pathname'
26
+ require 'shellwords'
26
27
 
27
28
  module CPEE
28
29
  module ModelManagement
@@ -34,46 +35,49 @@ module CPEE
34
35
  Dir.chdir(File.join(models,File.dirname(old)))
35
36
  p1 = Pathname.new(File.dirname(old))
36
37
  p2 = Pathname.new(File.dirname(new))
37
- old = File.basename(old)
38
- new = File.join(p1.relative_path_from(p1).to_s,File.basename(new))
39
- `git mv "#{old}" "#{new}" 2>/dev/null`
40
- `git rm -rf "#{old + '.active'}" 2>/dev/null`
41
- `git rm -rf "#{old + '.active-uuid'}" 2>/dev/null`
42
- `git mv "#{old + '.author'}" "#{new + '.author'}" 2>/dev/null`
43
- `git mv "#{old + '.creator'}" "#{new + '.creator'}" 2>/dev/null`
44
- `git 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`
45
46
  Dir.chdir(cdir)
47
+ CPEE::ModelManagement::fs_mv(models,old,new) # fallback
46
48
  end
47
49
  def self::git_rm(models,new)
48
50
  cdir = Dir.pwd
49
51
  Dir.chdir(File.join(models,File.dirname(new)))
50
- new = File.basename(new)
51
- `git rm -rf "#{new}" 2>/dev/null`
52
- FileUtils.rm_rf(new)
53
- `git rm -rf "#{new}.active" 2>/dev/null`
54
- `git rm -rf "#{new}.active-uuid" 2>/dev/null`
55
- `git rm -rf "#{new}.author" 2>/dev/null`
56
- `git rm -rf "#{new}.creator" 2>/dev/null`
57
- `git 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`
58
60
  Dir.chdir(cdir)
61
+ CPEE::ModelManagement::fs_rm(models,new) # fallback
59
62
  end
60
63
  def self::git_shift(models,new)
61
64
  cdir = Dir.pwd
62
65
  Dir.chdir(File.join(models,File.dirname(new)))
63
- new = File.basename(new)
64
- `git rm -rf "#{new}.active" 2>/dev/null`
65
- `git 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`
66
69
  Dir.chdir(cdir)
70
+ CPEE::ModelManagement::fs_shift(models,new) # fallback
67
71
  end
68
72
  def self::git_commit(models,new,author)
69
- Process.fork do
70
- exec 'ruby', File.join(__dir__,'commit.rb'), File.realpath(models), new, author
71
- end
73
+ rp = File.realpath(models)
74
+ crb = File.join(__dir__,'commit.rb')
75
+ system 'ruby ' + crb + ' ' + [rp, new, author].shelljoin + ' &'
72
76
  end
73
77
  def self::fs_mv(models,old,new)
74
78
  fname = File.join(models,old)
75
79
  fnname = File.join(models,new)
76
- FileUtils.mv(fname,fnname)
80
+ FileUtils.mv(fname,fnname) rescue nil
77
81
  File.delete(fname + '.active',fnname + '.active') rescue nil
78
82
  File.delete(fname + '.active-uuid',fnname + '.active-uuid') rescue nil
79
83
  FileUtils.mv(fname + '.author',fnname + '.author') rescue nil
@@ -103,7 +107,6 @@ module CPEE
103
107
  fname = File.join(models,new)
104
108
  File.delete(fname + '.active') rescue nil
105
109
  File.delete(fname + '.active-uuid') rescue nil
106
- Dir.chdir(cdir)
107
110
  end
108
111
 
109
112
  def self::git_dir(models,file)
@@ -186,14 +189,15 @@ module CPEE
186
189
  where = @a[0] == :main ? '' : Riddl::Protocols::Utils::unescape(@r.last)
187
190
  views = @a[1]
188
191
  models = @a[2]
189
- stage = @p[0]&.value || 'draft'
190
- stage = views[stage] if views && views[stage]
192
+ stage = [@p[0]&.value] || ['draft']
193
+ stage << views[stage[0]] if views && views[stage[0]]
194
+
191
195
 
192
196
  names = Dir.glob(File.join(models,where,'*.dir')).map do |f|
193
197
  { :type => :dir, :name => File.basename(f), :creator => File.read(f + '.creator'), :date => File.mtime(f).xmlschema }
194
198
  end.compact.uniq.sort_by{ |e| e[:name] } + Dir.glob(File.join(models,where,'*.xml')).map do |f|
195
199
  fstage = File.read(f + '.stage').strip rescue 'draft'
196
- { :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)
197
201
  end.compact.uniq.sort_by{ |e| e[:name] }
198
202
 
199
203
  Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(names))
@@ -203,14 +207,14 @@ module CPEE
203
207
  def response
204
208
  views = @a[0]
205
209
  models = @a[1]
206
- stage = @p[0]&.value || 'draft'
207
- stage = views[stage] if views && views[stage]
210
+ stage = [@p[0]&.value] || ['draft']
211
+ stage << views[stage[0]] if views && views[stage[0]]
208
212
 
209
213
  names = Dir.glob(File.join(models,'*.dir/*.xml')).map do |f|
210
214
  { :type => :file, :name => File.join(File.basename(File.dirname(f)),File.basename(f)), :creator => File.read(f + '.creator'), :date => File.mtime(f).xmlschema }
211
215
  end.compact.uniq.sort_by{ |e| e[:name] } + Dir.glob(File.join(models,'*.xml')).map do |f|
212
216
  fstage = File.read(f + '.stage').strip rescue 'draft'
213
- { :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)
214
218
  end.compact.uniq.sort_by{ |e| e[:name] }
215
219
 
216
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>
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.4
4
+ version: 1.0.9
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