rbbt-util 5.26.21 → 5.26.22

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: a0ffa5b32ce869fb1371baa14d9d66cd30d37f829b8bc3dd55807afeddf188ee
4
- data.tar.gz: 95c3cd549d8719e6f3da4eb89d64fd9915666c84d76eebc123067f9272d4036b
3
+ metadata.gz: fe3389fbf9a1bdb98118ed58d3954a5a65cff4bcff685badd18ba552980e231b
4
+ data.tar.gz: 4b0e32c868b68bc3ebddca24502a70137881da4be77567dd89afffa8f1b79e58
5
5
  SHA512:
6
- metadata.gz: db46d5759962c088304b67cdf3f7b76282caaa343e4b1a14a32bae6c0c51277f7fedc25713792a07e6898252a2f05f62baf3cd6b08092ab14a6453834ecf08b9
7
- data.tar.gz: 21d0111d50df3e10d29f563ec657f22df9e0e9623cd00733f8f98749434f38b048ae65ca8f017db5eb770a44cb1c8a2d18ee624fd5cd3048b70a6baf2b4ec55b
6
+ metadata.gz: c62ad7ab3449ee7d9d468ea8d7256e67a38acacaf7316405d2209af2660e3ae3fce8758b3f1b66d5532335d7e18397ec6a418ef8a14091aafe565c96eb462bfb
7
+ data.tar.gz: d22c6a8965b81968d9e56d4debddc465e71bed0ecaf2d733aeec0136557ad73145736a58afaa21a0a0e354ec9fee93e5115b55e61bd8fa54e17e634250ddb451
@@ -17,3 +17,5 @@ end
17
17
  RbbtRESTHelpers.add_sass_load_path './www/views/compass'
18
18
 
19
19
  WorkflowRESTHelpers.workflow_resources.unshift(Path.setup($app_dir).www.views) if $app_dir
20
+
21
+
data/lib/rbbt/persist.rb CHANGED
@@ -124,6 +124,10 @@ module Persist
124
124
  content = stream.read.unpack("m").first
125
125
  Marshal.load(content)
126
126
  end
127
+ when :json
128
+ Open.open(path) do |stream|
129
+ JSON.parse(stream.read)
130
+ end
127
131
  when :yaml
128
132
  Open.open(path) do |stream|
129
133
  YAML.load(stream)
@@ -186,6 +190,8 @@ module Persist
186
190
  when :marshal
187
191
  dump = Marshal.dump(content)
188
192
  Misc.sensiblewrite(path, [dump].pack("m"), :lock => lockfile)
193
+ when :json
194
+ Misc.sensiblewrite(path, JSON.dump(content), :lock => lockfile)
189
195
  when :yaml
190
196
  Misc.sensiblewrite(path, YAML.dump(content), :lock => lockfile)
191
197
  when :float, :integer, :tsv
@@ -39,11 +39,50 @@ class Step
39
39
  end
40
40
 
41
41
  Misc.in_dir(tmpdir) do
42
- io = CMD.cmd("tar cvhzf '#{target}' ./*", :pipe => true)
43
- while line = io.gets
44
- Log.debug line
42
+ if File.directory?(target)
43
+ CMD.cmd_log("rsync -avzHP --copy-unsafe-links '#{ tmpdir }/' '#{ target }/'")
44
+ else
45
+ CMD.cmd_log("tar cvhzf '#{target}' ./*")
46
+ end
47
+ end
48
+ Log.debug "Archive finished at: #{target}"
49
+ end
50
+ end
51
+
52
+ def self.archive(files, target = nil)
53
+ target = self.path + '.tar.gz' if target.nil?
54
+ target = File.expand_path(target)
55
+
56
+ jobs = files.collect{|file| file = file.sub(/\.info$/,''); Step.new(File.expand_path(file))}.uniq
57
+ TmpFile.with_file do |tmpdir|
58
+ jobs.each do |step|
59
+ Step.link_job step.path, tmpdir
60
+ rec_dependencies = Set.new
61
+ deps = [step.path]
62
+ seen = Set.new
63
+ while deps.any?
64
+ path = deps.shift
65
+ dep = Step.new path
66
+ seen << dep.path
67
+ dep.info[:dependencies].each do |task, name, path|
68
+ dep = Step.new path
69
+ next if seen.include? dep.path
70
+ deps << dep.path
71
+ rec_dependencies << dep.path
72
+ end if dep.info[:dependencies]
73
+ end
74
+
75
+ rec_dependencies.each do |path|
76
+ Step.link_job path, tmpdir
77
+ end
78
+ end
79
+
80
+ Misc.in_dir(tmpdir) do
81
+ if File.directory?(target)
82
+ CMD.cmd_log("rsync -avzHP --copy-unsafe-links '#{ tmpdir }/' '#{ target }/'")
83
+ else
84
+ CMD.cmd_log("tar cvhzf '#{target}' ./*")
45
85
  end
