rbbt-rest 1.8.157 → 1.9.0

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: 2e4b22bac9c83a30a558edc6a2da6b3472fb4b4fd4e6a656129d80411e2d9e52
4
- data.tar.gz: a2a5802a8dab099897fa5cca2f97c208702509bc72200af6a04113f4f49f1e1e
3
+ metadata.gz: 1fdb32cbeb46c68fc69547ead44db23a8a7c429104b5a00ab64b0551cad3018e
4
+ data.tar.gz: ff6ec603aa45072af8aa5cf99203bac5c63590f657b6f96d38cb172beee4ee09
5
5
  SHA512:
6
- metadata.gz: f389432ce901f5a7b1c7f41a03b84fe89d32c03db44afbfbb8585aa496a96d7651a627e8db90aff39d4411789ed1bcc51ac7ce166d497204b2823e0c00c35eb0
7
- data.tar.gz: b7af3754e961b7965fefbcca749dc68f40d02fa2bf498484664591e41f280dc53a9d3ef3e0c95b985e0da844d2d024862e7deb0fbcc4262750b0fec3c525f28b
6
+ metadata.gz: cdc8bbe6d4548759e88e4cf034d6ec757311f3b0c5efb6c8ad656866cd146c5e9d91e83508759a1966bc4a73d588171e7067b7b4f26a0bffc6ba549d1be9c08d
7
+ data.tar.gz: f2d21a95f95a61838596be12cd95a58ef3f979015be6c53b7137758f47616a4732cbc8b0eae75b9d354c20209f7244be8ad9dd3d31b3a49fb215dd3cfaf1d79c
@@ -20,10 +20,10 @@ module RbbtRESTHelpers
20
20
  def old_cache(path, check)
21
21
  return false if production?
22
22
  return false if check.nil? or check.empty?
23
- return false if not File.exists? path
23
+ return false if not File.exist? path
24
24
  check = [check] unless Array === check
25
25
  check.each do |file|
26
- if not File.exists?(file)
26
+ if not File.exist?(file)
27
27
  return true
28
28
  end
29
29
  if File.mtime(file) > File.mtime(path)
@@ -270,7 +270,7 @@ data = NULL
270
270
  if mime && mime.to_s.include?("text/html")
271
271
  halt_html txt || Open.read(fragment_file)
272
272
  else
273
- if File.exists?(fragment_file)
273
+ if File.exist?(fragment_file)
274
274
  send_file fragment_file
275
275
  else
276
276
  halt 200, Open.read(fragment_file)
@@ -325,7 +325,7 @@ data = NULL
325
325
  raise RbbtRESTHelpers::Retry
326
326
  end
327
327
 
328
- #if File.exists?(step.info_file) and Time.now - File.atime(step.info_file) > 60
328
+ #if File.exist?(step.info_file) and Time.now - File.atime(step.info_file) > 60
329
329
  # Log.debug{ "Checking on #{step.info_file}" }
330
330
  # running = (not step.done?) and step.running?
331
331
  # if FalseClass === running
@@ -5,7 +5,7 @@ module RbbtRESTHelpers
5
5
  class Retry < Exception; end
6
6
 
7
7
  def check_step(step)
8
- if File.exists?(step.info_file) and Time.now - File.atime(step.info_file) > 60
8
+ if File.exist?(step.info_file) and Time.now - File.atime(step.info_file) > 60
9
9
  done = step.done?
10
10
  running = done ? false : step.running?
11
11
  Log.debug{ "Checking on #{step.info_file} (done: #{done}; running: #{running})" }
@@ -301,7 +301,7 @@ module RbbtRESTHelpers
301
301
  def permalink(path)
302
302
  id = Misc.digest(Time.now.to_s)
303
303
  dest = File.join(settings.permalink_dir, id)
304
- FileUtils.mkdir_p settings.permalink_dir unless File.exists? settings.permalink_dir
304
+ FileUtils.mkdir_p settings.permalink_dir unless File.exist? settings.permalink_dir
305
305
  FileUtils.ln_s(path, dest)
306
306
  "/permalink/#{ id }"
