rbbt-util 5.6.3 → 5.6.4

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
  SHA1:
3
- metadata.gz: ecea1d091627d32a02327ea8a0eee78b099f13f0
4
- data.tar.gz: a2ebf3798cb4ee454a3050307816b5d6ad46747d
3
+ metadata.gz: c71dfbcf2b547eae0ab59b0fcf3b590d08668244
4
+ data.tar.gz: 27f56badaca1455685f00466bce558785ed357a8
5
5
  SHA512:
6
- metadata.gz: ff9269d0314aa934653a32231706cf665209e411773b4e174228623697ec01fd223a626059d87c2ed2209b9ba33779c019719b2d17b795b0e68fca4e8ea8ba15
7
- data.tar.gz: e34f7b523daa44e076da779f3ed6d79733214770fceb5a16e8643f1e8db6aa035523c0925656adfee7b1d5f9d8713e4c026ea6905064927de2cbcddb26095d68
6
+ metadata.gz: 7a5fefc16d333e8ba239800eee76e90f3ae4d76efbcd50629c1ebd5cbab030f1f94aacba342336fab7bb12dc835ea1317ba1fcb1505e54e872ce0260afd9953c
7
+ data.tar.gz: 44dcbc2f220861724f3de420d7e6f6c65676893365b3d4c99391d0928b0ae12816db168b181af0e1349d35dc4441237687331f2f55febb459503ea928d8dfe95
data/bin/rbbt CHANGED
@@ -25,10 +25,9 @@ SOPT.summary = "Ruby bioinformatics toolkit"
25
25
  SOPT.description = <<-EOF
26
26
  This command controls many aspects of the Rbbt framework, from configuration tasks to running applications.
27
27
 
28
- Commands are implemented in separate files under the Rbbt path#{
29
- } '#{$rbbt_command_dir}'. Known locations are: #{
30
- ([$rbbt_command_dir] + $rbbt_command_dir.find_all) * ", "
31
- }. You can place your own commads at #{$rbbt_command_dir.find(:user)}.
28
+ Commands are implemented in separate files under the Rbbt path '#{$rbbt_command_dir}'.
29
+ Known locations are: #{([$rbbt_command_dir] + $rbbt_command_dir.find_all) * ", " }.
30
+ You can place your own commads at #{$rbbt_command_dir.find(:user)}.
32
31
  EOF
33
32
 
34
33
  def commands(prev)
@@ -43,6 +42,38 @@ def commands(prev)
43
42
  command_files.collect{|p| File.basename(p) }.uniq.reject{|p| p =~ /\.desc$/}.sort
44
43
  end
45
44
 
45
+ def rbbt_usage(prev = nil)
46
+ puts SOPT.doc
47
+
48
+ if prev
49
+ puts "## COMMANDS"
50
+ puts
51
+ puts "Command:"
52
+ puts
53
+ puts " #{File.basename($0)} #{prev * " "}"
54
+ puts
55
+ puts "Subcommands:"
56
+ puts
57
+ commands(prev).each do |command|
58
+ puts " " << command
59
+ end
60
+ end
61
+ end
62
+
63
+ def print_error(error, backtrace = nil)
64
+ puts
65
+ puts Term::ANSIColor.red("Error:")
66
+ puts
67
+ puts error
68
+ if backtrace
69
+ puts
70
+ puts Term::ANSIColor.red("Backtrace:")
71
+ puts
72
+ puts backtrace * "\n"
73
+ end
74
+ puts
75
+ end
76
+
46
77
  dir = $rbbt_command_dir
47
78
  prev = []
48
79
 
@@ -58,12 +89,15 @@ begin
58
89
  exit 0
59
90
  else
60
91
  error = "Command '#{command }' not understood"
61
- break
92
+ rbbt_usage(prev)
93
+ print_error(error)
94
+ exit -1
62
95
  end
63
96
  end
64
97
  rescue ParameterException
65
- error = $!.message
66
- backtrace = $!.backtrace
98
+ rbbt_usage
99
+ print_error($!.message, $!.backtrace)
100
+ exit -1
67
101
  ensure
68
102
  if options[:profile]
69
103
  result = RubyProf.stop
@@ -72,31 +106,3 @@ ensure
72
106
  end
73
107
  end
74
108
 
75
- puts SOPT.doc
76
-
77
- puts "## COMMANDS"
78
- puts
79
- puts "Command:"
80
- puts
81
- puts " #{File.basename($0)} #{prev * " "}"
82
- puts
83
- puts "Subcommands:"
84
- puts
85
- commands(prev).each do |command|
86
- puts " " << command
87
- end
88
-
89
- if error
90
- puts
91
- puts Term::ANSIColor.red("Error executing '#{ [File.basename($0), prev, command].compact.flatten * " " }':")
92
- puts
93
- puts error
94
- if backtrace
95
- puts
96
- puts Term::ANSIColor.red("Backtrace:")
97
- puts
98
- puts backtrace * "\n"
99
- end
100
- puts
101
- end
102
-
@@ -17,6 +17,9 @@ class Hash
17
17
  end
18
18
  end
19
19
 
20
+ class ParameterException < Exception; end
21
+ class FieldNotFoundError < StandardError;end
22
+
20
23
  module LaterString
21
24
  def to_s
22
25
  yield
@@ -24,7 +27,6 @@ module LaterString
24
27
  end
25
28
 
26
29
  module Misc
27
- class FieldNotFoundError < StandardError;end
28
30
 
29
31
  def self.correct_icgc_mutation(pos, ref, mut_str)
30
32
  mut = mut_str
@@ -4,7 +4,6 @@ require 'rbbt/util/log'
4
4
  require 'rbbt/util/semaphore'
5
5
  require 'rbbt/workflow/accessor'
6
6
 
7
- class ParameterException < Exception; end
8
7
 
9
8
  class Step
10
9
  attr_accessor :path, :task, :inputs, :dependencies, :bindings
@@ -6,7 +6,7 @@ require 'rbbt/workflow/usage'
6
6
 
7
7
  YAML::ENGINE.yamler = 'syck' if defined? YAML::ENGINE and YAML::ENGINE.respond_to? :yamler
8
8
 
9
- def usage(workflow = nil, task = nil, error = nil, backtrace = nil)
9
+ def usage(workflow = nil, task = nil, exception=nil)
10
10
  puts SOPT.doc
11
11
  puts "## WORKFLOW"
12
12
  puts
@@ -25,13 +25,9 @@ def usage(workflow = nil, task = nil, error = nil, backtrace = nil)
25
25
  puts workflow.workflow_description
26
26
  puts
27
27
  workflow.doc(task)
28
- if error
29
- puts
30
- puts Term::ANSIColor.red("Error: ") << error
31
- puts Term::ANSIColor.red("Backtrace: ") << backtrace * "\n"
32
- end
33
28
  end
34
29
 
30
+ raise exception if exception
35
31
  exit 0
36
32
  end
37
33
 
@@ -249,7 +245,7 @@ begin
249
245
  end
250
246
  rescue ParameterException
251
247
  SOPT.delete_inputs(workflow.rec_inputs(task.name))
252
- usage(workflow, task, $!.message, $!.backtrace)
248
+ usage(workflow, task, $!)
253
249
  end
254
250
 
255
251
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.3
4
+ version: 5.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez