Skip to content

Commit

Permalink
Initial import from private repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmb committed Jan 20, 2014
0 parents commit 8a478d8
Show file tree
Hide file tree
Showing 220 changed files with 44,308 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Required
SECRET_KEY=supersecretkeyhere
WEB_PORT=8000

# Optional
# DATABASE_URL=postgres://user:pass@localhost:5432/name
# MEMCACHE_URL=127.0.0.1:11211
# REDIS_PLUGIN_QUEUE_URL=redis://localhost:6379/0
# REDIS_PLUGIN_STORAGE_URL=redis://localhost:6379/1
# REDIS_SSEQUEUE_URL=redis://localhost:6379/1
# STATIC_ROOT=/var/www/botbot/static
# MEDIA_ROOT=/var/www/botbot/uploads
# DEBUG=True
# SMTP_URL=smtp://user:pass@host:port
# SMTP_TLS=True
# ALLOWED_HOSTS=host1,host2
# INCLUDE_DJANGO_ADMIN=False
# EXCLUDE_NICKS=nick1,nick2
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env
botbot.egg-info
.pip-timestamp
docs/_build
*.pyc
50 changes: 50 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"predef": [
"jasmine",
"spyOn",
"it",
"beforeEach",
"describe",
"expect",
"$",
"jQuery",
"Backbone",
"Handlebars",
"EventSource",
"moment",
"jstz",
"_",
"_gaq",
"mixpanel",
"$$",
"ohrl",
"log",
"console"
],

"node" : true,
"browser" : true,
"boss" : false,
"curly": false,
"debug": false,
"devel": false,
"eqeqeq": true,
"expr": true,
"evil": false,
"forin": false,
"immed": true,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": false,
"nomen": false,
"onevar": true,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": true
}

55 changes: 55 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

[MASTER]

# Add <file or directory> to the black list. It should be a base name, not a
# path. You may set this option multiple times.
ignore=conf
ignore=migrations


[MESSAGES CONTROL]

# Disable pylint checkers which don't play well with Django
# or which don't help us
#
#C0111 Missing docstring # We're grown ups. Maybe.
#
#E1002 Use super on an old style class # Pylint (incorrectly) thinks CBVs are old style classes
#E1101 %s %r has no %r member # ForeignKey has lots of magic methods
#E1103 %s %r has no %r member (but some types could not be inferred)
#
#R0201 Method could be a function # It's useful to organise methods into classes
#R0901 Too many ancestors # CBVs
#R0902 Too many instance attributes # BaseTestCase has lots of attributes
#R0903 Too few public methods (%s/%s) # Meta, Admin, etc
#R0904 Too many public methods (%s/%s) # All managers and CBVs
#R0921 Abstract class not referenced # Abstract class in different file
#
#W0142 Used * or ** magic # Never used by accident
#W0232 Class has no __init__ method # Django is different

# Disable pylint checkers which don't help us
#

disable=C0111,E1002,E1101,E1103,R0201,R0901,R0903,R0904,R0902,R0921,W0142,W0232,R0801


[BASIC]

# Good variable names which should always be accepted, separated by a comma
# Anytime you get an E1101 that you consider invalid, add the variable here.
good-names=_,i,j,k,pk,qs,dt,urlpatterns,register,setUp,tearDown

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata

# Increase max method name length, to include tests.py methods names
# Regular expression which should only match correct method names
method-rgx=[a-z_][a-z0-9_]{2,50}$


[TYPECHECK]

# List of members which are set dynamically and missed by pylint inference
generated-members=objects,DoesNotExist,id,pk,_default_manager,_meta,get_profile

27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
BotBot Logo is copyright Lincoln Loop, LLC. All rights reserved.

Some JavaScript and CSS files are included and provide their own licenses.

All original code is provided under the MIT License:

The MIT License (MIT)

Copyright (c) 2014 Lincoln Loop, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
95 changes: 95 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Developer Makefile

### Default Configuration. Override in a make.config file

# the path to the lib folder in the venv
LOCAL_LIB=$(VIRTUAL_ENV)/lib

# where executables are stored
LOCAL_BIN=$(VIRTUAL_ENV)/bin

# where source files are stored
LOCAL_SRC=$(VIRTUAL_ENV)/src

