rbbt-util 5.5.2 → 5.5.3
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 +8 -8
- data/bin/rbbt_Rutil.rb +3 -1
- data/etc/app.d/base.rb +34 -0
- data/etc/app.d/entities.rb +40 -0
- data/etc/app.d/finder.rb +10 -0
- data/etc/app.d/init.rb +11 -0
- data/etc/app.d/resources.rb +9 -0
- data/lib/rbbt.rb +0 -6
- data/lib/rbbt/annotations/util.rb +31 -28
- data/lib/rbbt/entity.rb +0 -1
- data/lib/rbbt/resource/path.rb +2 -1
- data/lib/rbbt/util/R.rb +8 -7
- data/lib/rbbt/util/misc.rb +105 -29
- data/share/{lib/R → Rlib}/util.R +0 -0
- data/share/rbbt_commands/app/start +6 -1
- data/test/rbbt/test_annotations.rb +1 -1
- data/test/rbbt/util/test_R.rb +1 -1
- data/test/rbbt/util/test_misc.rb +9 -5
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTZhNzI1NTUwMDE2ZWY3NTVkY2UyMWM3OTFlNTFjZmZkZmY5YmNkZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGQyYjgxYjg4MzgxZTk3Y2QwNTdhOWEwODUzMzk0ODJlZWY0MGMxMQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzkxYmJmYzQwMTAxMmIyMmJkZWZlZjY3ZDdiOWFkOTdmZGUwMDc1Zjc1ODE5
|
10
|
+
YjMzYmNhM2YxMzg4YjllZTAwNDZjYTc2ZmVhNDZiMzQ2YjI2MTFkNTUzODZh
|
11
|
+
YzZkYjg4NWU4ZWEwZDM2NDE3NGZhYzIxYmJkZTZiNDAzMzQ3ODM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmI5MzRjNjFjYzcwOThhZTc2Njg2MmViZmFlNWNlOTFiYWI4N2NjM2E3MzBi
|
14
|
+
MjY0ZWVhMzY4ZmMxNTI5ZjE4OTFiMTA2Mzg3YzFlNmJkZTU4NjE1MmYwZjdh
|
15
|
+
NjhhNGU4NTdmNzFkOTA2OGUzNzUyMjc5ZTU0ZjA4NzUxZTc2Yjg=
|
data/bin/rbbt_Rutil.rb
CHANGED
data/etc/app.d/base.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#{{{ MODULES AND HELPERS
|
2
|
+
register Sinatra::RbbtRESTMain
|
3
|
+
register Sinatra::RbbtRESTEntity
|
4
|
+
register Sinatra::RbbtRESTWorkflow
|
5
|
+
register Sinatra::RbbtRESTFileServer
|
6
|
+
register Sinatra::RbbtRESTKnowledgeBase
|
7
|
+
helpers Sinatra::RbbtMiscHelpers
|
8
|
+
|
9
|
+
#{{{ SESSIONS
|
10
|
+
use Rack::Session::Cookie, :key => 'rack.session',
|
11
|
+
:path => '/',
|
12
|
+
:expire_after => 2592000,
|
13
|
+
:secret => 'StudyExplorer secret!!'
|
14
|
+
|
15
|
+
|
16
|
+
#{{{ DIRECTORIES
|
17
|
+
local_var = Rbbt.var.find
|
18
|
+
set :cache_dir , local_var.sinatra.cache.find
|
19
|
+
set :file_dir , local_var.sinatra.files.find
|
20
|
+
set :permalink_dir , local_var.sinatra.permalink.find
|
21
|
+
set :favourites_dir , local_var.sinatra.favourites.find
|
22
|
+
set :favourite_lists_dir , local_var.sinatra.favourite_lists
|
23
|
+
set :favourite_maps_dir , local_var.sinatra.favourite_maps
|
24
|
+
|
25
|
+
#{{{ WORKFLOWS
|
26
|
+
|
27
|
+
if Rbbt.etc.workflows.find.exists?
|
28
|
+
Rbbt.etc.workflows.find.read.split("\n").each do |workflow|
|
29
|
+
Workflow.require_workflow workflow
|
30
|
+
add_workflow Kernel.const_get(workflow), true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Rbbt.etc.requires.read.split("\n").each do |file|
|
2
|
+
next if file.empty?
|
3
|
+
Log.debug("requiring #{ file }")
|
4
|
+
require file
|
5
|
+
end if Rbbt.etc.requires.exists?
|
6
|
+
|
7
|
+
|
8
|
+
Entity.entity_list_cache = Rbbt.var.find.sinatra.entity_lists
|
9
|
+
Entity.entity_map_cache = Rbbt.var.find.sinatra.entity_maps
|
10
|
+
Entity.entity_property_cache = Rbbt.var.find.sinatra.entity_properties
|
11
|
+
|
12
|
+
Rbbt.etc.entities.read.split("\n").each do |name|
|
13
|
+
next if name.empty?
|
14
|
+
mod = Kernel.const_get name
|
15
|
+
Log.debug("Including Entity::REST for #{ name }")
|
16
|
+
mod.module_eval do
|
17
|
+
include Entity::REST
|
18
|
+
end
|
19
|
+
end if Rbbt.etc.entities.exists?
|
20
|
+
|
21
|
+
$annotation_repo = Rbbt.var.find(:lib).sinatra.annotation_repo.find
|
22
|
+
Rbbt.etc.persit_properties.yaml.each do |name,list|
|
23
|
+
next if name.empty?
|
24
|
+
mod = Kernel.const_get name
|
25
|
+
mod.module_eval do
|
26
|
+
list.each do |elem|
|
27
|
+
prop, type, repo = elem.split(",").collect{|e| e.strip}
|
28
|
+
|
29
|
+
Log.debug("Persist #{name} #{prop}: #{[type, repo].compact * ", "}")
|
30
|
+
if repo == 'repo'
|
31
|
+
options = {:annotation_repo => $annotation_repo}
|
32
|
+
else
|
33
|
+
options = {}
|
34
|
+
end
|
35
|
+
persist prop, type, options
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end if Rbbt.etc.persit_properties.exists?
|
39
|
+
|
40
|
+
|
data/etc/app.d/finder.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#{{{ FINDER
|
2
|
+
finder = Finder.new
|
3
|
+
if ENV['RBBT_FINDER']
|
4
|
+
finder.add_instance(KEGG.pathways, :grep => '^hsa\|^#', :fields => ["Pathway Name"], :namespace => "Hsa/jun2011", :fix => Proc.new{|l| l.sub(/ - Homo sapiens.*/,'')})
|
5
|
+
finder.add_instance(Organism.lexicon("Hsa/jun2011"), :persist => true, :namespace => "Hsa/jun2011", :grep => '^LRG_', :invert_grep => true)
|
6
|
+
end
|
7
|
+
set :finder, finder
|
8
|
+
Log.debug("Finder started with: #{finder.instances.length} instances")
|
9
|
+
|
10
|
+
|
data/etc/app.d/init.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'zurb-foundation'
|
2
|
+
require 'modular-scale'
|
3
|
+
|
4
|
+
require 'rbbt'
|
5
|
+
require 'rbbt/rest/main'
|
6
|
+
require 'rbbt/rest/entity'
|
7
|
+
require 'rbbt/rest/workflow'
|
8
|
+
require 'rbbt/rest/file_server'
|
9
|
+
require 'rbbt/rest/helpers'
|
10
|
+
|
11
|
+
YAML::ENGINE.yamler = 'syck' if defined? YAML::ENGINE and YAML::ENGINE.respond_to? :yamler
|
@@ -0,0 +1,9 @@
|
|
1
|
+
EntityRESTHelpers.entity_resources.unshift Rbbt.www.views.find
|
2
|
+
RbbtRESTHelpers.template_resources.unshift Rbbt.www.views.find
|
3
|
+
RbbtRESTHelpers.add_sass_load_path "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
|
4
|
+
RbbtRESTHelpers.add_sass_load_path "#{Gem.loaded_specs['zurb-foundation'].full_gem_path}/scss/"
|
5
|
+
RbbtRESTHelpers.add_sass_load_path "#{Gem.loaded_specs['modular-scale'].full_gem_path}/stylesheets/"
|
6
|
+
RbbtRESTHelpers.javascript_resources << Path.setup("#{Gem.loaded_specs['zurb-foundation'].full_gem_path}/js/foundation")
|
7
|
+
RbbtRESTHelpers.javascript_resources << Path.setup("#{Gem.loaded_specs['zurb-foundation'].full_gem_path}/js/vendor")
|
8
|
+
|
9
|
+
|
data/lib/rbbt.rb
CHANGED
@@ -4,9 +4,3 @@ module Rbbt
|
|
4
4
|
extend Resource
|
5
5
|
pkgdir = 'rbbt'
|
6
6
|
end
|
7
|
-
|
8
|
-
#Open.cachedir = Rbbt.var.cache["open-remote"].find :user
|
9
|
-
#TmpFile.tmpdir = Rbbt.tmp.find :user
|
10
|
-
#FileCache.cachedir = Rbbt.var.cache.filecache.find :user
|
11
|
-
#Persist.cachedir = Rbbt.var.cache.persistence.find :user
|
12
|
-
|
@@ -2,7 +2,14 @@ require 'json'
|
|
2
2
|
|
3
3
|
module Annotated
|
4
4
|
|
5
|
-
def self.
|
5
|
+
def self.flatten(array)
|
6
|
+
return array if array.nil? or array.empty?
|
7
|
+
return array.flatten if AnnotatedArray === array
|
8
|
+
return array if array.compact.collect{|e| e.info }.uniq.length > 1
|
9
|
+
array.compact.first.annotate(array.flatten).tap{|a| a.extend AnnotatedArray }
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.load_entity(object, info)
|
6
13
|
annotation_types = info.delete(:annotation_types) || info.delete("annotation_types") || []
|
7
14
|
annotation_types = annotation_types.split("|") if String === annotation_types
|
8
15
|
|
@@ -34,9 +41,23 @@ module Annotated
|
|
34
41
|
end
|
35
42
|
end
|
36
43
|
|
44
|
+
def self.load_info(fields, values)
|
45
|
+
info = {}
|
46
|
+
fields.each_with_index do |field,i|
|
47
|
+
next if field == "literal"
|
48
|
+
if field == "JSON"
|
49
|
+
JSON.parse(values[i]).each do |key, value|
|
50
|
+
info[key.to_sym] = value
|
51
|
+
end
|
52
|
+
else
|
53
|
+
info[field.to_sym] = resolve_array(values[i])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
info
|
57
|
+
end
|
58
|
+
|
37
59
|
def self.load_tsv_values(id, values, *fields)
|
38
60
|
fields = fields.flatten
|
39
|
-
info = {}
|
40
61
|
literal_pos = fields.index "literal"
|
41
62
|
|
42
63
|
object = case
|
@@ -49,36 +70,18 @@ module Annotated
|
|
49
70
|
object = resolve_array(object)
|
50
71
|
|
51
72
|
if Array === values.first
|
52
|
-
Misc.zip_fields(values).collect do |
|
53
|
-
|
54
|
-
next if field == "literal"
|
55
|
-
if field == "JSON"
|
56
|
-
JSON.parse(list[i]).each do |key, value|
|
57
|
-
info[key.to_sym] = value
|
58
|
-
end
|
59
|
-
else
|
60
|
-
info[field.to_sym] = resolve_array(list[i])
|
61
|
-
end
|
62
|
-
end
|
73
|
+
Misc.zip_fields(values).collect do |v|
|
74
|
+
info = load_info(fields, v)
|
63
75
|
end
|
64
76
|
else
|
65
|
-
|
66
|
-
next if field == "literal"
|
67
|
-
if field == "JSON"
|
68
|
-
JSON.parse(values[i]).each do |key, value|
|
69
|
-
info[key.to_sym] = value
|
70
|
-
end
|
71
|
-
else
|
72
|
-
info[field.to_sym] = resolve_array(values[i])
|
73
|
-
end
|
74
|
-
end
|
77
|
+
info = load_info(fields, values)
|
75
78
|
end
|
76
79
|
|
77
|
-
self.
|
80
|
+
self.load_entity(object, info)
|
78
81
|
|
79
82
|
object
|
80
83
|
end
|
81
|
-
|
84
|
+
|
82
85
|
def self.load_tsv(tsv)
|
83
86
|
tsv.with_unnamed do
|
84
87
|
annotated_entities = tsv.collect do |id, values|
|
@@ -104,7 +107,7 @@ module Annotated
|
|
104
107
|
fields = AnnotatedArray === annotations ? annotations.annotations : annotations.compact.first.annotations
|
105
108
|
fields << :annotation_types
|
106
109
|
|
107
|
-
when (fields == [:literal] and not annotations.empty?)
|
110
|
+
when (fields == [:literal] and not annotations.compact.empty?)
|
108
111
|
fields << :literal
|
109
112
|
|
110
113
|
when (fields == [:all] and Annotated === annotations)
|
@@ -112,9 +115,9 @@ module Annotated
|
|
112
115
|
fields << :annotated_array if AnnotatedArray === annotations
|
113
116
|
fields << :literal
|
114
117
|
|
115
|
-
when (fields == [:all] and not annotations.empty?)
|
118
|
+
when (fields == [:all] and not annotations.compact.empty?)
|
116
119
|
raise "Input array must be annotated or its elements must be" if not Annotated === annotations.compact.first and not Array === annotations.compact.first
|
117
|
-
raise "Input array must be annotated or its elements must be. No
|
120
|
+
raise "Input array must be annotated or its elements must be. No double arrays of singly annotated entities." if not Annotated === annotations.compact.first and Array === annotations.compact.first
|
118
121
|
fields = [:annotation_types] + (Annotated === annotations ?
|
119
122
|
annotations.annotations:
|
120
123
|
annotations.compact.first.annotations)
|
data/lib/rbbt/entity.rb
CHANGED
data/lib/rbbt/resource/path.rb
CHANGED
@@ -55,6 +55,7 @@ module Path
|
|
55
55
|
end
|
56
56
|
|
57
57
|
SEARCH_PATHS = {
|
58
|
+
:current => File.join(File.expand_path('.'), "{TOPLEVEL}", "{SUBPATH}"),
|
58
59
|
:user => File.join(ENV['HOME'], ".{PKGDIR}", "{TOPLEVEL}", "{SUBPATH}"),
|
59
60
|
:global => File.join('/', "{TOPLEVEL}", "{PKGDIR}", "{SUBPATH}"),
|
60
61
|
:local => File.join('/usr/local', "{TOPLEVEL}", "{PKGDIR}", "{SUBPATH}"),
|
@@ -81,7 +82,7 @@ module Path
|
|
81
82
|
|
82
83
|
path = nil
|
83
84
|
if where.nil?
|
84
|
-
%w(user local global lib).each do |w|
|
85
|
+
%w(current user local global lib).each do |w|
|
85
86
|
w = w.to_sym
|
86
87
|
next unless search_paths.include? w
|
87
88
|
path = find(w, caller_lib, search_paths)
|
data/lib/rbbt/util/R.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rbbt/tsv'
|
|
3
3
|
|
4
4
|
module R
|
5
5
|
|
6
|
-
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'../../../share/
|
6
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'../../../share/Rlib')
|
7
7
|
UTIL = File.join(LIB_DIR, 'util.R')
|
8
8
|
|
9
9
|
def self.run(command, options = {})
|
@@ -37,12 +37,12 @@ source('#{UTIL}');
|
|
37
37
|
|
38
38
|
def self.interactive(script, options = {})
|
39
39
|
TmpFile.with_file do |init_file|
|
40
|
-
Open.write(init_file) do |
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
Open.write(init_file) do |f|
|
41
|
+
f.puts "# Loading basic rbbt environment"
|
42
|
+
f.puts "library(utils);\n"
|
43
|
+
f.puts "source('#{R::UTIL}');\n"
|
44
|
+
f.puts
|
45
|
+
f.puts script
|
46
46
|
end
|
47
47
|
CMD.cmd("env R_PROFILE='#{init_file}' xterm \"$RHOME/bin/R\"")
|
48
48
|
end
|
@@ -97,6 +97,7 @@ if (! is.null(data)){ rbbt.tsv.write('#{f}', data); }
|
|
97
97
|
|
98
98
|
def R_interactive(pre_script = nil)
|
99
99
|
TmpFile.with_file do |f|
|
100
|
+
Log.debug{"R Script:\n" << pre_script }
|
100
101
|
TmpFile.with_file(pre_script) do |script_file|
|
101
102
|
Open.write(f, self.to_s)
|
102
103
|
script = "data_file = '#{f}';\n"
|
data/lib/rbbt/util/misc.rb
CHANGED
@@ -21,10 +21,11 @@ end
|
|
21
21
|
module Misc
|
22
22
|
class FieldNotFoundError < StandardError;end
|
23
23
|
|
24
|
+
|
24
25
|
def self.correct_icgc_mutation(pos, ref, mut_str)
|
25
26
|
mut = mut_str
|
26
27
|
mut = '-' * (mut_str.length - 1) if mut =~/^-[ACGT]/
|
27
|
-
|
28
|
+
mut = "+" << mut if ref == '-'
|
28
29
|
[pos, [mut]]
|
29
30
|
end
|
30
31
|
|
@@ -1123,7 +1124,7 @@ end
|
|
1123
1124
|
mod
|
1124
1125
|
end
|
1125
1126
|
|
1126
|
-
def self.
|
1127
|
+
def self.string2hash_old(string)
|
1127
1128
|
|
1128
1129
|
options = {}
|
1129
1130
|
string.split(/#/).each do |str|
|
@@ -1133,37 +1134,112 @@ end
|
|
1133
1134
|
option, value = str, true
|
1134
1135
|
end
|
1135
1136
|
|
1136
|
-
|
1137
|
-
|
1137
|
+
option = option.sub(":",'').to_sym if option.chars.first == ':'
|
1138
|
+
value = value.sub(":",'').to_sym if String === value and value.chars.first == ':'
|
1138
1139
|
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1140
|
+
if value == true
|
1141
|
+
options[option] = option.to_s.chars.first != '!'
|
1142
|
+
else
|
1143
|
+
options[option] = Thread.start do
|
1144
|
+
$SAFE = 0;
|
1145
|
+
case
|
1146
|
+
when value =~ /^(?:true|T)$/i
|
1147
|
+
true
|
1148
|
+
when value =~ /^(?:false|F)$/i
|
1149
|
+
false
|
1150
|
+
when Symbol === value
|
1151
|
+
value
|
1152
|
+
when (String === value and value =~ /^\/(.*)\/$/)
|
1153
|
+
Regexp.new /#{$1}/
|
1154
|
+
else
|
1155
|
+
begin
|
1156
|
+
Kernel.const_get value
|
1157
|
+
rescue
|
1158
|
+
begin
|
1159
|
+
raise if value =~ /[a-z]/ and defined? value
|
1160
|
+
eval(value)
|
1161
|
+
rescue Exception
|
1162
|
+
value
|
1163
|
+
end
|
1162
1164
|
end
|
1163
1165
|
end
|
1164
|
-
end
|
1165
|
-
end
|
1166
|
+
end.value
|
1167
|
+
end
|
1166
1168
|
end
|
1169
|
+
|
1170
|
+
options
|
1171
|
+
end
|
1172
|
+
|
1173
|
+
def self.string2hash(string)
|
1174
|
+
options = {}
|
1175
|
+
|
1176
|
+
string.split('#').each do |str|
|
1177
|
+
key, sep, value = str.partition "="
|
1178
|
+
|
1179
|
+
key = key[1..-1].to_sym if key[0] == ":"
|
1180
|
+
|
1181
|
+
options[key] = true and next if value.empty?
|
1182
|
+
options[key] = value[1..-1].to_sym and next if value[0] == ":"
|
1183
|
+
options[key] = Regexp.new(/#{value[1..-2]}/) and next if value[0] == "/" and value[-1] == "/"
|
1184
|
+
options[key] = value[1..-2] and next if value =~ /^['"].*['"]$/
|
1185
|
+
options[key] = value.to_i and next if value =~ /^\d+$/
|
1186
|
+
options[key] = value.to_f and next if value =~ /^\d*\.\d+$/
|
1187
|
+
options[key] = true and next if value == "true"
|
1188
|
+
options[key] = false and next if value == "false"
|
1189
|
+
options[key] = value and next
|
1190
|
+
|
1191
|
+
options[key] = begin
|
1192
|
+
saved_safe = $SAFE
|
1193
|
+
$SAFE = 0
|
1194
|
+
eval(value)
|
1195
|
+
rescue Exception
|
1196
|
+
value
|
1197
|
+
ensure
|
1198
|
+
$SAFE = saved_safe
|
1199
|
+
end
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
return options
|
1203
|
+
|
1204
|
+
options = {}
|
1205
|
+
string.split(/#/).each do |str|
|
1206
|
+
if str.match(/(.*)=(.*)/)
|
1207
|
+
option, value = $1, $2
|
1208
|
+
else
|
1209
|
+
option, value = str, true
|
1210
|
+
end
|
1211
|
+
|
1212
|
+
option = option.sub(":",'').to_sym if option.chars.first == ':'
|
1213
|
+
value = value.sub(":",'').to_sym if String === value and value.chars.first == ':'
|
1214
|
+
|
1215
|
+
if value == true
|
1216
|
+
options[option] = option.to_s.chars.first != '!'
|
1217
|
+
else
|
1218
|
+
options[option] = Thread.start do
|
1219
|
+
$SAFE = 0;
|
1220
|
+
case
|
1221
|
+
when value =~ /^(?:true|T)$/i
|
1222
|
+
true
|
1223
|
+
when value =~ /^(?:false|F)$/i
|
1224
|
+
false
|
1225
|
+
when Symbol === value
|
1226
|
+
value
|
1227
|
+
when (String === value and value =~ /^\/(.*)\/$/)
|
1228
|
+
Regexp.new /#{$1}/
|
1229
|
+
else
|
1230
|
+
begin
|
1231
|
+
Kernel.const_get value
|
1232
|
+
rescue
|
1233
|
+
begin
|
1234
|
+
raise if value =~ /[a-z]/ and defined? value
|
1235
|
+
eval(value)
|
1236
|
+
rescue Exception
|
1237
|
+
value
|
1238
|
+
end
|
1239
|
+
end
|
1240
|
+
end
|
1241
|
+
end.value
|
1242
|
+
end
|
1167
1243
|
end
|
1168
1244
|
|
1169
1245
|
options
|
data/share/{lib/R → Rlib}/util.R
RENAMED
File without changes
|
@@ -17,5 +17,10 @@ Misc.in_dir(app_dir) do
|
|
17
17
|
require 'rack'
|
18
18
|
ENV["RBBT_FINDER"] = "true" if options.include?(:finder)
|
19
19
|
ENV["RACK_ENV"] = options[:environment] if options.include?(:environment)
|
20
|
-
|
20
|
+
|
21
|
+
if File.exists? 'config.ru'
|
22
|
+
Rack::Server.start(options.merge(:config => 'config.ru'))
|
23
|
+
else
|
24
|
+
Rack::Server.start(options.merge(:config => Rbbt.share['config.ru'].find))
|
25
|
+
end
|
21
26
|
end
|
@@ -70,7 +70,7 @@ class TestAnnotations < Test::Unit::TestCase
|
|
70
70
|
annotation_str = "Annotation String"
|
71
71
|
info = {:annotation_str => annotation_str, :annotation_types => [AnnotatedString]}
|
72
72
|
|
73
|
-
Annotated.
|
73
|
+
Annotated.load_entity(str, info)
|
74
74
|
assert_equal annotation_str, str.annotation_str
|
75
75
|
end
|
76
76
|
|
data/test/rbbt/util/test_R.rb
CHANGED
data/test/rbbt/util/test_misc.rb
CHANGED
@@ -81,9 +81,16 @@ class TestMisc < Test::Unit::TestCase
|
|
81
81
|
assert_equal(true, Misc.string2hash("true")["true"])
|
82
82
|
assert_equal(1, Misc.string2hash("a=1")["a"])
|
83
83
|
assert_equal('b', Misc.string2hash("a=b")["a"])
|
84
|
-
assert_equal('d', Misc.string2hash("a=b#c=d#:h=j")["c"])
|
85
|
-
assert_equal('j', Misc.string2hash("a=b#c=d#:h=j")[:h])
|
84
|
+
assert_equal('d', Misc.string2hash("a=b#c=d#:h='j'")["c"])
|
85
|
+
assert_equal('j', Misc.string2hash("a=b#c=d#:h='j'")[:h])
|
86
86
|
assert_equal(:j, Misc.string2hash("a=b#c=d#:h=:j")[:h])
|
87
|
+
|
88
|
+
Misc.benchmark(1000) do
|
89
|
+
Misc.string2hash_old("a=b#c=d#:h=:j#test='1'#:num=1#:sep=/#/")
|
90
|
+
end
|
91
|
+
Misc.benchmark(1000) do
|
92
|
+
Misc.string2hash("a=b#c=d#:h=:j#test='1'#:num=1#:sep=/#/")
|
93
|
+
end
|
87
94
|
end
|
88
95
|
|
89
96
|
def test_named_array
|
@@ -121,9 +128,6 @@ class TestMisc < Test::Unit::TestCase
|
|
121
128
|
hash = {:a => true}
|
122
129
|
assert_equal hash, Misc.string2hash(Misc.hash2string(hash))
|
123
130
|
|
124
|
-
hash = {:a => Misc}
|
125
|
-
assert_equal hash, Misc.string2hash(Misc.hash2string(hash))
|
126
|
-
|
127
131
|
hash = {:a => :b}
|
128
132
|
assert_equal hash, Misc.string2hash(Misc.hash2string(hash))
|
129
133
|
|
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.5.
|
4
|
+
version: 5.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -84,6 +84,11 @@ extra_rdoc_files:
|
|
84
84
|
- README.rdoc
|
85
85
|
files:
|
86
86
|
- LICENSE
|
87
|
+
- etc/app.d/base.rb
|
88
|
+
- etc/app.d/entities.rb
|
89
|
+
- etc/app.d/finder.rb
|
90
|
+
- etc/app.d/init.rb
|
91
|
+
- etc/app.d/resources.rb
|
87
92
|
- lib/rbbt-util.rb
|
88
93
|
- lib/rbbt.rb
|
89
94
|
- lib/rbbt/annotations.rb
|
@@ -138,8 +143,8 @@ files:
|
|
138
143
|
- lib/rbbt/workflow/step.rb
|
139
144
|
- lib/rbbt/workflow/task.rb
|
140
145
|
- lib/rbbt/workflow/usage.rb
|
146
|
+
- share/Rlib/util.R
|
141
147
|
- share/install/software/lib/install_helpers
|
142
|
-
- share/lib/R/util.R
|
143
148
|
- share/rbbt_commands/app/start
|
144
149
|
- share/rbbt_commands/conf/web_user/add
|
145
150
|
- share/rbbt_commands/conf/web_user/list
|