Skip to content

Commit

Permalink
Merge pull request #2 from ogdch/develop
Browse files Browse the repository at this point in the history
Release 1.0.1
  • Loading branch information
metaodi committed Feb 20, 2014
2 parents 66cc609 + 46e9631 commit 300ffc1
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: python

python:
- '2.7'

install: pip install -r pip-requirements.txt

script: ./build.sh
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ python setup.py develop
```

Make sure to add `ogdch_actions` to `ckan.plugins` in your config file.

### For development
* install the `pre-commit.sh` script as a pre-commit hook in your local repositories:
** `ln -s ../../pre-commit.sh .git/hooks/pre-commit`

15 changes: 15 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

function cleanup {
exit $?
}

trap "cleanup" EXIT

# Check PEP-8 code style and McCabe complexity
flake8 --show-pep8 --show-source ckanext

# run tests
# nosetests --verbose
2 changes: 1 addition & 1 deletion ckanext/ogdch_actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__path__ = pkgutil.extend_path(__path__, __name__)
9 changes: 5 additions & 4 deletions ckanext/ogdch_actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
_group_list_dictize = ckan.lib.dictization.model_dictize.group_list_dictize
_select = sqlalchemy.sql.select


class OGDActions(p.SingletonPlugin):
p.implements(p.IActions)

Expand Down Expand Up @@ -69,8 +70,8 @@ def group_list_translated(self, context, data_dict):
is_org = group_type == 'organization'

query = model.Session.query(model.Group).join(model.GroupRevision)
query = query.filter(model.GroupRevision.state=='active')
query = query.filter(model.GroupRevision.is_organization==is_org)
query = query.filter(model.GroupRevision.state == 'active')
query = query.filter(model.GroupRevision.is_organization == is_org)

orgs = query.all()

Expand All @@ -90,7 +91,7 @@ def dataset_count(self, context, data_dict):
model = context['model']

query = model.Session.query(model.Package)
query = query.filter(model.Package.state=='active')
query = query.filter(model.Package.type=='dataset')
query = query.filter(model.Package.state == 'active')
query = query.filter(model.Package.type == 'dataset')

return {'count': query.count()}
5 changes: 5 additions & 0 deletions pip-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file lists the dependencies of this extension.
# Install with a command like: pip install -r pip-requirements.txt
boto==2.9.8
xlrd==0.9.2
flake8==2.1.0
26 changes: 26 additions & 0 deletions pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

function cleanup {
if [[ $? > 0 ]] ; then
echo "You might want to run 'git stash pop' in order to get your files back"
fi
}

trap "cleanup" EXIT

FILENAME=$0
if [ -h $FILENAME ] ; then
FILENAME=`readlink -e $FILENAME`
fi
DIR=`dirname $FILENAME`

# make sure only changes of the current commit are affected
git stash -q -u --keep-index

flake8 ckanext

exit_code=$?

git stash pop -q

exit $exit_code
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[flake8]

0 comments on commit 300ffc1

Please sign in to comment.