sequenceserver 1.1.0.beta11 → 1.1.0.beta12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -9
- data/Rakefile +1 -1
- data/bin/sequenceserver +79 -89
- data/lib/sequenceserver.rb +21 -18
- data/lib/sequenceserver/api_errors.rb +10 -11
- data/lib/sequenceserver/blast/constants.rb +6 -6
- data/lib/sequenceserver/blast/formatter.rb +3 -4
- data/lib/sequenceserver/blast/hit.rb +5 -2
- data/lib/sequenceserver/blast/hsp.rb +8 -5
- data/lib/sequenceserver/blast/job.rb +14 -13
- data/lib/sequenceserver/blast/query.rb +5 -3
- data/lib/sequenceserver/blast/report.rb +25 -23
- data/lib/sequenceserver/config.rb +26 -6
- data/lib/sequenceserver/database.rb +4 -3
- data/lib/sequenceserver/doctor.rb +22 -22
- data/lib/sequenceserver/exceptions.rb +17 -24
- data/lib/sequenceserver/job.rb +7 -7
- data/lib/sequenceserver/links.rb +11 -12
- data/lib/sequenceserver/logger.rb +1 -1
- data/lib/sequenceserver/pool.rb +0 -2
- data/lib/sequenceserver/report.rb +0 -1
- data/lib/sequenceserver/routes.rb +16 -16
- data/lib/sequenceserver/sequence.rb +24 -20
- data/lib/sequenceserver/server.rb +8 -8
- data/lib/sequenceserver/version.rb +1 -1
- data/public/js/search.js +2 -12
- data/public/sequenceserver-search.min.js +2 -2
- data/sequenceserver.gemspec +18 -17
- metadata +55 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc2b025ab26f09234131859b1d60c39327111610
|
4
|
+
data.tar.gz: 149e0c2d93046a81ef5043795fd772ec23bcd706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d8c9b123c1a8686862895f9a8254f55b0ab969295ab2c4a1fd0f8dcc2a2bc020efa17b41a1292a78901aa9961dc530376a8d69e6da99ca72e15a41aea9f5e8
|
7
|
+
data.tar.gz: 976438929256906862c004244a9f1554496c0dd99aa15f8cf8bc2f84fd905cd1c0df258ed2ff90e057ed57edd5501b67c60080883524b7d701e94406e8c2c27c
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
TargetRubyVersion: 2.3
|
2
3
|
Exclude:
|
3
4
|
# Because these are vendor files.
|
4
5
|
- 'node_modules/**/*'
|
@@ -21,15 +22,14 @@ Metrics/ModuleLength:
|
|
21
22
|
- 'lib/sequenceserver.rb'
|
22
23
|
- 'spec/blast_spec.rb'
|
23
24
|
Metrics/ClassLength:
|
24
|
-
|
25
|
-
# TODO:
|
26
|
-
# Evaluate whether to make class smaller or to increase 'Max'.
|
27
|
-
- 'lib/sequenceserver/database.rb'
|
25
|
+
Max: 150
|
28
26
|
Metrics/BlockNesting:
|
29
27
|
Exclude:
|
30
|
-
# TODO:
|
31
|
-
# Fix in bin/sequenceserver and re-enable.
|
32
28
|
- 'bin/sequenceserver'
|
29
|
+
Metrics/BlockLength:
|
30
|
+
Exclude:
|
31
|
+
- 'bin/sequenceserver'
|
32
|
+
- 'sequenceserver.gemspec'
|
33
33
|
|
34
34
|
Style/UnlessElse:
|
35
35
|
# TODO:
|
@@ -48,9 +48,14 @@ Style/EachWithObject:
|
|
48
48
|
Exclude:
|
49
49
|
# Because we support 1.8.7.
|
50
50
|
- '**/*.rb'
|
51
|
-
Style/HashSyntax:
|
52
|
-
# Because we support 1.8.7.
|
53
|
-
EnforcedStyle: hash_rockets
|
54
51
|
Style/AsciiComments:
|
55
52
|
# Nothing wrong with non-ascii chars, like © in comments.
|
56
53
|
Enabled: false
|
54
|
+
Style/SignalException:
|
55
|
+
# Roughly, use fail to fail and raise to signal.
|
56
|
+
EnforcedStyle: semantic
|
57
|
+
Style/FrozenStringLiteralComment:
|
58
|
+
# Immutability is good. Switching to immutable strings is like a paradigm
|
59
|
+
# shift and should be approached more carefully. Thus, disabling this cop
|
60
|
+
# for now.
|
61
|
+
Enabled: false
|
data/Rakefile
CHANGED
data/bin/sequenceserver
CHANGED
@@ -21,83 +21,83 @@ def download_from_url(url)
|
|
21
21
|
end
|
22
22
|
|
23
23
|
begin
|
24
|
-
Slop.parse!(:
|
25
|
-
banner
|
26
|
-
SUMMARY
|
24
|
+
Slop.parse!(strict: true, help: true) do
|
25
|
+
banner <<~BANNER
|
26
|
+
SUMMARY
|
27
27
|
|
28
|
-
custom, local, BLAST server
|
28
|
+
custom, local, BLAST server
|
29
29
|
|
30
|
-
USAGE
|
30
|
+
USAGE
|
31
31
|
|
32
|
-
sequenceserver [options]
|
32
|
+
sequenceserver [options]
|
33
33
|
|
34
|
-
EXAMPLE
|
34
|
+
EXAMPLE
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
# Launch SequenceServer. This will read configuration from
|
37
|
+
# ~/.sequenceserver.conf, if present.
|
38
|
+
$ sequenceserver
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
# Use a different config file.
|
41
|
+
$ sequenceserver -c ~/.sequenceserver.ants.conf
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
# Set number of threads to use. This will save the number
|
44
|
+
# of threads to use in config file.
|
45
|
+
$ sequenceserver -s -n 16
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
# See if you have FASTA files in database dir that haven't
|
48
|
+
# been converted into BLAST database.
|
49
|
+
$ sequenceserver -u
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
# Search for FASTA files in database dir that haven't been
|
52
|
+
# converted into BLAST database yet, and convert them.
|
53
|
+
$ sequenceserver -m
|
54
54
|
|
55
|
-
DESCRIPTION
|
55
|
+
DESCRIPTION
|
56
56
|
|
57
|
-
SequenceServer lets you rapidly set up a BLAST+ server with an intuitive user
|
58
|
-
interface for use locally or over the web. If BLAST+ is not installed on your
|
59
|
-
system, SequenceServer will offer to install BLAST+ for you. You should only
|
60
|
-
ever have to point it to a directory of FASTA files / BLAST+ databases.
|
57
|
+
SequenceServer lets you rapidly set up a BLAST+ server with an intuitive user
|
58
|
+
interface for use locally or over the web. If BLAST+ is not installed on your
|
59
|
+
system, SequenceServer will offer to install BLAST+ for you. You should only
|
60
|
+
ever have to point it to a directory of FASTA files / BLAST+ databases.
|
61
61
|
|
62
|
-
In a given directory, SequenceServer is able to tell FASTA files that are yet
|
63
|
-
to be formatted for use with BLAST+ and format them, and FASTA files that are
|
64
|
-
already formatted for use with BLAST+, heuristically skipping all other files
|
65
|
-
in the directory. Directories are scanned recursively. Type of sequences in a
|
66
|
-
FASTA file is detected automagically. `parse_seqids` and `hash_index` options
|
67
|
-
of `makeblastdb` are used to create BLAST+ databases.
|
68
|
-
BANNER
|
62
|
+
In a given directory, SequenceServer is able to tell FASTA files that are yet
|
63
|
+
to be formatted for use with BLAST+ and format them, and FASTA files that are
|
64
|
+
already formatted for use with BLAST+, heuristically skipping all other files
|
65
|
+
in the directory. Directories are scanned recursively. Type of sequences in a
|
66
|
+
FASTA file is detected automagically. `parse_seqids` and `hash_index` options
|
67
|
+
of `makeblastdb` are used to create BLAST+ databases.
|
68
|
+
BANNER
|
69
69
|
|
70
70
|
on 'c', 'config_file=',
|
71
71
|
'Use the given configuration file',
|
72
|
-
:
|
72
|
+
argument: true
|
73
73
|
|
74
74
|
on 'config=',
|
75
75
|
'Same as --config_file (deprecated)',
|
76
|
-
:
|
76
|
+
argument: true
|
77
77
|
|
78
78
|
on 'b', 'bin=',
|
79
79
|
'Load BLAST+ binaries from this directory',
|
80
|
-
:
|
80
|
+
argument: true
|
81
81
|
|
82
82
|
on 'd', 'database_dir=',
|
83
83
|
'Read FASTA and BLAST database from this directory',
|
84
|
-
:
|
84
|
+
argument: true
|
85
85
|
|
86
86
|
on 'n', 'num_threads=',
|
87
87
|
'Number of threads to use to run a BLAST search',
|
88
|
-
:
|
88
|
+
argument: true
|
89
89
|
|
90
90
|
on 'r', 'require=',
|
91
91
|
'Load extension from this file',
|
92
|
-
:
|
92
|
+
argument: true
|
93
93
|
|
94
94
|
on 'H', 'host=',
|
95
95
|
'Host to run SequenceServer on',
|
96
|
-
:
|
96
|
+
argument: true
|
97
97
|
|
98
98
|
on 'p', 'port=',
|
99
99
|
'Port to run SequenceServer on',
|
100
|
-
:
|
100
|
+
argument: true
|
101
101
|
|
102
102
|
on 's', 'set',
|
103
103
|
'Set configuration value in default or given config file'
|
@@ -117,8 +117,8 @@ BANNER
|
|
117
117
|
on 'i', 'interactive',
|
118
118
|
'Run SequenceServer in interactive mode'
|
119
119
|
|
120
|
-
#on 'doctor',
|
121
|
-
#'Run SequenceServer doctor'
|
120
|
+
# on 'doctor',
|
121
|
+
# 'Run SequenceServer doctor'
|
122
122
|
|
123
123
|
on 'D', 'devel',
|
124
124
|
'Start SequenceServer in development mode'
|
@@ -162,21 +162,17 @@ BANNER
|
|
162
162
|
# working SequenceServer installation. We expect to land following
|
163
163
|
# error scenarios either when creating a new SequenceServer (first
|
164
164
|
# time or later), or updating config values using -s CLI option.
|
165
|
-
|
166
165
|
rescue SequenceServer::CONFIG_FILE_ERROR,
|
167
166
|
SequenceServer::BLAST_DATABASE_ERROR => e
|
168
167
|
|
169
168
|
puts e
|
170
169
|
exit!
|
171
|
-
|
172
170
|
rescue SequenceServer::ENOENT => e
|
173
171
|
puts e
|
174
172
|
|
175
|
-
puts
|
173
|
+
puts 'Please consult sequenceserver --help for instructions on how to set the correct values.'
|
176
174
|
exit!
|
177
|
-
|
178
175
|
rescue SequenceServer::NUM_THREADS_INCORRECT => e
|
179
|
-
|
180
176
|
puts e
|
181
177
|
|
182
178
|
unless num_threads?
|
@@ -187,9 +183,7 @@ BANNER
|
|
187
183
|
end
|
188
184
|
|
189
185
|
exit!
|
190
|
-
|
191
186
|
rescue SequenceServer::BLAST_NOT_INSTALLED_OR_NOT_EXECUTABLE,
|
192
|
-
SequenceServer::BLAST_NOT_INSTALLED,
|
193
187
|
SequenceServer::BLAST_NOT_COMPATIBLE => e
|
194
188
|
|
195
189
|
# Show original error message first.
|
@@ -203,15 +197,15 @@ BANNER
|
|
203
197
|
# Ask user if she already has BLAST+ downloaded or offer to download
|
204
198
|
# BLAST+ for her.
|
205
199
|
puts
|
206
|
-
puts
|
207
|
-
SequenceServer can use NCBI BLAST+ that you may have on your system already, or
|
208
|
-
download the correct package for itself. A recent system update may have broken
|
209
|
-
your NCBI BLAST+ installation.
|
200
|
+
puts <<~MSG
|
201
|
+
SequenceServer can use NCBI BLAST+ that you may have on your system already, or
|
202
|
+
download the correct package for itself. A recent system update may have broken
|
203
|
+
your NCBI BLAST+ installation.
|
210
204
|
|
211
|
-
Please enter the path to NCBI BLAST+ or press Enter to download.
|
205
|
+
Please enter the path to NCBI BLAST+ or press Enter to download.
|
212
206
|
|
213
|
-
Press Ctrl+C to quit.
|
214
|
-
MSG
|
207
|
+
Press Ctrl+C to quit.
|
208
|
+
MSG
|
215
209
|
puts
|
216
210
|
response = Readline.readline('>> ').to_s.strip
|
217
211
|
if response.empty?
|
@@ -231,18 +225,18 @@ MSG
|
|
231
225
|
"#{version.chop}/" \
|
232
226
|
"ncbi-blast-#{version}-x64-macosx.tar.gz"
|
233
227
|
else
|
234
|
-
puts
|
235
|
-
------------------------------------------------------------------------
|
236
|
-
FAILED!! to install NCBI BLAST+.
|
228
|
+
puts <<~ERR
|
229
|
+
------------------------------------------------------------------------
|
230
|
+
FAILED!! to install NCBI BLAST+.
|
237
231
|
|
238
|
-
We currently support Linux and Mac only (64 bit). If you
|
239
|
-
believe you are running a supported platform, please open a support
|
240
|
-
ticket titled "#{RUBY_PLATFORM}" at:
|
232
|
+
We currently support Linux and Mac only (64 bit). If you
|
233
|
+
believe you are running a supported platform, please open a support
|
234
|
+
ticket titled "#{RUBY_PLATFORM}" at:
|
241
235
|
|
242
|
-
https://github.com/yannickwurm/sequenceserver/issues
|
243
|
-
------------------------------------------------------------------------
|
236
|
+
https://github.com/yannickwurm/sequenceserver/issues
|
237
|
+
------------------------------------------------------------------------
|
244
238
|
|
245
|
-
ERR
|
239
|
+
ERR
|
246
240
|
end
|
247
241
|
download_from_url(url)
|
248
242
|
unless $CHILD_STATUS.success?
|
@@ -254,17 +248,15 @@ ERR
|
|
254
248
|
end
|
255
249
|
fetch_option(:bin).value =
|
256
250
|
"~/.sequenceserver/ncbi-blast-#{version}/bin/"
|
257
|
-
redo
|
258
251
|
else
|
259
252
|
unless File.basename(response) == 'bin'
|
260
253
|
response = File.join(response, 'bin')
|
261
254
|
end
|
262
255
|
fetch_option(:bin).value = File.join(response)
|
263
256
|
puts
|
264
|
-
redo
|
265
257
|
end
|
258
|
+
redo
|
266
259
|
rescue SequenceServer::DATABASE_DIR_NOT_SET => e
|
267
|
-
|
268
260
|
# Show original error message.
|
269
261
|
puts
|
270
262
|
puts e
|
@@ -276,18 +268,17 @@ ERR
|
|
276
268
|
# Ask user for the directory containing sequences or BLAST+
|
277
269
|
# databases.
|
278
270
|
puts
|
279
|
-
puts
|
280
|
-
SequenceServer needs to know where your FASTA files or BLAST+ databases are.
|
281
|
-
Please enter the path to the relevant directory (default: current directory).
|
271
|
+
puts <<~MSG
|
272
|
+
SequenceServer needs to know where your FASTA files or BLAST+ databases are.
|
273
|
+
Please enter the path to the relevant directory (default: current directory).
|
282
274
|
|
283
|
-
Press Ctrl+C to quit.
|
284
|
-
MSG
|
275
|
+
Press Ctrl+C to quit.
|
276
|
+
MSG
|
285
277
|
|
286
278
|
puts
|
287
279
|
response = Readline.readline('>> ').to_s.strip
|
288
280
|
fetch_option(:database_dir).value = response
|
289
281
|
redo
|
290
|
-
|
291
282
|
rescue SequenceServer::NO_BLAST_DATABASE_FOUND => e
|
292
283
|
unless list_databases? || list_unformatted_fastas? ||
|
293
284
|
make_blast_databases?
|
@@ -299,14 +290,14 @@ MSG
|
|
299
290
|
# Offer user to format the FASTA files.
|
300
291
|
database_dir = SequenceServer.config[:database_dir]
|
301
292
|
puts
|
302
|
-
puts
|
303
|
-
Search for FASTA files (.fa, .fasta, .fna) in '#{database_dir}' and try
|
304
|
-
creating BLAST+ databases? [y/n] (Default: y).
|
305
|
-
MSG
|
293
|
+
puts <<~MSG
|
294
|
+
Search for FASTA files (.fa, .fasta, .fna) in '#{database_dir}' and try
|
295
|
+
creating BLAST+ databases? [y/n] (Default: y).
|
296
|
+
MSG
|
306
297
|
puts
|
307
298
|
print '>> '
|
308
299
|
response = STDIN.gets.to_s.strip
|
309
|
-
unless response
|
300
|
+
unless response =~ /^[n]$/i
|
310
301
|
puts
|
311
302
|
puts 'Searching ...'
|
312
303
|
if SequenceServer::Database.unformatted_fastas.empty?
|
@@ -321,23 +312,22 @@ MSG
|
|
321
312
|
exit! unless set?
|
322
313
|
end
|
323
314
|
end
|
324
|
-
|
325
315
|
rescue => e
|
326
316
|
# This will catch any unhandled error and some very special errors.
|
327
317
|
# Ideally we will never hit this block. If we do, there's a bug in
|
328
318
|
# SequenceServer or something really weird going on. If we hit this
|
329
319
|
# error block we show the stacktrace to the user requesting them to
|
330
320
|
# post the same to our Google Group.
|
331
|
-
puts
|
332
|
-
Something went wonky
|
321
|
+
puts <<~MSG
|
322
|
+
Something went wonky
|
333
323
|
|
334
|
-
Looks like you have encountered a bug in SequenceServer. Please could you
|
335
|
-
report this incident to our Google Group -
|
336
|
-
https://groups.google.com/forum/?fromgroups#!forum/sequenceserver
|
324
|
+
Looks like you have encountered a bug in SequenceServer. Please could you
|
325
|
+
report this incident to our Google Group -
|
326
|
+
https://groups.google.com/forum/?fromgroups#!forum/sequenceserver
|
337
327
|
|
338
|
-
Error:
|
339
|
-
#{e.backtrace.unshift(e.message).join("\n")}
|
340
|
-
MSG
|
328
|
+
Error:
|
329
|
+
#{e.backtrace.unshift(e.message).join("\n")}
|
330
|
+
MSG
|
341
331
|
exit
|
342
332
|
end
|
343
333
|
|
data/lib/sequenceserver.rb
CHANGED
@@ -16,13 +16,13 @@ require 'sequenceserver/doctor'
|
|
16
16
|
# Top level module / namespace.
|
17
17
|
module SequenceServer
|
18
18
|
# Use a fixed minimum version of BLAST+
|
19
|
-
BLAST_VERSION = '2.6.0+'
|
19
|
+
BLAST_VERSION = '2.6.0+'.freeze
|
20
20
|
|
21
21
|
# Default location of configuration file.
|
22
|
-
DEFAULT_CONFIG_FILE = '~/.sequenceserver.conf'
|
22
|
+
DEFAULT_CONFIG_FILE = '~/.sequenceserver.conf'.freeze
|
23
23
|
|
24
24
|
# Constant for denoting the path ~/.sequenceserver
|
25
|
-
DOTDIR = File.expand_path('~/.sequenceserver')
|
25
|
+
DOTDIR = File.expand_path('~/.sequenceserver').freeze
|
26
26
|
|
27
27
|
class << self
|
28
28
|
def environment
|
@@ -84,15 +84,13 @@ module SequenceServer
|
|
84
84
|
#
|
85
85
|
# Usage:
|
86
86
|
#
|
87
|
-
#
|
88
|
-
#
|
87
|
+
# sys(command, dir: '/path/to/directory', path: '/path/to/directory',
|
88
|
+
# stdout: '/path/to/stdout_file', stderr: '/path/to/stderr_file')
|
89
89
|
#
|
90
|
-
#
|
91
|
-
# :path => '/path/to/directory', :stdout => '/path/to/stdout_file',
|
92
|
-
# :stderr => '/path/to/stderr_file')
|
90
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
93
91
|
def sys(command, options = {})
|
94
92
|
# Available output channels
|
95
|
-
channels = [
|
93
|
+
channels = %i[stdout stderr]
|
96
94
|
|
97
95
|
# Make temporary files to store output from stdout and stderr.
|
98
96
|
temp_files = {
|
@@ -150,6 +148,7 @@ module SequenceServer
|
|
150
148
|
return temp_files.values if status.success?
|
151
149
|
raise CommandFailed.new(status.exitstatus, **temp_files)
|
152
150
|
end
|
151
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
153
152
|
|
154
153
|
# Run SequenceServer as a self-hosted server using Thin webserver.
|
155
154
|
def run
|
@@ -210,7 +209,7 @@ module SequenceServer
|
|
210
209
|
if config[:bin]
|
211
210
|
config[:bin] = File.expand_path config[:bin]
|
212
211
|
unless File.exist?(config[:bin]) && File.directory?(config[:bin])
|
213
|
-
fail ENOENT.new(
|
212
|
+
fail ENOENT.new('bin dir', config[:bin])
|
214
213
|
end
|
215
214
|
logger.debug("Will use NCBI BLAST+ at: #{config[:bin]}")
|
216
215
|
else
|
@@ -227,7 +226,7 @@ module SequenceServer
|
|
227
226
|
config[:database_dir] = File.expand_path(config[:database_dir])
|
228
227
|
unless File.exist?(config[:database_dir]) &&
|
229
228
|
File.directory?(config[:database_dir])
|
230
|
-
fail ENOENT.new(
|
229
|
+
fail ENOENT.new('database dir', config[:database_dir])
|
231
230
|
end
|
232
231
|
|
233
232
|
logger.debug("Will use BLAST+ databases at: #{config[:database_dir]}")
|
@@ -240,13 +239,12 @@ module SequenceServer
|
|
240
239
|
|
241
240
|
def check_num_threads
|
242
241
|
num_threads = Integer(config[:num_threads])
|
243
|
-
fail NUM_THREADS_INCORRECT unless num_threads
|
244
|
-
|
242
|
+
fail NUM_THREADS_INCORRECT unless num_threads.positive?
|
245
243
|
logger.debug "Will use #{num_threads} threads to run BLAST."
|
246
244
|
if num_threads > 256
|
247
245
|
logger.warn "Number of threads set at #{num_threads} is unusually high."
|
248
246
|
end
|
249
|
-
rescue
|
247
|
+
rescue ArgumentError
|
250
248
|
raise NUM_THREADS_INCORRECT
|
251
249
|
end
|
252
250
|
|
@@ -265,7 +263,7 @@ module SequenceServer
|
|
265
263
|
|
266
264
|
config[:require] = File.expand_path config[:require]
|
267
265
|
unless File.exist?(config[:require]) && File.file?(config[:require])
|
268
|
-
fail ENOENT.new(
|
266
|
+
fail ENOENT.new('extension file', config[:require])
|
269
267
|
end
|
270
268
|
|
271
269
|
logger.debug("Loading extension: #{config[:require]}")
|
@@ -274,8 +272,8 @@ module SequenceServer
|
|
274
272
|
|
275
273
|
def assert_blast_installed_and_compatible
|
276
274
|
begin
|
277
|
-
|
278
|
-
rescue
|
275
|
+
out, = sys('blastdbcmd -version', path: config[:bin])
|
276
|
+
rescue CommandFailed
|
279
277
|
fail BLAST_NOT_INSTALLED_OR_NOT_EXECUTABLE
|
280
278
|
end
|
281
279
|
version = out.split[1]
|
@@ -285,13 +283,16 @@ module SequenceServer
|
|
285
283
|
|
286
284
|
def server_url
|
287
285
|
host = config[:host]
|
288
|
-
host = 'localhost' if
|
286
|
+
host = 'localhost' if ['127.0.0.1', '0.0.0.0'].include?(host)
|
289
287
|
"http://#{host}:#{config[:port]}"
|
290
288
|
end
|
291
289
|
|
292
290
|
# Uses `open` on Mac or `xdg-open` on Linux to opens the search form in
|
293
291
|
# user's default browser. This function is called when SequenceServer
|
294
292
|
# is launched from the terminal. Errors, if any, are silenced.
|
293
|
+
#
|
294
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Style/RescueStandardError,
|
295
|
+
# Lint/HandleExceptions
|
295
296
|
def open_in_browser(server_url)
|
296
297
|
return if using_ssh? || verbose?
|
297
298
|
if RUBY_PLATFORM =~ /linux/ && xdg?
|
@@ -302,6 +303,8 @@ module SequenceServer
|
|
302
303
|
rescue
|
303
304
|
# fail silently
|
304
305
|
end
|
306
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Style/RescueStandardError,
|
307
|
+
# Lint/HandleExceptions
|
305
308
|
|
306
309
|
def using_ssh?
|
307
310
|
true if ENV['SSH_CLIENT'] || ENV['SSH_TTY'] || ENV['SSH_CONNECTION']
|