307
307
  end
@@ -322,36 +322,81 @@ module RbbtRESTHelpers
322
322
 
323
323
  end
324
324
 
325
- class Haml::Filters::DeferJS < Haml::Filters::Base
325
+ if $haml_6
326
+ Haml::Template.options[:escape_html] = false
326
327
 
327
- def render(text)
328
- step_path = Thread.current["step_path"]
329
- text = "" if text.nil?
330
- defer_text =<<-EOF
328
+ class Haml::Filters::DeferJS < Haml::Filters::TiltBase
329
+
330
+ def compile(node)
331
+ text = node.value[:text]
332
+ step_path = Thread.current["step_path"]
333
+ text = "" if text.nil?
334
+ defer_text =<<-EOF
331
335
  %script
332
336
  :plain
333
337
  defer(function(step_path){
334
338
 
335
339
  #{text.gsub(/^/," ")}
336
340
  }, '#{step_path}')
337
- EOF
338
- Haml::Engine.new(defer_text).to_html
341
+ EOF
342
+ node.value[:text] = defer_text
343
+ compile_with_tilt(node, 'haml')
344
+ end
339
345
  end
340
- end
341
346
 
342
- class Haml::Filters::Documentation < Haml::Filters::Base
347
+ class Haml::Filters::Documentation < Haml::Filters::TiltBase
343
348
 
344
- def render(text)
345
- text = "<br/>" if text.strip.empty?
349
+ def compile(node)
350
+ text = node.value[:text]
351
+ text = "<br/>" if text.strip.empty?
346
352
 
347
- doc_text =<<-EOF
353
+ doc_text =<<-EOF
348
354
  %section.documentation#{ text.gsub(/\s/,'').length < 80 * 10 ? '.short' : ''}
349
355
  :markdown
350
356
  #{text.gsub(/^/," ")}
351
- EOF
357
+ EOF
352
358
 
353
- Haml::Engine.new(doc_text).to_html
359
+ node.value[:text] = doc_text
360
+ compile_with_tilt(node, 'haml')
361
+ end
354
362
  end
355
363
 
356
- end
364
+ class Haml::Filters
365
+ register :deferjs, Haml::Filters::DeferJS
366
+ register :documentation, Haml::Filters::Documentation
367
+ end
368
+ else
369
+ module Haml::Filters::DeferJS
370
+ include Haml::Filters::Base
371
+
372
+ def render(text)
373
+ step_path = Thread.current["step_path"]
374
+ text = "" if text.nil?
375
+ defer_text =<<-EOF
376
+ %script
377
+ :plain
378
+ defer(function(step_path){
379
+ #{text.gsub(/^/," ")}
380
+ }, '#{step_path}')
381
+ EOF
382
+ Haml::Engine.new(defer_text).to_html
383
+ end
384
+ end
385
+
386
+ module Haml::Filters::Documentation
387
+ include Haml::Filters::Base
388
+
389
+ def render(text)
390
+ text = "<br/>" if text.strip.empty?
357
391
 
392
+ doc_text =<<-EOF
393
+ %section.documentation#{ text.gsub(/\s/,'').length < 80 * 10 ? '.short' : ''}
394
+ :markdown
395
+ #{text.gsub(/^/," ")}
396
+ EOF
397
+
398
+ Haml::Engine.new(doc_text).to_html
399
+ end
400
+
401
+ end
402
+ end
@@ -3,7 +3,6 @@ require 'rbbt/rest/common/cache'
3
3
  require 'tilt'
4
4
 
5
5
  Tilt::SYMBOL_ARRAY_SORTABLE = false
6
-
7
6
  module RbbtRESTHelpers
8
7
  def error_for(job, layout = nil)
9
8
  if ex = job.info[:exception]
@@ -153,7 +152,8 @@ module RbbtRESTHelpers
153
152
  end
154
153
  end
155
154
  Log.low("Fragment started: #{ fragment_file } - #{Process.pid}")
