Skip to content

Instantly share code, notes, and snippets.

@keokilee
keokilee / tumblr_helper.py
Created January 18, 2013 20:00
A very limited helper class for working with the Tumblr API. Only includes a posts method and a reblog method.
import json
from urllib import urlencode
from urllib2 import urlopen
from urlparse import parse_qsl
import oauth2 as oauth
ACCESS_TOKEN_URL = 'http://www.tumblr.com/oauth/access_token'
@keokilee
keokilee / selenium_sample.py
Created March 18, 2011 20:46
Sample test.
import time, re
from noseselenium.cases import SeleniumTestCaseMixin
from django.test import TestCase
class sample_test(TestCase, SeleniumTestCaseMixin):
def setUp(self):
self.verificationErrors = []
def test_sample_test(self):
sel = self.selenium
@keokilee
keokilee / cd-reload.sh
Created March 12, 2011 01:50
Reload the code
source ~/Envs/user/bin/activate
cd ~/staging/$BUILD_TAG/
echo "Updating symlink and deploying."
ln -fns ~/staging/$BUILD_TAG ~/staging/makahiki
touch ~/staging/makahiki/deploy/pinax.wsgi
@keokilee
keokilee / update-reqs-db
Created March 12, 2011 01:47
Update the staging server's requirements and its database.
source ~/Envs/user/bin/activate
cd ~/staging/$BUILD_TAG/
echo "Updating requirements and migrating database."
pip install -r requirements.pip -q;
python manage.py syncdb
python manage.py migrate
@keokilee
keokilee / staging-virtualenv.sh
Created March 12, 2011 01:43
Start up the staging virtualenv
echo "Setting up environment."
source ~/Envs/user/bin/activate
rm -rf ~/staging/$BUILD_TAG/.env
echo "Linking settings, db, and files from current."
cp ~/staging/local_settings.py ~/staging/$BUILD_TAG/
cd ~/staging/$BUILD_TAG/
rm -rf site_media
ln -s ~/staging/site_media site_media
@keokilee
keokilee / jenkins-copy.sh
Created March 12, 2011 01:42
Copy to the staging folder
source .env/bin/activate;
echo "Copying to staging."
# Create new folder
mkdir ~/staging/$BUILD_TAG
# Copy files over.
cp -R . ~/staging/$BUILD_TAG/
@keokilee
keokilee / jenkins_cleanup.sh
Created March 12, 2011 01:30
Clean up compiled files.
source .env/bin/activate;
# Clean files to prep for copy
echo "Cleaning local compiled files."
./manage.py clean_pyc
@keokilee
keokilee / jenkins_tests.sh
Created March 12, 2011 00:56
Run the tests in Jenkins and capture code coverage.
source .env/bin/activate;
coverage erase
coverage run --source="apps/,apps/" manage.py test --with-xunit --exe
# generate an xml coverage report
coverage xml -o coverage.xml
# generate html coverage reports
coverage html -d ../../builds/${BUILD_ID}/coverage_html
@keokilee
keokilee / local_settings.sh
Created March 12, 2011 00:50
Set up the local_settings.py for Jenkins.
source .env/bin/activate;
rm local_settings.py
# rename hudson specific file
cp example_settings/local_settings.py.test local_settings.py
echo "local_settings.py replaced with hudson version"
@keokilee
keokilee / jenkins_requirements.sh
Created March 12, 2011 00:47
Update the requirements in .env
source .env/bin/activate;
echo "**> Updating requirements."
pip install -r requirements.pip -q;