Skip to content

Commit

Permalink
Rename command file and make init a command
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Oderbolz committed May 18, 2016
1 parent e482cc4 commit cabb81e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
from ckan.lib.munge import munge_title_to_name, substitute_ascii_equivalents
from ckan.logic import get_action

from ckanext.showcase.model import setup as model_setup


import logging
log = logging.getLogger(__name__)


class MigrationCommand(CkanCommand):
class ShowcaseCommand(CkanCommand):
'''
CKAN 'Related Items' to 'Showcase' migration command.
Commands for showcase extension
Usage::
paster showcase init -c <path to config file>
- Initialize the extension, create tables
paster showcase migrate -c <path to config file>
- Migrate Related Items to Showcases
Expand All @@ -35,11 +40,15 @@ def command(self):

if cmd == 'migrate':
self.migrate()
elif cmd == 'make_related':
self.make_related()
elif cmd == 'init':
self.init()
else:
print('Command "{0}" not recognized'.format(cmd))

def init(self):
print "Setup all tables"
model_setup()

def migrate(self):
'''
Expand Down
7 changes: 0 additions & 7 deletions ckanext/showcase/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import ckanext.showcase.logic.action.get
import ckanext.showcase.logic.schema as showcase_schema
import ckanext.showcase.logic.helpers as showcase_helpers
from ckanext.showcase.model import setup as model_setup

c = tk.c
_ = tk._
Expand All @@ -29,7 +28,6 @@


class ShowcasePlugin(plugins.SingletonPlugin, lib_plugins.DefaultDatasetForm):
plugins.implements(plugins.IConfigurable)
plugins.implements(plugins.IConfigurer)
plugins.implements(plugins.IDatasetForm)
plugins.implements(plugins.IFacets, inherit=True)
Expand All @@ -54,11 +52,6 @@ def update_config(self, config):
tk.add_ckan_admin_tab(config, 'ckanext_showcase_admins',
'Showcase Config')

# IConfigurable

def configure(self, config):
model_setup()

# IDatasetForm

def package_types(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
ckan = ckan.lib.extract:extract_ckan
[paste.paster_command]
showcase=ckanext.showcase.commands.migrate:MigrationCommand
showcase=ckanext.showcase.commands.showcase:ShowcaseCommand
''',

message_extractors={
Expand Down

0 comments on commit cabb81e

Please sign in to comment.