156
- res = capture_haml fragment_code, &block
155
+ #res = capture_haml fragment_code, &block
156
+ res = $haml_6 ? capture(&block) : capture_haml(&block)
157
157
  Log.low("Fragment writing: #{ fragment_file } - #{Process.pid}")
158
158
  Open.write(fragment_file, res)
159
159
  Log.low("Fragment done: #{ fragment_file } - #{Process.pid}")
@@ -196,7 +196,7 @@ module RbbtRESTHelpers
196
196
  end
197
197
  end
198
198
  else
199
- capture_haml &block
199
+ $haml_6 ? capture(&block) : capture_haml(&block)
200
200
  end
201
201
  else
202
202
  if link =~ / class=/
@@ -294,7 +294,8 @@ module RbbtRESTHelpers
294
294
  def reveal(text, id = nil, options = nil, &block)
295
295
  id ||= "rbbt_reveal_" << (rand * 10000).to_i.to_s
296
296
 
297
- content_html = capture_haml(&block)
297
+ #content_html = capture_haml(&block)
298
+ content_html = $haml_6 ? capture(&block) : capture_haml(&block)
298
299
 
299
300
  options = {} if options.nil?
300
301
  options = {:href => "#", "data-reveal-id" => 'modal1', 'attr-reveal_id' => id}.merge(options)
@@ -40,7 +40,7 @@ module RbbtRESTHelpers
40
40
  md5 = Misc.digest(recorded_js_files * ",")
41
41
  filename = settings.file_dir["all_js-#{md5}.js"].find
42
42
 
43
- if not File.exists?(filename)
43
+ if not File.exist?(filename)
44
44
  Log.debug{ "Regenerating JS Compressed file: #{ filename }" }
45
45
 
46
46
  text = recorded_js_files.collect{|file|
@@ -53,7 +53,7 @@ module RbbtRESTHelpers
53
53
  "//FILE: #{ File.basename(path) }\n" + Open.read(path)
54
54
  } * "\n"
55
55
 
56
- FileUtils.mkdir_p File.dirname(filename) unless File.exists? File.dirname(filename)
56
+ FileUtils.mkdir_p File.dirname(filename) unless File.exist? File.dirname(filename)
57
57
  Open.write(filename, Uglifier.compile(text))
58
58
  end
59
59
 
@@ -146,6 +146,32 @@ Quality
146
146
  end
147
147
 
148
148
  module RbbtRESTHelpers
149
+
150
+ def capture(*args, &block)
151
+
152
+ variables = block.binding.local_variables
153
+ #variables.each do |v|
154
+ # iif [v, block.binding.local_variable_get(v)]
155
+ #end
156
+ buff_var = variables.select{|v| v.to_s =~ /^_module\d+$/}.sort_by{|v| v.to_s.scan(/\d+/).first.to_i}.last
157
+ buff_was = block.binding.local_variable_get(buff_var) if variables.include? buff_var
158
+ block.binding.local_variable_set(buff_var,'') if buff_var
159
+ begin
160
+ raw = block.call(*args)
161
+ #variables = block.binding.local_variables
162
+ #iii variables
163
+ #variables.each do |v|
164
+ # iif [v, block.binding.local_variable_get(v)]
165
+ #end
166
+ captured = block.binding.local_variable_get(buff_var) if block.binding.local_variables.include?(buff_var)
167
+ captured = "" if captured.nil?
168
+ captured = raw if captured.empty?
169
+ captured
170
+ ensure
171
+ block.binding.local_variable_set(buff_var, buff_was) if buff_was
172
+ end
173
+ end
174
+
149
175
  def tsv_rows_full(tsv)
150
176
  case tsv.type
151
177
  when :single
@@ -390,7 +416,7 @@ module RbbtRESTHelpers
390
416
  tsv = TSV.open(Open.open(file))
391
417
  end
392
418
 
393
- table_options = File.exists?(file + '.table_options') ? YAML.load_file(file + '.table_options') : {}
419
+ table_options = File.exist?(file + '.table_options') ? YAML.load_file(file + '.table_options') : {}
394
420
  tsv.entity_options = table_options[:tsv_entity_options]
395
421
  headers = table_options[:headers]
