Top Level Namespace
Defined Under Namespace
Modules: Annotation, Association, AssociationItem, Entity, FWTAdapter, Filtered, MultipleResult, OffsiteStep, Open, PKIAdapter, Path, Persist, Scout, ScoutCabinet, ScoutSemaphore, ScoutTKRZW, ShardAdapter, TKAdapter, TSV, TSVAdapter, Task, Workflow
Classes: CmdStop, DoneProcessing, FixWidthTable, PackedIndex, SSHLine, SSHProcessFailed, Sharder, Step, TaskNotFound, WorkQueue, WorkerException
Constant Summary
collapse
- Rbbt =
Scout
Instance Method Summary
collapse
Instance Method Details
#aliases ⇒ Object
177
178
179
|
# File 'bin/scout', line 177
def aliases
@aliases ||= Scout.etc.cmd_alias.exists? ? Scout.etc.cmd_alias.yaml : {}
end
|
#cmd_alias ⇒ Object
189
190
191
192
193
|
# File 'bin/scout', line 189
def cmd_alias
while ARGV[0] && aliases.include?(ARGV[0])
ARGV.replace tokenize_cmd_params(aliases[ARGV[0]]) + ARGV[1..-1]
end
end
|
#commands(prev) ⇒ Object
127
128
129
130
131
132
133
|
# File 'bin/scout', line 127
def commands(prev)
scout_command_dir = prev_dir(prev)
command_file_dirs = scout_command_dir.find_all
command_files = command_file_dirs.collect{|d| d.glob('*') }.flatten
command_files.collect{|p| File.basename(p) }.uniq.reject{|p| p =~ /\.desc$/}.sort
end
|
#prev_dir(prev) ⇒ Object
117
118
119
120
121
122
123
124
125
|
# File 'bin/scout', line 117
def prev_dir(prev)
scout_command_dir = $scout_command_dir
prev.each do |previous_command|
scout_command_dir = scout_command_dir[previous_command]
end
scout_command_dir
end
|
#print_error(error, backtrace = nil) ⇒ Object
164
165
166
167
168
169
170
171
172
173
174
175
|
# File 'bin/scout', line 164
def print_error(error, backtrace = nil)
puts Log.color :magenta, "## ERROR"
puts
if backtrace
puts Log.color :red, "Backtrace: "
puts
puts Log.color_stack(backtrace.reverse) * "\n"
puts
end
puts Log.color :red, error
puts
end
|
#scout_usage(prev = nil) ⇒ Object
Also known as:
usage
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'bin/scout', line 135
def scout_usage(prev = nil)
puts SOPT.doc
if prev
puts
puts Log.color :magenta, "## COMMANDS"
puts
puts Log.color :magenta, "Command:"
puts
puts " #{File.basename($0)} #{prev * " "}"
puts
puts Log.color :magenta, "Subcommands:"
puts
prev_dir = prev_dir(prev)
commands(prev).each do |command|
directory = File.directory? prev_dir[command].find
if directory
puts " " << Log.color(:blue, command)
else
puts " " << command
end
end
end
puts
true
end
|
#tokenize_cmd_params(str) ⇒ Object
181
182
183
184
185
186
187
|
# File 'bin/scout', line 181
def tokenize_cmd_params(str)
return str if Array === str
str.scan(/
(?:["']([^"']*?)["']) |
([^"'\s]+)
/x).flatten.compact
end
|