Skip to content

Commit

Permalink
Cleanup, little bit more, for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
f-osorio committed Sep 27, 2019
1 parent 1f47328 commit 259ba2a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
13 changes: 7 additions & 6 deletions ckan/cli/generate.py
Expand Up @@ -15,10 +15,10 @@ def generate():
@generate.command(name=u'extension', short_help=u"Create empty extension.")
@click.option(u'-n', u'--name', help=u"Name of the extension (must begin "
u"with 'ckanext-')",
default="extension")
default="extension")
@click.option(u'-o', u'--output-dir', help=u"Location to put the generated "
u"template.",
default='.')
default='.')
def extension(name, output_dir):
cur_loc = os.path.dirname(os.path.abspath(__file__))
os.chdir(cur_loc)
Expand All @@ -31,9 +31,9 @@ def extension(name, output_dir):
email = click.prompt("Author's email", default="")
github = click.prompt("Your Github user or organization name", default="")
description = click.prompt("Brief description of the project",
default="")
default="")
keywords = click.prompt("List of keywords (seperated by spaces)",
default="CKAN")
default="CKAN")

# Ensure one instance of 'CKAN' in keywords
keywords = keywords.strip().split()
Expand All @@ -44,7 +44,7 @@ def extension(name, output_dir):

# Set short name and plugin class name
project_shortname = name[8:].lower().replace('-', '_')
plugin_class_name = project_shortname.title().replace('_','') + 'Plugin'
plugin_class_name = project_shortname.title().replace('_', '') + 'Plugin'

context = {"project": name,
"description": description,
Expand All @@ -59,5 +59,6 @@ def extension(name, output_dir):
if output_dir == '.':
os.chdir('../../../..')
output_dir = os.getcwd()

cookiecutter(template_loc, no_input=True, extra_context=context,
output_dir=output_dir)
output_dir=output_dir)
8 changes: 7 additions & 1 deletion ckan/tests/legacy/test_coding_standards.py
Expand Up @@ -481,8 +481,14 @@ class TestPep8(object):
'setup.py',
'ckan/tests/legacy/models/test_resource.py',
'ckan/tests/legacy/models/test_revision.py',
'ckan/contrib/cookiecutter/ckan_extension/'\
'contrib/cookiecutter/ckan_extension/'
'{{cookiecutter.project}}/setup.py',
'contrib/cookiecutter/ckan_extension/hooks/post_gen_project.py',
'contrib/cookiecutter/ckan_extension/'
'{{cookiecutter.project}}/ckanext/{{cookiecutter.project_shortname}}'
'/tests/test_plugin.py',
'contrib/cookiecutter/ckan_extension/{{cookiecutter.project}}'
'/ckanext/{{cookiecutter.project_shortname}}/plugin.py'
]
fails = {}
passes = []
Expand Down
Expand Up @@ -8,7 +8,7 @@ def validate_project_name():
project_name = "{{ cookiecutter.project }}"
if not project_name.startswith('ckanext-'):
print("\nERROR: Project name must start with 'ckanext-' > {}"
.format(project_name))
.format(project_name))
sys.exit(1)


Expand Down

0 comments on commit 259ba2a

Please sign in to comment.