-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.rb
58 lines (46 loc) · 1.31 KB
/
common.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Helpful classes and utility methods.
#
class UserInputError < StandardError
end
class SettingsError < StandardError
end
def warning(message)
puts("WARNING: #{message}")
end
def bogus(message)
puts(">>>>>>>>>>>>>BOGUS #{message}")
end
def complain(message)
raise UserInputError.new(message)
end
#
# Record stdout and stderr, even while they are being displayed.
#
class MultiIO < IO
def initialize(*targets)
@targets = targets
end
def write(*args)
@targets.each {|t| t.write(*args)}
end
def flush()
@targets.each(&:flush)
end
def close
@targets.each(&:close)
end
end
$stdout = MultiIO.new(STDOUT, File.open(File.expand_path('~/vivosnap.stdout'), "w"))
$stderr = MultiIO.new(STDERR, File.open(File.expand_path('~/vivosnap.stderr'), "w"))
require 'rdf'
require_relative 'utils/args_checker'
require_relative 'utils/http_request'
require_relative 'cmd_prepare_uri_list/cmd_prepare_uri_list'
require_relative 'cmd_prepare_session_list/cmd_prepare_session_list'
require_relative 'cmd_prepare_self_editor_account/cmd_prepare_self_editor_account'
require_relative 'cmd_prepare_sub_list/cmd_prepare_sub_list'
require_relative 'cmd_capture/cmd_capture'
require_relative 'cmd_compare/cmd_compare'
require_relative 'cmd_compare_again/cmd_compare_again'
require_relative 'cmd_display/cmd_display'