NPM_BIN := $(or $(shell command -v npm),$(LOCAL_BIN)/npm)
LESS_BIN := $(or $(shell command -v lessc),$(LOCAL_BIN)/lessc)
JSHINT_BIN := $(or $(shell command -v jshint),$(LOCAL_BIN)/jshint)
WATCHMEDO_BIN := $(or $(shell command -v watchmedo),$(LOCAL_BIN)/watchmedo)

# allows a file make.config to override the above variables
-include make.config

### PIP
.pip-timestamp: requirements.txt
pip install -r requirements.txt
touch .pip-timestamp

pip-install: .pip-timestamp

$(LOCAL_BIN)/sphinx-build:
pip install Sphinx

### GENERAL PYTHON COMMANDS
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +

### GO SUPPORT

$(LOCAL_BIN)/botbot-bot:
GOPATH=$(VIRTUAL_ENV) go get github.com/lincolnloop/botbot-bot

test-bot:
GOPATH=$(VIRTUAL_ENV) go test github.com/lincolnloop/botbot-bot

### LOCAL LESS SUPPORT
$(NPM_BIN):
@echo "Installing node.js..."
cd $(VIRTUAL_ENV) && mkdir -p "src"
cd $(LOCAL_LIB) && curl http://nodejs.org/dist/node-latest.tar.gz | tar xvz
cd $(LOCAL_LIB)/node-v* && ./configure --prefix=$(VIRTUAL_ENV) && make install
@echo "Installed npm"

$(LESS_BIN): $(NPM_BIN)
NPM_CONFIG_PREFIX=$(VIRTUAL_ENV) npm install less -g

less-install: $(LESS_BIN)

less-compile:
lessc botbot/less/screen.less > botbot/static/css/screen.css

$(WATCHMEDO_BIN):
# Install watchmedo to run commands when files change
pip install watchmedo argcomplete

less-watch: $(WATCHMEDO_BIN)
watchmedo shell-command --patterns=*.less --recursive --command="make less-compile" botbot/less

### Local JSHint

$(JSHINT_BIN): $(NPM_BIN)
NPM_CONFIG_PREFIX=$(VIRTUAL_ENV) npm install jshint -g

jshint-install: $(JSHINT_BIN)

jshint:
jshint botbot/static/js/app/

### Local Settings

.env:
cp .env.example $@

local-settings: .env

### General Tasks
dependencies: less-install pip-install local-settings $(LOCAL_BIN)/botbot-bot

run: dependencies
honcho start

docs: $(LOCAL_BIN)/sphinx-build
cd docs && make html

.PHONY: clean-pyc run pip-install less-install jshint-install dependencies local-settings docs
3 changes: 3 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: manage.py runserver $WEB_PORT
plugins: manage.py run_plugins
bot: botbot-bot
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```
____ __ ____ __
/ __ )____ / /_/ __ )____ / /_
/ __ / __ \/ __/ __ / __ \/ __/
/ /_/ / /_/ / /_/ /_/ / /_/ / /__
/_____/\____/\__/_____/\____/\___/
```

Botbot is collection of tools for running IRC bots. It has primarily been
used with Freenode channels but works with other IRC networks or servers.

[Documentation](https://github.com/BotBotMe/botbot-web/blob/master/docs/install.rst)
Empty file added botbot/__init__.py
Empty file.
Empty file added botbot/apps/__init__.py
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions botbot/apps/accounts/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin

from . import models

admin.site.register(models.User, UserAdmin)
admin.site.register(models.Membership)
31 changes: 31 additions & 0 deletions botbot/apps/accounts/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from django import forms

from . import models


class AccountForm(forms.ModelForm):

class Meta:
model = models.User
exclude = ('first_name', 'last_name', 'password', 'is_staff',
'is_active', 'is_superuser', 'last_login', 'date_joined',
'groups', 'user_permissions')


class TimezoneForm(forms.Form):
CHOICES = [('', '')]
CHOICES.extend(models.TIMEZONE_CHOICES)
timezone = forms.ChoiceField(choices=CHOICES, required=False)

def __init__(self, request, *args, **kwargs):
super(TimezoneForm, self).__init__(*args, **kwargs)
self.request = request
self.fields['timezone'].initial = request.session.get('django_timezone',
"")

def save(self):
tz = self.cleaned_data['timezone']
self.request.session['django_timezone'] = tz
if self.request.user.is_authenticated():
self.request.user.timezone = tz
self.request.user.save()
Loading

0 comments on commit 8a478d8

Please sign in to comment.