396
422
  headers.each{|field,p| tsv.entity_templates[field] = Misc.prepare_entity("TEMPLATE", p.first, (tsv.entity_options || {}).merge(p.last)) } unless headers.nil?
@@ -402,10 +428,12 @@ module RbbtRESTHelpers
402
428
  RbbtRESTHelpers.load_tsv(*args)
403
429
  end
404
430
 
405
- def table(options = {})
431
+ def table(options = {},&block)
406
432
  options = {} if options.nil?
407
433
 
408
- tsv = yield
434
+ tsv = $haml_6 ? capture(&block) : block.call
435
+
436
+ raise "Use next to return the table" if String === tsv
409
437
 
410
438
  table_code = options[:table_id] || (rand * 100000).to_i.to_s
411
439
  table_code = Entity::REST.clean_element(table_code)
@@ -1,6 +1,7 @@
1
-
2
1
  module RbbtRESTHelpers
3
2
  class Tabs
3
+ include RbbtRESTHelpers
4
+
4
5
  attr_accessor :headers, :codes, :content, :classes, :tab_classes
5
6
  def initialize(page)
6
7
  @page = page
@@ -13,7 +14,7 @@ module RbbtRESTHelpers
13
14
  @content ||= {}
14
15
 
15
16
  if block_given?
16
- html = @page.capture_haml &block
17
+ html = $haml_6 ? capture(&block) : @page.capture_haml(&block)
17
18
  else
18
19
  html = nil
19
20
  end
@@ -57,10 +57,10 @@ module Entity
57
57
 
58
58
  def self.load_list(entity_type, id, user = nil)
59
59
  path = list_file(entity_type, id, user)
60
- path = list_file(entity_type, id, :public) unless path != nil and File.exists? path
61
- path = list_file(entity_type, id) unless path != nil and File.exists? path
60
+ path = list_file(entity_type, id, :public) unless path != nil and File.exist? path
61
+ path = list_file(entity_type, id) unless path != nil and File.exist? path
62
62
 
63
- raise "List not found: #{ id }" if path.nil? or not File.exists? path
63
+ raise "List not found: #{ id }" if path.nil? or not File.exist? path
64
64
 
65
65
  begin
66
66
  list = Annotated.load_tsv TSV.open(path)
@@ -79,7 +79,7 @@ module Entity
79
79
  begin
80
80
  Open.write(path, Annotated.tsv(list, :all).to_s)
81
81
  rescue
82
- FileUtils.rm path if File.exists? path
82
+ FileUtils.rm path if File.exist? path
83
83
  raise $!
84
84
  end
85
85
  end
@@ -88,11 +88,11 @@ module Entity
88
88
  def self.delete_list(entity_type, id, user)
89
89
  path = list_file(entity_type, id, user)
90
90
 
91
- "This list does not belong to #{ user }: #{[entity_type, id] * ": "}" unless File.exists? path
91
+ "This list does not belong to #{ user }: #{[entity_type, id] * ": "}" unless File.exist? path
92
92
 
93
93
  Misc.lock path do
94
94
  begin
95
- FileUtils.rm path if File.exists? path
95
+ FileUtils.rm path if File.exist? path
96
96
  rescue
97
97
  raise $!
98
98
  end
@@ -39,7 +39,7 @@ module EntityRESTHelpers
39
39
  path.annotate check_file
40
40
  return false unless check_file.exists?
41
41
  else
42
- return false unless File.exists?(check_file)
42
+ return false unless File.exist?(check_file)
43
43
  end
44
44
 
45
45
  reject?(check_file, binding)
@@ -57,8 +57,8 @@ module Entity
57
57
 
58
58
  def self.load_map(entity_type, column, id, user = nil)
59
59
  path = map_file(entity_type, column, id, user)
60
- path = map_file(entity_type, column, id, :public) unless path != nil and File.exists? path
61
- path = map_file(entity_type, column, id) unless path != nil and File.exists? path
60
+ path = map_file(entity_type, column, id, :public) unless path != nil and File.exist? path
61
+ path = map_file(entity_type, column, id) unless path != nil and File.exist? path
62
62
 
