Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit f54ab51615d2a6ba7f597f33f49fe41dbe67e10b @peterbe peterbe committed Jul 13, 2012
Showing with 2,433 additions and 0 deletions.
  1. +19 −0 .gitignore
  2. +3 −0 .gitmodules
  3. +25 −0 LICENSE
  4. +2 −0 MANIFEST.in
  5. +10 −0 README.md
  6. +43 −0 Vagrantfile
  7. +28 −0 bin/compile-mo.sh
  8. +20 −0 bin/crontab/crontab.tpl
  9. +42 −0 bin/crontab/gen-crons.py
  10. +69 −0 bin/jenkins.sh
  11. +14 −0 bin/update/commander_settings.py-dist
  12. +139 −0 bin/update/deploy.py
  13. +144 −0 bin/update_site.py
  14. +130 −0 docs/Makefile
  15. 0 docs/_static/.gitkeep
  16. 0 docs/_templates/.gitkeep
  17. +40 −0 docs/build-github.zsh
  18. +220 −0 docs/conf.py
  19. +30 −0 docs/index.rst
  20. +27 −0 manage.py
  21. +1 −0 migrations/01-noop.sql
  22. 0 migrations/__init__.py
  23. 0 mozldap/__init__.py
  24. +1 −0 mozldap/base/__init__.py
  25. +3 −0 mozldap/base/models.py
  26. 0 mozldap/base/templates/.gitignore
  27. +15 −0 mozldap/base/templates/404.html
  28. +15 −0 mozldap/base/templates/500.html
  29. +27 −0 mozldap/base/templates/example_base.html
  30. +42 −0 mozldap/base/tests.py
  31. +14 −0 mozldap/base/urls.py
  32. +88 −0 mozldap/base/views.py
  33. 0 mozldap/examples/__init__.py
  34. +8 −0 mozldap/examples/models.py
  35. +52 −0 mozldap/examples/static/examples/css/main.css
  36. +73 −0 mozldap/examples/static/examples/css/mobile.css
  37. +9 −0 mozldap/examples/static/examples/js/init.js
  38. +167 −0 mozldap/examples/static/examples/js/libs/jquery-1.4.4.min.js
  39. +96 −0 mozldap/examples/static/examples/js/libs/jquery.cookie.js
  40. +36 −0 mozldap/examples/templates/examples/bleach.html
  41. +51 −0 mozldap/examples/templates/examples/home.html
  42. +7 −0 mozldap/examples/templates/examples/mobile/home.html
  43. +12 −0 mozldap/examples/urls.py
  44. +44 −0 mozldap/examples/views.py
  45. +31 −0 mozldap/locale/en_US/LC_MESSAGES/messages.po
  46. +29 −0 mozldap/locale/fr/LC_MESSAGES/messages.po
  47. +32 −0 mozldap/locale/templates/LC_MESSAGES/messages.pot
  48. +6 −0 mozldap/settings/__init__.py
  49. +77 −0 mozldap/settings/base.py
  50. +75 −0 mozldap/settings/base.py.orig
  51. +84 −0 mozldap/settings/local.py-dist
  52. +12 −0 mozldap/urls.py
  53. +30 −0 puppet/files/etc/httpd/conf.d/playdoh.conf
  54. +61 −0 puppet/manifests/classes/apache.pp
  55. +3 −0 puppet/manifests/classes/custom.pp
  56. +25 −0 puppet/manifests/classes/init.pp
  57. +14 −0 puppet/manifests/classes/memcached.pp
  58. +26 −0 puppet/manifests/classes/mysql.pp
  59. +39 −0 puppet/manifests/classes/playdoh.pp
  60. +34 −0 puppet/manifests/classes/python.pp
  61. +29 −0 puppet/manifests/vagrant.pp
  62. +1 −0 requirements/compiled.txt
  63. +11 −0 requirements/dev.txt
  64. +2 −0 requirements/prod.txt
  65. +17 −0 setup.py
  66. +5 −0 vagrantconfig.yaml
  67. +5 −0 vagrantconfig_local.yaml-dist
  68. +1 −0 vendor
  69. 0 vendor-local/vendor.pth
  70. +18 −0 wsgi/playdoh.wsgi
