Skip to content

Commit

Permalink
[#5079] use cookiecutter only as extension template engine
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Nov 21, 2019
1 parent 5b880ca commit c16531e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ckan/cli/generate.py
Expand Up @@ -4,20 +4,29 @@
import sys
import click
from ckan.cli import error_shout
from cookiecutter.main import cookiecutter


@click.group(name=u'generate',
short_help=u"Generate empty extension files to expand CKAN.")
short_help=u"Generate empty extension files to expand CKAN.",
invoke_without_command=True,
)
def generate():
pass
try:
from cookiecutter.main import cookiecutter
except ImportError:
error_shout(u"`cookiecutter` library is missing from import path.")
error_shout(u"Make sure you have dev-dependencies installed:")
error_shout(u"\tpip install -r dev-requirements.txt")
raise click.Abort()



@generate.command(name=u'extension', short_help=u"Create empty extension.")
@click.option(u'-o', u'--output-dir', help=u"Location to put the generated "
u"template.",
default=u'.')
def extension(output_dir):
from cookiecutter.main import cookiecutter
cur_loc = os.path.dirname(os.path.abspath(__file__))
os.chdir(cur_loc)
os.chdir(u'../../contrib/cookiecutter/ckan_extension/')
Expand Down

0 comments on commit c16531e

Please sign in to comment.