63
63
  begin
64
64
  RbbtRESTHelpers.load_tsv(path).first
@@ -75,7 +75,7 @@ module Entity
75
75
  begin
76
76
  RbbtRESTHelpers.save_tsv(map, path)
77
77
  rescue
78
- FileUtils.rm path if path and File.exists? path
78
+ FileUtils.rm path if path and File.exist? path
79
79
  raise $!
80
80
  end
81
81
  end
@@ -84,11 +84,11 @@ module Entity
84
84
  def self.delete_map(entity_type, column, id, user)
85
85
  path = map_file(entity_type, column, id, user)
86
86
 
87
- "This map does not belong to #{ user }: #{[entity_type, column, id] * ": "}" unless File.exists? path
87
+ "This map does not belong to #{ user }: #{[entity_type, column, id] * ": "}" unless File.exist? path
88
88
 
89
89
  Misc.lock path do
90
90
  begin
91
- FileUtils.rm path if File.exists? path
91
+ FileUtils.rm path if File.exist? path
92
92
  rescue
93
93
  raise $!
94
94
  end
@@ -189,7 +189,7 @@ module Entity
189
189
  reuse = options.delete("reuse") if reuse.nil?
190
190
  reuse = true if reuse.nil?
191
191
 
192
- Entity::List.save_list(entity_type.to_s, id, self) unless reuse and File.exists?(Entity::List.list_file(entity_type.to_s, id))
192
+ Entity::List.save_list(entity_type.to_s, id, self) unless reuse and File.exist?(Entity::List.list_file(entity_type.to_s, id))
193
193
 
194
194
  klasses = self.klasses
195
195
  klasses << 'entity_list'
@@ -212,7 +212,7 @@ module Entity
212
212
  reuse = options.delete("reuse") if reuse.nil?
213
213
  reuse = true if reuse.nil?
214
214
 
215
- Entity::List.save_list(entity_type.to_s, id, self) unless reuse and File.exists? Entity::List.list_file(entity_type.to_s, id, self)
215
+ Entity::List.save_list(entity_type.to_s, id, self) unless reuse and File.exist? Entity::List.list_file(entity_type.to_s, id, self)
216
216
 
217
217
  klasses = self.klasses
218
218
  klasses << 'entity_list_action'
@@ -134,10 +134,10 @@ module Sinatra
134
134
  when :raw, :literal
135
135
  content_type "text/tab-separated-values"
136
136
  user_file = Entity::List.list_file(entity_type.split(":").first, list_id, user)
137
- send_file user_file if File.exists? user_file
137
+ send_file user_file if File.exist? user_file
138
138
 
139
139
  global_file = Entity::List.list_file(entity_type.split(":").first, list_id, nil)
140
- send_file global_file if File.exists? global_file
140
+ send_file global_file if File.exist? global_file
141
141
 
142
142
  raise "List file not found: #{ list_id }"
143
143
  when :json
@@ -296,21 +296,21 @@ module Sinatra
296
296
  case @format
297
297
  when :name
298
298
  file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, user)
299
- file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exists? file
299
+ file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exist? file
300
300
  new = TSV.open(file).change_key "Associated Gene Name"
301
301
  new_id = map_id << " [Names]"
302
302
  Entity::Map.save_map(entity_type, column, new_id, new, user)
303
303
  redirect to(Entity::REST.entity_map_url(new_id, entity_type, column))
304
304
  when :ensembl
305
305
  file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, user)
306
- file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exists? file
306
+ file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exist? file
307
307
  new = TSV.open(file).change_key "Ensembl Gene ID"
308
308
  new_id = map_id << " [Ensembl]"
309
309
  Entity::Map.save_map(entity_type, column, new_id, new, user)
310
310
  redirect to(Entity::REST.entity_map_url(new_id, entity_type, column))
311
311
  when :pvalue_score
312
312
  file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, user)
313
- file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exists? file
313
+ file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exist? file
314
314
  tsv = TSV.open(file)
315
315
  tsv.process tsv.fields.first do |value|
