Bring database_formatter under SequenceServer namespace.

And re-indent the code and strip trailing whitespaces.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Ensure tempfile for the query sequence is not GCed before BLAST search is over

or the search would sometimes unpredictably fail for the users with an
`Errno::ENOENT`.

Close #95 which suggested another work-around to the "missing query file"
problem.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Invoke bundler setup before parsing CLI options

or `sequenceserver format-databases` fails:

`cannot load such file -- sequenceserver/database_formatter (LoadError)`

In any case, the application should be fully bootstrapped before it attempts to
perform any operation.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Fix error message issued by database_formatter if the databases directory ...

... couldn't be found (close #102).

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
update format-databases help english

Signed-off-by: Ben J Woodcroft <donttrustben@gmail.com>
Fix typo in database formatting

[ap: rebase over next]

Signed-off-by: Ben J Woodcroft <donttrustben@gmail.com>
Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Revert "Add a switch to start SequenceServer in development mode."

This reverts commit 149b5da4357b48c91253d0fe01f5878802755ed4.

Being able to switch environment through a CLI switch requires that
`sequenceserver.rb` be loaded after CLI options have been processed.
However, existing options require `sequenceserver.rb` to be loaded
before CLI options have been processed.  So, let's put the new guy
on hold for now.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Default to running SequenceServer in development mode (reopen #94).

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Require 'sequenceserver.rb' before parsing CLI options.

This used to be the case till 5d88ea3bc970d98e6541f3081da57e946f76f7e1 which
broke processing of CLI options.  Let's make the CLI options happy.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
port should be specified through -p (or --port) command line option

So config file now contains BLAST specific settings only.  Whereas, port was
meant for the self hosting server.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Fix warnings raised by ruby interpreter for sequenceserver.rb.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Settings derived from configuration file are now local to an App object.

One process should be able to run multiple SS instances now.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
SequenceServer::App is not self-hosting anymore.

SequenceServer::App was trying to do too much.  Starting a server,
for sure, is not its responsibility.  Moved that bit of functionality
out to bin/sequenceserver.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Update gemspec to include Rack.

We use `Rack::Handler.default` now to pick a Rack handler instead of
(overriding) `Sinatra::Base.run!`.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Ensure -p and -c CLI options are passed an acceptable value.

If not, nudge the user and exit early.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Fix reverse-proxy deployment quirks.

Instruct `Sinatra::Base#uri` to generate URIs taking only `SCRIPT_NAME` into
account, i.e. use absolute path to the asset relative to the server name.
Previously SS would prefix the server name to the path too.  However, depending
on how SS is deployed, using absolute URIs, including server name, for assets
may or may not work.  And even if it does, not a good strategy in my opinion.
For example, if one has SS running on localhost:4567 (default) an example asset
URI would be 'http://127.0.0.1:4567/css/sequenceserver.css'.  This will fail
for public SS installations.  One could use public IP of her server, then the
same asset URI might look like
'http://130.223.48.66:4567/css/sequenceserver.css'.  Now port 4567 must be
open for this to work.  And so on.  Using absolute path relative to server
name works and looks to me like it would work on most setup without hassle.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Remove index generation for multi-query blast search (closes #106).

God knows why index generation was causing results div to be deleted on Chrome.
No point having an index if one can't view the results, so removing the feature
for now.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Revert "Print version number on `sequenceserver -v`."

This reverts commit f1aabea17873fa88f57a94a6cc246f7c674c272d.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Revert "config.ru: setup application environment with Bundler"

This reverts commit 41fae46721bad07ba406b2ce03d427ae51ba2b8d.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Do not use 'bundler/setup' in bin/sequenceserver.

While the executable will work perfectly when SequuenceServer is installed as a
RubyGem, running bin/sequenceserver from the repository can fail:

1. If 'sequenceserver' gem is installed, the executable will load the installed
   gem if RubyGems is loaded instead of loading SequenceServer from the
   repository.
2. If 'sequenceserver' gem isn't installed or RubyGems isn't loaded, the
   executable will fail with a stack trace.

To avoid either just `bundle exec bin/sequenceserver` during development or
when trying to use SequenceServer from git.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>