46
- io.join if io.respond_to? :join
47
86
  end
48
87
  Log.debug "Archive finished at: #{target}"
49
88
  end
@@ -220,7 +220,7 @@ class Step
220
220
  begin
221
221
  dep.produce
222
222
  rescue RbbtException
223
- Log.warn "Allowing failing of #{dep.path}: #{dep.messages.last}"
223
+ Log.warn "Allowing failing of #{dep.path}: #{dep.messages.last if dep.messages}"
224
224
  end
225
225
  nil
226
226
  end
data/share/config.ru CHANGED
@@ -81,6 +81,15 @@ Entity.entity_property_cache = Rbbt.var.sinatra.app[app_name].find.entity_proper
81
81
 
82
82
  Sinatra::RbbtRESTMain.add_resource_path($app_dir.www.views.find, true)
83
83
 
84
+ require 'tilt/sass'
85
+ class Tilt::SassTemplate
86
+ private
87
+ def sass_options
88
+ options.merge(:filename => eval_file, :line => line, :syntax => :sass, :load_paths => RbbtRESTHelpers.sass_resources)
89
+ end
90
+ end
91
+
92
+
84
93
  $title = app_name
85
94
  require 'rack'
86
95
  use Rack::Deflater
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rbbt/workflow'
4
+
5
+ require 'rbbt-util'
6
+ require 'fileutils'
7
+ require 'rbbt/util/simpleopt'
8
+ require 'rbbt/workflow/step'
9
+ require 'rbbt/util/misc'
10
+
11
+ require 'rbbt-util'
12
+ require 'rbbt/util/simpleopt'
13
+
14
+ $0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
15
+
16
+ options = SOPT.setup <<EOF
17
+ Examine the provenance of a job result
18
+
19
+ $ rbbt workflow archive <target> <job> [<job> ...]
20
+
21
+ Archive jobs and all dependencies into the target tar gz file or directory. If no target is specified
22
+ it defaults to a <job>.tar.gz
23
+
24
+ -h--help Help
25
+ EOF
26
+
27
+ SOPT.usage if options[:help]
28
+
29
+ target, *files = ARGV
30
+
31
+ raise "Target already exists: #{ target }" if File.exists?(target) and not File.directory(target)
32
+ Step.archive(files, target)
@@ -142,6 +142,14 @@ app.get '/reload_workflow' do
142
142
  halt 200, "Workflow #{ workflow } reloaded"
143
143
  end
144
144
 
145
+ require 'tilt/sass'
146
+ class << Tilt::SassTemplate
147
+ private
148
+ def sass_options
149
+ options.merge(:filename => eval_file, :line => line, :syntax => :scss, :load_paths => RbbtRESTHelpers.sass_resources)
150
+ end
151
+ end
152
+
145
153
  #{{{ RUN
146
154
  require 'rack'
147
155
  use Rack::Deflater
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.26.21
4
+ version: 5.26.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-20 00:00:00.000000000 Z
11
+ date: 2019-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -398,6 +398,7 @@ files:
398
398
  - share/rbbt_commands/tsv/zip
399
399
  - share/rbbt_commands/watch
400
400
  - share/rbbt_commands/workflow/archive
401
+ - share/rbbt_commands/workflow/archive_all
401
402
  - share/rbbt_commands/workflow/cmd
402
403
  - share/rbbt_commands/workflow/example
403
404
  - share/rbbt_commands/workflow/info