@@ -0,0 +1,19 @@
+settings_local.py
+settings/local.py
+*/settings/local.py
+*.py[co]
+*.sw[po]
+.coverage
+pip-log.txt
+docs/_gh-pages
+build.py
+build
+.DS_Store
+*-min.css
+*-all.css
+*-min.js
+*-all.js
+.noseids
+tmp/*
+*~
+*.mo
@@ -0,0 +1,3 @@
+[submodule "vendor"]
+ path = vendor
+ url = git://github.com/mozilla/playdoh-lib.git
25 LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) 2011, Mozilla
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the copyright owner nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,2 @@
+recursive-include */*/templates *.*
+recursive-include */locale *.*
@@ -0,0 +1,10 @@
+MozLDAP
+=======
+
+This app aims to wrap the Mozilla LDAP so you can ask simple questions
+about users in LDAP by a straight forwards RESTful API.
+
+
+License
+-------
+MPL2
@@ -0,0 +1,43 @@
+require "yaml"
+
+# Load up our vagrant config files -- vagrantconfig.yaml first
+_config = YAML.load(File.open(File.join(File.dirname(__FILE__),
+ "vagrantconfig.yaml"), File::RDONLY).read)
+
+# Local-specific/not-git-managed config -- vagrantconfig_local.yaml
+begin
+ _config.merge!(YAML.load(File.open(File.join(File.dirname(__FILE__),
+ "vagrantconfig_local.yaml"), File::RDONLY).read))
+rescue Errno::ENOENT # No vagrantconfig_local.yaml found -- that's OK; just
+ # use the defaults.
+end
+
+CONF = _config
+MOUNT_POINT = '/home/vagrant/project'
+
+Vagrant::Config.run do |config|
+ config.vm.box = "lucid32"
+ config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
+
+ config.vm.forward_port 8000, 8000
+
+ # Increase vagrant's patience during hang-y CentOS bootup
+ # see: https://github.com/jedi4ever/veewee/issues/14
+ config.ssh.max_tries = 50
+ config.ssh.timeout = 300
+
+ # nfs needs to be explicitly enabled to run.
+ if CONF['nfs'] == false or RUBY_PLATFORM =~ /mswin(32|64)/
+ config.vm.share_folder("v-root", MOUNT_POINT, ".")
+ else
+ config.vm.share_folder("v-root", MOUNT_POINT, ".", :nfs => true)
+ end
+
+ # Add to /etc/hosts: 33.33.33.24 dev.playdoh.org
+ config.vm.network :hostonly, "33.33.33.24"
+
+ config.vm.provision :puppet do |puppet|
+ puppet.manifests_path = "puppet/manifests"
+ puppet.manifest_file = "vagrant.pp"
+ end
+end
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+TARGET=$1
+LOCKFILE="/tmp/compile-mo-${2}.lock"
+
+function usage() {
+ echo "syntax:"
+ echo " compile-mo.sh locale-dir/ [unique]"
+ echo "unique is an optional string that will be used as the name of the lockfile"
+ exit 1
+}
+
+# check if file and dir are there
+if [[ ($# -gt 2) || (! -d "$TARGET") ]]; then usage; fi
+
+# check if the lockfile exists
+if [ -e $LOCKFILE ]; then
+ echo "$LOCKFILE present, exiting"
+ exit 99
+fi
+
+touch $LOCKFILE
+for lang in `find $TARGET -type f -name "*.po"`; do
+ dir=`dirname $lang`
+ stem=`basename $lang .po`
+ msgfmt -o ${dir}/${stem}.mo $lang
+done
+rm $LOCKFILE
@@ -0,0 +1,20 @@
+#
+# {{ header }}
+#
+
+# MAILTO=some-email-list
+
+HOME=/tmp
+
+# Every minute!
+* * * * * {{ cron }}
+
+# Every hour.
+42 * * * * {{ django }} cleanup
+
+# Every 2 hours.
+1 */2 * * * {{ cron }} something
+
+# Etc...
+
+MAILTO=root
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+import os
+from optparse import OptionParser
+
+from jinja2 import Template
+
+
+HEADER = '!!AUTO-GENERATED!! Edit bin/crontab/crontab.tpl instead.'
+TEMPLATE = open(os.path.join(os.path.dirname(__file__), 'crontab.tpl')).read()
+
+
+def main():
+ parser = OptionParser()
+ parser.add_option('-w', '--webapp',
+ help='Location of web app (required)')
+ parser.add_option('-u', '--user',
+ help=('Prefix cron with this user. '
+ 'Only define for cron.d style crontabs.'))
+ parser.add_option('-p', '--python', default='/usr/bin/python2.6',
+ help='Python interpreter to use.')
+
+ (opts, args) = parser.parse_args()
+
+ if not opts.webapp:
+ parser.error('-w must be defined')
+
+ ctx = {'django': 'cd %s; %s manage.py' % (opts.webapp, opts.python)}
+ ctx['cron'] = '%s cron' % ctx['django']
+
+ if opts.user:
+ for k, v in ctx.iteritems():
+ ctx[k] = '%s %s' % (opts.user, v)
+
+ # Needs to stay below the opts.user injection.
+ ctx['python'] = opts.python
+ ctx['header'] = HEADER
+
+ print Template(TEMPLATE).render(**ctx)
+
+
+if __name__ == '__main__':
+ main()
@@ -0,0 +1,69 @@
+#!/bin/sh
+# This script makes sure that Jenkins can properly run your tests against your
+# codebase.
+set -e
+
+DB_HOST="localhost"
+DB_USER="hudson"
+
+cd $WORKSPACE
+VENV=$WORKSPACE/venv
+
+echo "Starting build on executor $EXECUTOR_NUMBER..."
+
+# Make sure there's no old pyc files around.
+find . -name '*.pyc' -exec rm {} \;
+
+if [ ! -d "$VENV/bin" ]; then
+ echo "No virtualenv found. Making one..."
+ virtualenv $VENV --no-site-packages
+ source $VENV/bin/activate
+ pip install --upgrade pip
+ pip install coverage
+fi
+
+git submodule sync -q
+git submodule update --init --recursive
+
+if [ ! -d "$WORKSPACE/vendor" ]; then
+ echo "No /vendor... crap."
+ exit 1
+fi
+
+source $VENV/bin/activate
+pip install -q -r requirements/compiled.txt
+pip install -q -r requirements/dev.txt
+
+cat > settings/local.py <<SETTINGS
+from settings.base import *
+
+ROOT_URLCONF = 'workspace.urls'
+LOG_LEVEL = logging.ERROR
+# Database name has to be set because of sphinx
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.mysql',
+ 'HOST': '${DB_HOST}',
+ 'NAME': '${JOB_NAME}',
+ 'USER': 'hudson',
+ 'PASSWORD': '',
+ 'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
+ 'TEST_NAME': 'test_${JOB_NAME}',
+ 'TEST_CHARSET': 'utf8',
+ 'TEST_COLLATION': 'utf8_general_ci',
+ }
+}
+
+INSTALLED_APPS += ('django_nose',)
+CELERY_ALWAYS_EAGER = True
+SETTINGS
+
+echo "Creating database if we need it..."
+echo "CREATE DATABASE IF NOT EXISTS ${JOB_NAME}"|mysql -u $DB_USER -h $DB_HOST
+
+echo "Starting tests..."
+export FORCE_DB=1
+coverage run manage.py test --noinput --with-xunit
+coverage xml $(find apps lib -name '*.py')
+
+echo "FIN"
@@ -0,0 +1,14 @@
+SRC_DIR = ''
+WWW_DIR = ''
+
+CRON_NAME = ''
+
+DEPLOY_SCRIPT = ''
+REMOTE_UPDATE_SCRIPT = ''
+
+WEB_HOSTGROUP = ''
+CELERY_HOSTGROUP = ''
+CELERY_SERVICE = ''
+
+UPDATE_REF = 'origin/master'
+SSH_KEY = None
Oops, something went wrong.

0 comments on commit f54ab51

Please sign in to comment.