-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #480 from jmchilton/profile_commands
Introduce profile commands and improved profiles.
- Loading branch information
Showing
13 changed files
with
273 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Module describing the planemo ``profile_create`` command.""" | ||
from __future__ import print_function | ||
|
||
import click | ||
|
||
from planemo.cli import command_function | ||
from planemo import options | ||
from planemo.galaxy import profiles | ||
|
||
|
||
@click.command('profile_create') | ||
@options.profile_name_argument() | ||
@options.profile_database_options() | ||
@command_function | ||
def cli(ctx, profile_name, **kwds): | ||
"""Create a profile.""" | ||
profiles.create_profile(ctx, profile_name, **kwds) | ||
print("Profile created.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Module describing the planemo ``profile_delete`` command.""" | ||
from __future__ import print_function | ||
|
||
import click | ||
|
||
from planemo.cli import command_function | ||
from planemo import options | ||
from planemo.galaxy import profiles | ||
|
||
|
||
@click.command('profile_delete') | ||
@options.profile_name_argument() | ||
@options.profile_database_options() | ||
@command_function | ||
def cli(ctx, profile_name, **kwds): | ||
"""Delete a profile.""" | ||
profiles.delete_profile(ctx, profile_name, **kwds) | ||
print("Profile deleted.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""Module describing the planemo ``profile_list`` command.""" | ||
from __future__ import print_function | ||
|
||
import click | ||
|
||
from planemo.cli import command_function | ||
from planemo.galaxy import profiles | ||
|
||
|
||
@click.command('profile_list') | ||
@command_function | ||
def cli(ctx, **kwds): | ||
"""List configured profile names.""" | ||
profile_names = profiles.list_profiles(ctx, **kwds) | ||
print(profile_names) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Module describes an sqlite implementation of the :class:`DatabaseSource` interface.""" | ||
import os | ||
|
||
from .interface import DatabaseSource | ||
|
||
from .config import ( | ||
DATABASE_LOCATION_TEMPLATE, | ||
attempt_database_preseed, | ||
) | ||
|
||
|
||
class SqliteDatabaseSource(DatabaseSource): | ||
""":class:`DatabaseSource` implementation for creating sqlite databases.""" | ||
|
||
def __init__(self, **kwds): | ||
"""Construct a sqlite database source from planemo configuration.""" | ||
self.sqlite_path = kwds.get("sqlite_path", None) or 'psql' | ||
self._kwds = kwds | ||
|
||
def list_databases(self): | ||
"""List sqlite databases on a path.""" | ||
return os.path.basename(self.sqlite_path) | ||
|
||
def create_database(self, identifier): | ||
"""Create pre-populated Galxay sqlite database with specified path.""" | ||
return os.path.basename(self.sqlite_path) | ||
|
||
def delete_database(self, identifier): | ||
"""Use `psql -c "drop database"` to delete a database.""" | ||
|
||
def sqlalchemy_url(self, identifier): | ||
"""Return URL or form postgresql://username:password@localhost/mydatabase.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.