Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement profiles in sheds section of the ~/.planemo.yml. #314

Merged
merged 1 commit into from Oct 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/.planemo.yml
Expand Up @@ -8,7 +8,6 @@
# password: <password>

sheds:
username: "<TODO>"
# For each Tool Shed you wish to target enter the API key
# or both email and password.
toolshed:
Expand All @@ -23,3 +22,8 @@ sheds:
key: "<TODO>"
#email: "<TODO>"
#password: "<TODO>"
custom_shed:
key: "<TODO>"
url: "http://customurl/"
#email: "<TODO>"
#password: "<TODO>"
6 changes: 3 additions & 3 deletions planemo/commands/cmd_shed_create.py
Expand Up @@ -18,12 +18,12 @@
def cli(ctx, paths, **kwds):
"""Create a repository in a Galaxy Tool Shed from a ``.shed.yml`` file.
"""
tsi = shed.tool_shed_client(ctx, **kwds)
shed_context = shed.get_shed_context(ctx, **kwds)

def create(realized_repository):
repo_id = realized_repository.find_repository_id(ctx, tsi)
repo_id = realized_repository.find_repository_id(ctx, shed_context)
if repo_id is None:
if realized_repository.create(ctx, tsi):
if realized_repository.create(ctx, shed_context):
info("Repository created")
if not kwds["skip_upload"]:
return shed.upload_repository(
Expand Down
4 changes: 2 additions & 2 deletions planemo/commands/cmd_shed_download.py
Expand Up @@ -33,10 +33,10 @@ def cli(ctx, paths, **kwds):
"""Download a tool repository as a tarball from the tool shed and extract
to the specified directory.
"""
tsi = shed.tool_shed_client(ctx, read_only=True, **kwds)
shed_context = shed.get_shed_context(ctx, read_only=True, **kwds)

def download(realized_repository):
return shed.download_tarball(ctx, tsi, realized_repository, **kwds)
return shed.download_tarball(ctx, shed_context, realized_repository, **kwds)

exit_code = shed.for_each_repository(ctx, download, paths, **kwds)
sys.exit(exit_code)
6 changes: 3 additions & 3 deletions planemo/commands/cmd_shed_update.py
Expand Up @@ -49,7 +49,7 @@ def cli(ctx, paths, **kwds):
The lower-level ``shed_upload`` command should be used instead if
the repository doesn't define complete metadata in a ``.shed.yml``.
"""
tsi = shed.tool_shed_client(ctx, **kwds)
shed_context = shed.get_shed_context(ctx, **kwds)

def update(realized_repository):
upload_ret_code = 0
Expand All @@ -63,10 +63,10 @@ def update(realized_repository):
error("Failed to update repository it does not exist "
"in target ToolShed.")
return upload_ret_code
repo_id = realized_repository.find_repository_id(ctx, tsi)
repo_id = realized_repository.find_repository_id(ctx, shed_context)
metadata_ok = True
if not kwds["skip_metadata"]:
metadata_ok = realized_repository.update(ctx, tsi, repo_id)
metadata_ok = realized_repository.update(ctx, shed_context, repo_id)
if metadata_ok:
info("Repository metadata updated.")
else:
Expand Down
6 changes: 3 additions & 3 deletions planemo/galaxy_config.py
Expand Up @@ -133,7 +133,7 @@ def config_join(*args):
database_location = config_join("galaxy.sqlite")
shed_tools_path = config_join("shed_tools")
sheds_config_path = _configure_sheds_config_file(
config_directory, **kwds
ctx, config_directory, **kwds
)
preseeded_database = True
master_api_key = kwds.get("master_api_key", "test_key")
Expand Down Expand Up @@ -450,11 +450,11 @@ def _search_tool_path_for(path, target, extra_paths=[]):
return None


def _configure_sheds_config_file(config_directory, **kwds):
def _configure_sheds_config_file(ctx, config_directory, **kwds):
if "shed_target" not in kwds:
kwds = kwds.copy()
kwds["shed_target"] = "toolshed"
shed_target_url = tool_shed_url(kwds)
shed_target_url = tool_shed_url(ctx, **kwds)
contents = _sub(TOOL_SHEDS_CONF, {"shed_target_url": shed_target_url})
tool_sheds_conf = os.path.join(config_directory, "tool_sheds_conf.xml")
write_file(tool_sheds_conf, contents)
Expand Down
4 changes: 2 additions & 2 deletions planemo/options.py
Expand Up @@ -311,8 +311,8 @@ def shed_target_option():
"-t",
"--shed_target",
help="Tool Shed to target (this can be 'toolshed', 'testtoolshed', "
"'local' (alias for http://localhost:9009/) or an arbitrary"
"url).",
"'local' (alias for http://localhost:9009/), an arbitrary url "
"or mappings defined ~/.planemo.yml.",
default=None,
callback=validate_shed_target_callback,
)
Expand Down