# HG changeset patch # User Peter Sanchez # Date 1417393073 28800 # Sun Nov 30 16:17:53 2014 -0800 # Node ID b9bace094db312f8ee1b679195d52568bb02054d # Parent 3000efb6284fafdbd9fabc72327752a549d60e98 Ready for initial beta release I believe... diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -1,15 +1,17 @@ ==================== django-trello-broker ==================== -:Info: Django app to integrate BitBucket and Trello +:Info: Django app to integrate BitBucket POST hooks and Trello boards :Version: 0.1 -:Author: Netlandish Inc. (http://www.netlandish.com) +:Author: Peter Sanchez - Netlandish Inc. (http://www.netlandish.com) Dependencies ============ * Python 2.7+ * Django 1.7+ +* trello 0.9.1+ +* requests 2.2.1+ Installation @@ -32,7 +34,101 @@ Usage ===== -ADD DOCS +#. Add 'trello_broker' to your INSTALLED_APPS + +#. Add 'trello_broker.urls' somewhere in your url structure. Example:: + + urlpatterns = patterns('', + url(r'^admin/', include(admin.site.urls)), + url(r'^broker', include('trello_broker.urls')), + ... (all your other urls here) ... + ) + +#. Add at least 1 Trello Token to the database. Example:: + + $ ./manage.py add_trello_token + Enter your Trello applications name. + + App Name: Netlandish Bot + + Enter your Trello user API Key. You can get it from: + + https://trello.com/1/appKey/generate + + API Key: + + Go to the following URL to get your API Token: + + https://trello.com/1/authorize?key=&name=Netlandish+Bot&expiration=never&response_type=token&scope=read,write + + API Token: + Saved token (ID: 1) to the database. + +#. Now you can automatically populate all Trello boards the new token has access to. Example:: + + $ ./manage.py populate_trello_boards + Processing token Netlandish Bot + Processing board BracketWire Development + Processing board Bracketwire Planning + Processing board CHAP Development + Processing board CHAP Planning + Processing board CartFreak Development + Processing board CartFreak Planning + ....... + +#. Go to http://yourdomain.com/admin/ (or your admin URL) and add BitBucket Repositories. After saving you'll be able to add a new "Rule". Once you save that rule, you'll be able to add another. Currently there are only 2 rules allowed. "Referenced" and "Fixes / Closes". + + **Referenced** + When a card has been referenced in a commit message, this rule will be triggered. + + Example + Simply using "#" works. For instance, "Starting working on new feature for #213" + + + **Fixes / Closes** + When a card has been referenced in a commit message but also uses a "fix" or "close" prefix + + Example: + One of the following words following by the card short ID. Words are "fix(ed|es)" or "close(d|s)". This is case insensitive. For instance, "Finished work for new feature. Closes #213" + + .. image:: http://all-media.s3.amazonaws.com/images/broker_admin.png + :align: center + :width: 1000px + :height: 575px + :target: http://all-media.s3.amazonaws.com/images/broker_admin.png + +#. Add the post hook to your BitBucket repository settings. See `BitBucket POST +Hook Management `_ + + *Note* Be sure to include the access_key if you stored one in your BitBucket Repo in the Django Admin. For instance, if you used "foobar" as your access key in Django admin, in the BitBucket settings you need to pass in the access key like so: http://yourdomain.com/broker/?access_key=foobar + + +Settings +======== + +There are a few settings that the application supports. + +#. TRELLO_BROKER_USE_CELERY - Defaults to False. If True, the broker processor will use the celery task "celery_process_commits" which is simply a wrapper for the normal "process_commits" function to run via your celery setup. + +#. TRELLO_BROKER_RESTRICT_IPS - Defaults to False. If True, the broker will check that the client sending the request comes from the specified BitBucket broker servers. See: `BitBucket IP List Here `_ + +#. TRELLO_BROKER_BITBUCKET_IPS - A list of client IP's that are allowed to POST to the broker. Default's to :: + + ['131.103.20.165', '131.103.20.166'] + + This setting depends on TRELLO_BROKER_RESTRICT_IPS being set to True + + +Admin Actions +============= + +Also included is a simple Admin Action that makes it easy for you to re-populate one, or many, of your Trello boards via the Admin list page. Just select the boards you want to update, select the action, hit "Go". + + .. image:: http://all-media.s3.amazonaws.com/images/broker_actions.png + :align: center + :width: 1000px + :height: 229px + :target: http://all-media.s3.amazonaws.com/images/broker_actions.png ================== Commercial Support diff --git a/trello_broker/__init__.py b/trello_broker/__init__.py --- a/trello_broker/__init__.py +++ b/trello_broker/__init__.py @@ -1,4 +1,4 @@ -VERSION = (0, 1, 0, 'alpha', 0) +VERSION = (0, 1, 0, 'beta', 0) # taken from django-registration diff --git a/trello_broker/management/commands/add_trello_token.py b/trello_broker/management/commands/add_trello_token.py --- a/trello_broker/management/commands/add_trello_token.py +++ b/trello_broker/management/commands/add_trello_token.py @@ -10,14 +10,14 @@ print('Enter your Trello applications name.\n') app_name = raw_input('App Name: ') print( - 'Enter your Trello user API Key. You can get it from:\n\n' + '\nEnter your Trello user API Key. You can get it from:\n\n' 'https://trello.com/1/appKey/generate\n' ) api_key = raw_input('API Key: ') client = trello.TrelloApi(api_key) url = client.get_token_url(app_name, expires='never') print( - 'Go to the following URL to get your API Token:\n\n' + '\nGo to the following URL to get your API Token:\n\n' '{0}\n'.format(url) ) api_token = raw_input('API Token: ')