316
316
  value = value.flatten.first if Array === value
@@ -325,7 +325,7 @@ module Sinatra
325
325
  redirect to(Entity::REST.entity_map_url(new_id, entity_type, column))
326
326
  when :ranks
327
327
  file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, user)
328
- file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exists? file
328
+ file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exist? file
329
329
  tsv = TSV.open(file, :cast => :to_f)
330
330
  new = tsv.ranks_for(tsv.fields.first)
331
331
  new_id = map_id << " [Ranks]"
@@ -334,7 +334,7 @@ module Sinatra
334
334
  redirect to(Entity::REST.entity_map_url(new_id, entity_type, column))
335
335
  when :invert_ranks
336
336
  file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, user)
337
- file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exists? file
337
+ file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exist? file
338
338
  tsv = TSV.open(file)
339
339
  size = tsv.size
340
340
  tsv.process "Rank" do |v|
@@ -351,15 +351,15 @@ module Sinatra
351
351
  when :raw, :literal
352
352
  content_type "text/tab-separated-values"
353
353
  user_file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, user)
354
- send_file user_file if File.exists? user_file
354
+ send_file user_file if File.exist? user_file
355
355
 
356
356
  global_file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil)
357
- send_file global_file if File.exists? global_file
357
+ send_file global_file if File.exist? global_file
358
358
 
359
359
  raise "Map file not found: #{ map_id }"
360
360
  when :json
361
361
  file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, user)
362
- file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exists? file
362
+ file = Entity::Map.map_file(entity_type.split(":").first, column, map_id, nil) unless File.exist? file
363
363
 
364
364
  content_type "application/json"
365
365
  tsv = TSV.open(file)
@@ -413,13 +413,13 @@ module Sinatra
413
413
  column = Entity::REST.restore_element(column)
414
414
 
415
415
  file1 = Entity::Map.map_file(entity_type.split(":").first, column, map1, user)
416
- file1 = Entity::Map.map_file(entity_type.split(":").first, column, map1, nil) unless File.exists? file1
417
- raise "Map not found: #{ map1 }" unless File.exists? file1
416
+ file1 = Entity::Map.map_file(entity_type.split(":").first, column, map1, nil) unless File.exist? file1
417
+ raise "Map not found: #{ map1 }" unless File.exist? file1
418
418
  tsv1 = TSV.open(file1, :cast => :to_f)
419
419
 
420
420
  file2 = Entity::Map.map_file(entity_type.split(":").first, column2, map2, user)
421
- file2 = Entity::Map.map_file(entity_type.split(":").first, column2, map2, nil) unless File.exists? file2
422
- raise "Map not found: #{ map2 } - #{ file2 }" unless File.exists? file2
421
+ file2 = Entity::Map.map_file(entity_type.split(":").first, column2, map2, nil) unless File.exist? file2
422
+ raise "Map not found: #{ map2 } - #{ file2 }" unless File.exist? file2
423
423
  tsv2 = TSV.open(file2, :cast => :to_f)
424
424
 
425
425
  tsv1 = tsv1.select :key => tsv2.keys
@@ -1,3 +1,6 @@
1
+ require 'haml'
2
+ $haml_6 = Gem::Version.new(Haml::VERSION) >= Gem::Version.new("6.0.0")
3
+
1
4
  require 'rbbt/rest/common/locate'
2
5
  require 'rbbt/rest/common/resources'
3
6
  require 'rbbt/rest/common/users'
@@ -14,6 +17,7 @@ require 'json'
14
17
  require 'nakayoshi_fork'
15
18
 
16
19
  Rbbt.add_version(__FILE__)
20
+
17
21
  module Sinatra
18
22
  module RbbtRESTMain
19
23
 
@@ -121,7 +125,7 @@ module Sinatra
121
125
  printer = RubyProf::MultiPrinter.new(result)
122
126
  dir = TmpFile.tmp_file
123
127
  dir = settings.file_dir
124
- FileUtils.mkdir_p dir unless File.exists? dir
128
+ FileUtils.mkdir_p dir unless File.exist? dir
125
129
  printer.print(:path => dir, :profile => 'profile')
