diff --git a/AUTHORS b/AUTHORS index e69de29..3d17fcf 100644 --- a/AUTHORS +++ b/AUTHORS @@ -0,0 +1,5 @@ +Patrick Altman +Brian Rosner +Anna Ossowski +Seyi Ogunyemi +Graham Ullrich diff --git a/pcli.py b/pcli.py index 80450fa..13a74f4 100644 --- a/pcli.py +++ b/pcli.py @@ -11,6 +11,7 @@ class Config(object): def __init__(self): self.url = "https://raw.githubusercontent.com/pinax/pinax/master/projects.json" + self.apps_url = "https://raw.githubusercontent.com/pinax/pinax/master/distributions.json" pass_config = click.make_pass_decorator(Config, ensure=True) @@ -55,11 +56,14 @@ def cleanup(name): @click.group() @click.option("--url", type=str, required=False, help="url to project data source") +@click.option("--apps_url", type=str, required=False, help="url to application data source") @click.version_option() @pass_config -def main(config, url): +def main(config, url, apps_url): if url: config.url = url + if apps_url: + config.apps_url = apps_url @main.command() @@ -83,6 +87,46 @@ def projects(config): click.echo("The projects manifest you are trying to consume will not work: \n{}".format(config.url)) +def show_distribution_section(config, title, section_name): + """ + Obtain distribution data and display latest distribution section, + i.e. "demos" or "apps" or "themes". + """ + payload = requests.get(config.apps_url).json() + distributions = sorted(payload.keys(), reverse=True) + latest_distribution = payload[distributions[0]] + click.echo("{} {}".format("Release".rjust(7), title)) + click.echo("------- ---------------") + section = latest_distribution[section_name] + names = sorted(section.keys()) + for name in names: + click.echo("{} {}".format(section[name].rjust(7), name)) + + +@main.command() +@pass_config +def apps(config): + show_distribution_section(config, "Application", "apps") + + +@main.command() +@pass_config +def demos(config): + show_distribution_section(config, "Demo", "demos") + + +@main.command() +@pass_config +def themes(config): + show_distribution_section(config, "Theme", "themes") + + +@main.command() +@pass_config +def tools(config): + show_distribution_section(config, "Tool", "tools") + + @main.command() @click.option("--dev", is_flag=True, help="use latest development branch instead of release") @click.argument("project", type=str, required=True) diff --git a/setup.py b/setup.py index 39a1391..59d478c 100644 --- a/setup.py +++ b/setup.py @@ -16,14 +16,14 @@ def read(*parts): description="a command line for Pinax", name="pinax-cli", long_description=read("README.rst"), - version="1.0.0", + version="1.1.0", url="http://github.com/pinax/pinax-cli/", license="MIT", py_modules=["pcli"], install_requires=[ - "Click==5.1", - "requests==2.7.0", - "colorama==0.3.3" + "Click==6.6", + "requests==2.10.0", + "colorama==0.3.7" ], entry_points=""" [console_scripts]