Skip to content

Commit

Permalink
[upgrade] Initial rsync of current project template
Browse files Browse the repository at this point in the history
  • Loading branch information
vrocha committed Jun 19, 2016
1 parent 85397ef commit a9b4744
Show file tree
Hide file tree
Showing 81 changed files with 8,274 additions and 1,809 deletions.
15 changes: 15 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
"es2015"
],
"plugins": [
"transform-react-jsx"
],
"env": {
"test": {
"plugins": [
"rewire"
]
}
}
}
7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[run]
branch = true
omit = */tests/*, */migrations/*, */urls.py, */settings/*, */wsgi.py, manage.py, fabfile.py
source = .

[report]
show_missing = true
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.sw[po]
*.py[co]
.project
.pydevproject
Expand All @@ -6,10 +7,17 @@
*.orig
*.DS_Store
.coverage
coverage
.vagrant
*/settings/local.py
public/static/
public/media/
secrets.sls
conf/pillar/*/deploy
*.priv
.env
node_modules
*/static/js/bundle.js
*/static/js/vendors.js
*/static/libs/modernizr.js
*/static/css
inspections.log*
*.swp
21 changes: 21 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"browser": true,
"undef": true,
"trailing": true,
"jquery": true,
"indent": 4,
"esversion": 6,
"mocha": true,
"browserify": true,
"devel": true
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python=python2.7
53 changes: 42 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,53 @@
language: python

sudo: false

python:
- "3.5"
- "3.5"

# Match postgresql version to that in conf/pillar/project.sls
addons:
postgresql: "9.3"

services: postgresql
cache:
directories:
- $HOME/.cache/pip
- $HOME/.npm
- $HOME/.nvm
- $HOME/.cache/node_modules
- $HOME/.cache/venvs

before_install:
- export DJANGO_SETTINGS_MODULE=eatsmart.settings.test
- export PYTHONPATH=$HOME/builds/codefordurham/Durham-Restaurants
env:
- DJANGO_SETTINGS_MODULE="eatsmart.settings.dev"

install:
- pip install -r requirements/base.txt
- pip install -U pip
- pip install -U -r requirements/dev.txt
- nvm install 4.2
- nvm use 4.2
- npm install

before_script:
- psql -c 'create database test_eatsmart;' -U postgres
- psql -c 'CREATE EXTENSION postgis;' -U postgres -d test_eatsmart
- psql -c 'CREATE EXTENSION postgis_topology;' -U postgres -d test_eatsmart
- python manage.py migrate --noinput
- createdb -E UTF-8 eatsmart -U postgres -O $USER
# Uncomment for Requires.IO pushes of develop and master merges (not pull-request builds)
# Requires the $REQUIRES_IO_TOKEN environment variable defined at Travis CI for this project
# See developer documentation section on depdency tracking for more information.
# - if [ "$TRAVIS_PULL_REQUEST" == "false" ] ; then requires.io update-branch -t $REQUIRES_IO_TOKEN -r rescueid -n $(echo $TRAVIS_BRANCH | sed "s|/|__|g") . ; fi
# Uncomment for PostGIS support
# - psql service_info -c "CREATE EXTENSION postgis;" -U postgres

script:
- python manage.py test inspections
- python manage.py makemigrations --dry-run | grep 'No changes detected' || (echo 'There are changes which require migrations.' && exit 1)
- coverage run manage.py test
- coverage report -m --fail-under 80
- flake8 .
- make docs
- npm test

