-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
clone
and pull_request
commands to ease PRs.
My vision of #477. ``` $ planemo clone --branch bwa-fix tools-iuc $ cd tools-iuc $ # Make changes. $ git add -p # Add desired changes. $ git commit -m "Fix bwa problem." $ planemo pull_request -m "Fix bwa problem." ``` I don't know about this - part of me likes it because the tutorials can be so clean and so complete, but part of me thinks it obsecures important things developers need to know to be effective. I think regardless it is solid library functionality to add - potentially useful for things like bioconda recipes and the Bioconductor work.
- Loading branch information
Showing
10 changed files
with
286 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"""Module describing the planemo ``recipe_init`` command.""" | ||
import click | ||
|
||
from planemo import github_util | ||
from planemo import options | ||
from planemo.cli import command_function | ||
from planemo.config import planemo_option | ||
|
||
|
||
CLONE_GITHUB_TARGETS = { | ||
"tools-iuc": "galaxyproject/tools-iuc", | ||
"tools-devteam": "galaxyproject/tools-devteam", | ||
"galaxy": "galaxyproject/galaxy", | ||
"planemo": "galaxyproject/planemo", | ||
"tools-galaxyp": "galaxyproteomics/tools-galaxyp", | ||
"bioconda-recipes": "bioconda/bioconda-recipes", | ||
"homebrew-science": "Homebrew/homebrew-science", | ||
"workflows": "common-workflow-language/workflows", | ||
} | ||
|
||
|
||
def clone_target_arg(): | ||
"""Represent target to clone/branch.""" | ||
return click.argument( | ||
"target", | ||
metavar="TARGET", | ||
type=click.STRING, | ||
) | ||
|
||
|
||
@click.command('clone') | ||
@planemo_option( | ||
"--fork/--skip_fork", | ||
default=True, | ||
is_flag=True, | ||
) | ||
@planemo_option( | ||
"--branch", | ||
type=click.STRING, | ||
default=None, | ||
help="Create a named branch on result." | ||
) | ||
@clone_target_arg() | ||
@options.optional_project_arg(exists=None, default="__NONE__") | ||
@command_function | ||
def cli(ctx, target, path, **kwds): | ||
"""Short-cut to quickly clone, fork, and branch a relevant Github repo. | ||
For instance, the following will clone, fork, and branch the tools-iuc | ||
repository to allow a subsequent pull request to fix a problem with bwa. | ||
:: | ||
$ planemo clone --branch bwa-fix tools-iuc | ||
$ cd tools-iuc | ||
$ # Make changes. | ||
$ git add -p # Add desired changes. | ||
$ git commit -m "Fix bwa problem." | ||
$ planemo pull_request -m "Fix bwa problem." | ||
These changes do require that a github username and password are | ||
specified in ~/.planemo.yml. | ||
""" | ||
if target in CLONE_GITHUB_TARGETS: | ||
target = "https://github.com/%s" % CLONE_GITHUB_TARGETS[target] | ||
# Pretty hacky that this path isn't treated as None. | ||
if path is None or path.endswith("__NONE__"): | ||
path = target.split("/")[-1] | ||
github_util.clone_fork_branch(ctx, target, path, **kwds) |
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,38 @@ | ||
"""Module describing the planemo ``recipe_init`` command.""" | ||
import click | ||
|
||
from planemo import github_util | ||
from planemo import options | ||
from planemo.cli import command_function | ||
from planemo.config import planemo_option | ||
|
||
|
||
@click.command('pull_request') | ||
@planemo_option( | ||
"-m", | ||
"--message", | ||
type=click.STRING, | ||
default=None, | ||
help="Message describing the pull request to create." | ||
) | ||
@options.optional_project_arg(exists=None) | ||
@command_function | ||
def cli(ctx, path, message=None, **kwds): | ||
"""Short-cut to quickly create a pull request for a relevant Github repo. | ||
For instance, the following will clone, fork, and branch the tools-iuc | ||
repository to allow this pull request to issues against the repository. | ||
:: | ||
$ planemo clone --branch bwa-fix tools-iuc | ||
$ cd tools-iuc | ||
$ # Make changes. | ||
$ git add -p # Add desired changes. | ||
$ git commit -m "Fix bwa problem." | ||
$ planemo pull_request -m "Fix bwa problem." | ||
These changes do require that a github username and password are | ||
specified in ~/.planemo.yml. | ||
""" | ||
github_util.pull_request(ctx, path, message=message, **kwds) |
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.