diff --git a/README.rst b/README.rst index 7aba554c..0179ab02 100644 --- a/README.rst +++ b/README.rst @@ -52,11 +52,15 @@ To install ckanext-showcase: pip install ckanext-showcase -3. Add ``showcase`` to the ``ckan.plugins`` setting in your CKAN +3. Run the ``init`` command to initialize the plugin and make all necessary changes to the database:: + + paster --plugin=ckanext-showcase showcase init -c {path to production.ini} + +4. Add ``showcase`` to the ``ckan.plugins`` setting in your CKAN config file (by default the config file is located at ``/etc/ckan/default/production.ini``). -4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:: +5. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:: sudo service apache2 reload diff --git a/bin/travis-build.bash b/bin/travis-build.bash index b16046a0..dd169c7f 100644 --- a/bin/travis-build.bash +++ b/bin/travis-build.bash @@ -27,6 +27,7 @@ cd - echo "Installing ckanext-showcase and its requirements..." python setup.py develop +paster showcase init -c ckan/test-core.ini pip install -r dev-requirements.txt echo "Moving test.ini into a subdir..." diff --git a/ckanext/showcase/commands/migrate.py b/ckanext/showcase/commands/showcase.py similarity index 92% rename from ckanext/showcase/commands/migrate.py rename to ckanext/showcase/commands/showcase.py index 8c2fcd84..836755a6 100644 --- a/ckanext/showcase/commands/migrate.py +++ b/ckanext/showcase/commands/showcase.py @@ -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 + - Initialize the extension, create tables + paster showcase migrate -c - Migrate Related Items to Showcases @@ -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): ''' diff --git a/ckanext/showcase/plugin.py b/ckanext/showcase/plugin.py index c7d55d99..82c7da53 100644 --- a/ckanext/showcase/plugin.py +++ b/ckanext/showcase/plugin.py @@ -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._ @@ -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) @@ -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): diff --git a/setup.py b/setup.py index 6bef633d..6eee12c3 100644 --- a/setup.py +++ b/setup.py @@ -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={