notifications:
hipchat:
rooms:
secure: 'FIXME: replace with "travis encrypt <api_token@room_id> --add notifications.hipchat.rooms"'
template:
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} (<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
format: html
96 changes: 96 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
PROJECT_NAME = eatsmart
STATIC_LIBS_DIR = ./$(PROJECT_NAME)/static/libs

default: lint test

test:
# Run all tests and report coverage
# Requires coverage
python manage.py makemigrations --dry-run | grep 'No changes detected' || \
(echo 'There are changes which require migrations.' && exit 1)
coverage run manage.py test
coverage report -m --fail-under 80
npm test

lint-py:
# Check for Python formatting issues
# Requires flake8
flake8 .

lint-js:
# Check JS for any problems
# Requires jshint
find -name "*.js" -not -path "${STATIC_LIBS_DIR}*" -print0 | xargs -0 jshint

lint: lint-py lint-js

$(STATIC_LIBS_DIR):
mkdir -p $@

update-static-libs: $(LIBS)

# Generate a random string of desired length
generate-secret: length = 32
generate-secret:
@strings /dev/urandom | grep -o '[[:alnum:]]' | head -n $(length) | tr -d '\n'; echo

conf/%.pub.ssh:
# Generate SSH deploy key for a given environment
ssh-keygen -t rsa -b 4096 -f $*.priv -C "$*@${PROJECT_NAME}"
@mv $*.priv.pub $@

staging-deploy-key: conf/staging.pub.ssh

production-deploy-key: conf/production.pub.ssh

# Translation helpers
makemessages:
# Extract English messages from our source code
python manage.py makemessages --ignore 'conf/*' --ignore 'docs/*' --ignore 'requirements/*' \
--no-location --no-obsolete -l en

compilemessages:
# Compile PO files into the MO files that Django will use at runtime
python manage.py compilemessages

pushmessages:
# Upload the latest English PO file to Transifex
tx push -s

pullmessages:
# Pull the latest translated PO files from Transifex
tx pull -af

setup:
virtualenv -p `which python3.5` $(WORKON_HOME)/eatsmart
$(WORKON_HOME)/eatsmart/bin/pip install -U pip wheel
$(WORKON_HOME)/eatsmart/bin/pip install -Ur requirements/dev.txt
$(WORKON_HOME)/eatsmart/bin/pip freeze
npm install
npm update
cp eatsmart/settings/local.example.py eatsmart/settings/local.py
echo "DJANGO_SETTINGS_MODULE=eatsmart.settings.local" > .env
createdb -E UTF-8 eatsmart
$(WORKON_HOME)/eatsmart/bin/python manage.py migrate
if [ -e project.travis.yml ] ; then mv project.travis.yml .travis.yml; fi
@echo
@echo "The eatsmart project is now setup on your machine."
@echo "Run the following commands to activate the virtual environment and run the"
@echo "development server:"
@echo
@echo " workon eatsmart"
@echo " npm run dev"

update:
$(WORKON_HOME)/eatsmart/bin/pip install -U -r requirements/dev.txt
npm install
npm update

# Build documentation
docs:
cd docs && make html

.PHONY: default test lint lint-py lint-js generate-secret makemessages \
pushmessages pullmessages compilemessages docs

.PRECIOUS: conf/%.pub.ssh
39 changes: 3 additions & 36 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,9 @@
Vagrant.require_version ">= 1.7.0"

Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.box = "ubuntu/trusty64"
config.vm.network :private_network, ip: "33.33.33.10"
config.vm.provider :virtualbox do |vbox|
vbox.customize ["modifyvm", :id, "--memory", "1024"]
end

config.vm.synced_folder "conf/", "/srv/"

config.vm.provision :shell, :inline => "sudo apt-get install python-pip git-core -qq -y"
config.vm.provision :shell, :inline => "sudo pip install -q -U GitPython"

config.vm.provision :salt do |salt|

# Config Options
salt.minion_config = "vagrant/minion.conf"
salt.master_config = "vagrant/master.conf"

# Bootstrap Options Below
# See options here:
# http://bootstrap.saltstack.org

# If you need bleeding edge salt
salt.install_type = "stable"

# Install a master on this machine
salt.install_master = true

# Actions
# Normally we want to run state.highstate to provision the machine
salt.run_highstate = false

# Default will not install / update salt binaries if they are present
# Use this option to always install
salt.always_install = false

# Gives more output, such as from bootstrap script
salt.verbose = true

end
end
17 changes: 17 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
machine:
python:
version: 3.5.0
environment:
DJANGO_SETTINGS_MODULE: eatsmart.settings.dev
dependencies:
override:
- pip install -U pip
- pip install -r requirements/dev.txt
- nvm install 4.2
- nvm use 4.2
- npm install
- npm install -g jshint
test:
override:
- make -k
- make docs
8 changes: 8 additions & 0 deletions conf/keys/gpg.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%%echo Generating a default key
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Name-Real: %(environment)s_salt_key
Name-Email: %(environment)s@salt.example.com
Expire-Date: 0
%%commit
36 changes: 36 additions & 0 deletions conf/keys/production.pub.gpg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

mQENBFdm+noBCADD26epvnSVdSgfu8E+7sr5MaUrVEReurLJGaS9ZDJ2fFiINyAU
zhMD1CXYlQadK0LDwxSZYxcKoIXmj1zbbhRyJ5k+jL4lJ/ZliOlWvInK5zdtUWOp
M8sdOgGmOq4islbGaXkVDlJpO39HOy9Z2yd/YFPpFmJhrwU7/7nCLMDg72PeqyNC
y/blbFbIXMtwPXd/IePasH9TtTKKgS3tpjgMwPiSV2SX97px/m7pw/FSuSuhYkDs
5b2uZTSindHp6Q+RtYOrZVWC2CJkLIyJej+Hc9+WOpVtBZw4MHQZ8sTWfno0XtJD
HO2y6tjbsFmhbd7J30X2IUsRhwIIpAdXV5qnABEBAAG0MXByb2R1Y3Rpb25fc2Fs
dF9rZXkgPHByb2R1Y3Rpb25Ac2FsdC5leGFtcGxlLmNvbT6JATgEEwECACIFAldm
+noCGy8GCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEPO5Ls/Yqhc00HkH/2y+
tRCEim5F3Bm3Rp1f+wlfw8xXwMM5HzHC3GRpajZK7JJUtx37gP8RYWIsb/KWxfzE
7zaBUk4qQgAmhIbkeQZ1jePbga3jxRRfCtxtEqAt4jq36fTMN1PNHdS59W9EQ2GX
S5lOXs6tQDc1yAltnga18qO6tfObdFObRcmZptqrS/5TavQ/gOjSeyg0zVarMQ5i
rqriT94TtLhnfx/jRos7OqW3TWFMx7uInaUsGtt3HBm7ol0LQUJGajXDqdCmOII5
Ev00tMPMz5V94tQ+GB5HzCj5DrhIVSVSTisbEs9SFFQFMId6C7MAjF7Ba2vXX+sL
SEQAo3U6t0cnqRBNBZa5AQ0EV2b6egEIAKzgthsK13Pv3I8wYwrcicAaT0zwXm+S
mWTsp8ekUvViOLFP35pKxHjg+KMA+xDAhBAyTlvNQ5NP6VTIGkXcss6i5UoHskY0
FH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additions & 0 deletions conf/master.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
timeout: 60

log_file: file:///dev/log
log_level: %(loglevel)s
log_fmt_logfile: "%(logfmt)s"

state_output: mixed

fileserver_backend:
- roots

file_roots:
base:
- /srv/salt
- /srv/margarita
Loading

0 comments on commit a9b4744

Please sign in to comment.