126
130
  Log.info{ "Profile saved at #{ dir }: #{@uri}" }
127
131
  end
@@ -151,7 +151,7 @@ module WorkflowRESTHelpers
151
151
  if job.path
152
152
  if Open.remote? job.path
153
153
  Open.open(job.path, :nocache => true)
154
- elsif File.exists? job.path
154
+ elsif File.exist? job.path
155
155
  send_file(job.path, :filename => (params[:filename] || File.basename(job.path)))
156
156
  else
157
157
  halt 200, job.load
@@ -41,7 +41,7 @@ module Sinatra
41
41
  workflow.export *workflow.tasks.keys
42
42
  end
43
43
 
44
- self.instance_eval workflow.libdir.lib['sinatra.rb'].read, workflow.libdir.lib['sinatra.rb'].find if workflow.respond_to?(:libdir) and File.exists? workflow.libdir.lib['sinatra.rb']
44
+ self.instance_eval workflow.libdir.lib['sinatra.rb'].read, workflow.libdir.lib['sinatra.rb'].find if workflow.respond_to?(:libdir) and File.exist? workflow.libdir.lib['sinatra.rb']
45
45
 
46
46
  get "/#{workflow.to_s}" do
47
47
  case format
@@ -30,7 +30,7 @@
30
30
  - pvalue = pvalue.collect{|p| p == 0 ? 0.000000000000000000001 : p }
31
31
  = resource map_id + '.qqplot.png', nil, :image do |file|
32
32
  = fragment do
33
- - FileUtils.mkdir_p File.dirname(file) unless File.exists? File.dirname(file)
33
+ - FileUtils.mkdir_p File.dirname(file) unless File.exist? File.dirname(file)
34
34
  :ruby
35
35
  script =<<-EOF
36
36
  library(ggplot2)
@@ -31,7 +31,7 @@
31
31
  - name = File.basename(example_dir)
32
32
  - task_info = workflow.task_info task
33
33
  - inputs = Workflow.load_inputs(example_dir, task_info[:inputs], task_info[:input_types])
34
- - inputs.each{|k,v| v.replace Open.read(v) if String === v and File.exists? v }
34
+ - inputs.each{|k,v| v.replace Open.read(v) if String === v and File.exist? v }
35
35
  - new = {}
36
36
  - inputs.each{|k,v| v.filename = nil if TSV === v ; v = v * "\n" if Array === v; new[k] = v.to_s }
37
37
  - inputs = new
@@ -4,7 +4,7 @@
4
4
  - page = result.size > 50 ? "1" : nil
5
5
 
6
6
  = table :table_id => table_id, :page => page, :table_class => table_class, :row_ids => :use, :table_url => jobname ? to(File.join('/', workflow.to_s, task, jobname)) : nil do
7
- - result
7
+ - next result
8
8
 
9
9
  -#
10
10
  - begin
@@ -66,7 +66,7 @@
66
66
  $('.step.progress').progress({label: 'ratio',text:{ratio: '{value}'}})
67
67
 
68
68
  %hr
69
- - if defined? job.info_file and File.exists? job.info_file and @uri.include? job.name
69
+ - if defined? job.info_file and File.exist? job.info_file and @uri.include? job.name
70
70
  - abort_url = add_GET_param(remove_GET_param(@uri, "_layout"), "_update", "abort")
71
71
  %a.ui.button.red.abort(href=abort_url) Abort
72
72
  -#- clean_url = add_GET_param(remove_GET_param(@uri, "_layout"), "_update", "clean")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.157
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-07 00:00:00.000000000 Z
11
+ date: 2023-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: modular-scale
@@ -1853,7 +1853,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1853
1853
  - !ruby/object:Gem::Version
1854
1854
  version: '0'
1855
1855
  requirements: []
1856
- rubygems_version: 3.1.4
1856
+ rubygems_version: 3.4.8
1857
1857
  signing_key:
1858
1858
  specification_version: 4
1859
1859
  summary: Rbbt Web and REST interfaces