Skip to content

Commit a9b4744

Browse files
committed
[upgrade] Initial rsync of current project template
1 parent 85397ef commit a9b4744

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+8274
-1809
lines changed

.babelrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"presets": [
3+
"es2015"
4+
],
5+
"plugins": [
6+
"transform-react-jsx"
7+
],
8+
"env": {
9+
"test": {
10+
"plugins": [
11+
"rewire"
12+
]
13+
}
14+
}
15+
}

.coveragerc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[run]
2+
branch = true
3+
omit = */tests/*, */migrations/*, */urls.py, */settings/*, */wsgi.py, manage.py, fabfile.py
4+
source = .
5+
6+
[report]
7+
show_missing = true

.gitignore

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.sw[po]
12
*.py[co]
23
.project
34
.pydevproject
@@ -6,10 +7,17 @@
67
*.orig
78
*.DS_Store
89
.coverage
10+
coverage
911
.vagrant
1012
*/settings/local.py
1113
public/static/
1214
public/media/
13-
secrets.sls
15+
conf/pillar/*/deploy
16+
*.priv
17+
.env
18+
node_modules
19+
*/static/js/bundle.js
20+
*/static/js/vendors.js
21+
*/static/libs/modernizr.js
22+
*/static/css
1423
inspections.log*
15-
*.swp

.jshintrc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"curly": true,
3+
"eqeqeq": true,
4+
"immed": true,
5+
"latedef": true,
6+
"newcap": true,
7+
"noarg": true,
8+
"sub": true,
9+
"undef": true,
10+
"boss": true,
11+
"eqnull": true,
12+
"browser": true,
13+
"undef": true,
14+
"trailing": true,
15+
"jquery": true,
16+
"indent": 4,
17+
"esversion": 6,
18+
"mocha": true,
19+
"browserify": true,
20+
"devel": true
21+
}

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python=python2.7

.travis.yml

+42-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,53 @@
11
language: python
22

3+
sudo: false
4+
35
python:
4-
- "3.5"
6+
- "3.5"
7+
8+
# Match postgresql version to that in conf/pillar/project.sls
9+
addons:
10+
postgresql: "9.3"
511

6-
services: postgresql
12+
cache:
13+
directories:
14+
- $HOME/.cache/pip
15+
- $HOME/.npm
16+
- $HOME/.nvm
17+
- $HOME/.cache/node_modules
18+
- $HOME/.cache/venvs
719

8-
before_install:
9-
- export DJANGO_SETTINGS_MODULE=eatsmart.settings.test
10-
- export PYTHONPATH=$HOME/builds/codefordurham/Durham-Restaurants
20+
env:
21+
- DJANGO_SETTINGS_MODULE="eatsmart.settings.dev"
1122

1223
install:
13-
- pip install -r requirements/base.txt
24+
- pip install -U pip
25+
- pip install -U -r requirements/dev.txt
26+
- nvm install 4.2
27+
- nvm use 4.2
28+
- npm install
1429

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

2139
script:
22-
- python manage.py test inspections
40+
- python manage.py makemigrations --dry-run | grep 'No changes detected' || (echo 'There are changes which require migrations.' && exit 1)
41+
- coverage run manage.py test
42+
- coverage report -m --fail-under 80
43+
- flake8 .
44+
- make docs
45+
- npm test
46+
47+
notifications:
48+
hipchat:
49+
rooms:
50+
secure: 'FIXME: replace with "travis encrypt <api_token@room_id> --add notifications.hipchat.rooms"'
51+
template:
52+
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} (<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
53+
format: html

Makefile

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
PROJECT_NAME = eatsmart
2+
STATIC_LIBS_DIR = ./$(PROJECT_NAME)/static/libs
3+
4+
default: lint test
5+
6+
test:
7+
# Run all tests and report coverage
8+
# Requires coverage
9+
python manage.py makemigrations --dry-run | grep 'No changes detected' || \
10+
(echo 'There are changes which require migrations.' && exit 1)
11+
coverage run manage.py test
12+
coverage report -m --fail-under 80
13+
npm test
14+
15+
lint-py:
16+
# Check for Python formatting issues
17+
# Requires flake8
18+
flake8 .
19+
20+
lint-js:
21+
# Check JS for any problems
22+
# Requires jshint
23+
find -name "*.js" -not -path "${STATIC_LIBS_DIR}*" -print0 | xargs -0 jshint
24+
25+
lint: lint-py lint-js
26+
27+
$(STATIC_LIBS_DIR):
28+
mkdir -p $@
29+
30+
update-static-libs: $(LIBS)
31+
32+
# Generate a random string of desired length
33+
generate-secret: length = 32
34+
generate-secret:
35+
@strings /dev/urandom | grep -o '[[:alnum:]]' | head -n $(length) | tr -d '\n'; echo
36+
37+
conf/%.pub.ssh:
38+
# Generate SSH deploy key for a given environment
39+
ssh-keygen -t rsa -b 4096 -f $*.priv -C "$*@${PROJECT_NAME}"
40+
@mv $*.priv.pub $@
41+
42+
staging-deploy-key: conf/staging.pub.ssh
43+
44+
production-deploy-key: conf/production.pub.ssh
45+
46+
# Translation helpers
47+
makemessages:
48+
# Extract English messages from our source code
49+
python manage.py makemessages --ignore 'conf/*' --ignore 'docs/*' --ignore 'requirements/*' \
50+
--no-location --no-obsolete -l en
51+
52+
compilemessages:
53+
# Compile PO files into the MO files that Django will use at runtime
54+
python manage.py compilemessages
55+
56+
pushmessages:
57+
# Upload the latest English PO file to Transifex
58+
tx push -s
59+
60+
pullmessages:
61+
# Pull the latest translated PO files from Transifex
62+
tx pull -af
63+
64+
setup:
65+
virtualenv -p `which python3.5` $(WORKON_HOME)/eatsmart
66+
$(WORKON_HOME)/eatsmart/bin/pip install -U pip wheel
67+
$(WORKON_HOME)/eatsmart/bin/pip install -Ur requirements/dev.txt
68+
$(WORKON_HOME)/eatsmart/bin/pip freeze
69+
npm install
70+
npm update
71+
cp eatsmart/settings/local.example.py eatsmart/settings/local.py
72+
echo "DJANGO_SETTINGS_MODULE=eatsmart.settings.local" > .env
73+
createdb -E UTF-8 eatsmart
74+
$(WORKON_HOME)/eatsmart/bin/python manage.py migrate
75+
if [ -e project.travis.yml ] ; then mv project.travis.yml .travis.yml; fi
76+
@echo
77+
@echo "The eatsmart project is now setup on your machine."
78+
@echo "Run the following commands to activate the virtual environment and run the"
79+
@echo "development server:"
80+
@echo
81+
@echo " workon eatsmart"
82+
@echo " npm run dev"
83+
84+
update:
85+
$(WORKON_HOME)/eatsmart/bin/pip install -U -r requirements/dev.txt
86+
npm install
87+
npm update
88+
89+
# Build documentation
90+
docs:
91+
cd docs && make html
92+
93+
.PHONY: default test lint lint-py lint-js generate-secret makemessages \
94+
pushmessages pullmessages compilemessages docs
95+
96+
.PRECIOUS: conf/%.pub.ssh

Vagrantfile

+3-36
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,9 @@
1+
Vagrant.require_version ">= 1.7.0"
2+
13
Vagrant.configure("2") do |config|
2-
config.vm.box = "precise32"
3-
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
4+
config.vm.box = "ubuntu/trusty64"
45
config.vm.network :private_network, ip: "33.33.33.10"
56
config.vm.provider :virtualbox do |vbox|
67
vbox.customize ["modifyvm", :id, "--memory", "1024"]
78
end
8-
9-
config.vm.synced_folder "conf/", "/srv/"
10-
11-
config.vm.provision :shell, :inline => "sudo apt-get install python-pip git-core -qq -y"
12-
config.vm.provision :shell, :inline => "sudo pip install -q -U GitPython"
13-
14-
config.vm.provision :salt do |salt|
15-
16-
# Config Options
17-
salt.minion_config = "vagrant/minion.conf"
18-
salt.master_config = "vagrant/master.conf"
19-
20-
# Bootstrap Options Below
21-
# See options here:
22-
# http://bootstrap.saltstack.org
23-
24-
# If you need bleeding edge salt
25-
salt.install_type = "stable"
26-
27-
# Install a master on this machine
28-
salt.install_master = true
29-
30-
# Actions
31-
# Normally we want to run state.highstate to provision the machine
32-
salt.run_highstate = false
33-
34-
# Default will not install / update salt binaries if they are present
35-
# Use this option to always install
36-
salt.always_install = false
37-
38-
# Gives more output, such as from bootstrap script
39-
salt.verbose = true
40-
41-
end
429
end

circle.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
machine:
2+
python:
3+
version: 3.5.0
4+
environment:
5+
DJANGO_SETTINGS_MODULE: eatsmart.settings.dev
6+
dependencies:
7+
override:
8+
- pip install -U pip
9+
- pip install -r requirements/dev.txt
10+
- nvm install 4.2
11+
- nvm use 4.2
12+
- npm install
13+
- npm install -g jshint
14+
test:
15+
override:
16+
- make -k
17+
- make docs

conf/keys/gpg.tmpl

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
%%echo Generating a default key
2+
Key-Type: RSA
3+
Key-Length: 2048
4+
Subkey-Type: RSA
5+
Name-Real: %(environment)s_salt_key
6+
Name-Email: %(environment)s@salt.example.com
7+
Expire-Date: 0
8+
%%commit

conf/keys/production.pub.gpg

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-----BEGIN PGP PUBLIC KEY BLOCK-----
2+
Version: GnuPG v1
3+
4+
mQENBFdm+noBCADD26epvnSVdSgfu8E+7sr5MaUrVEReurLJGaS9ZDJ2fFiINyAU
5+
zhMD1CXYlQadK0LDwxSZYxcKoIXmj1zbbhRyJ5k+jL4lJ/ZliOlWvInK5zdtUWOp
6+
M8sdOgGmOq4islbGaXkVDlJpO39HOy9Z2yd/YFPpFmJhrwU7/7nCLMDg72PeqyNC
7+
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tjkAEQEAAYkC
23+
PgQYAQIACQUCV2b6egIbLgEpCRDzuS7P2KoXNMBdIAQZAQIABgUCV2b6egAKCRAc
24+
uZixHXjuGW1VCACi58ZmjaosCVx+zg4WEL2HAdtcbaqy15G051gtiJ1rrLb/n51q
25+
zg9ZcIV/l9Mzy69S1LuJ3Yx1BINvDU8XjYTrM0YgRNw+XpUZ8MvSlIkTXV/L+x8a
26+
z7zdqiOMQy6yDxYs3abDT5wAady/mJnGmFvinKfLh1LQqjTSDApzVdEXzTfsk2/f
27+
PW78UqztoSRn6kyKTLJjiSdS3cf6LVTGTTSxywekgLUNgQRqVceKxINIO8vAOeqr
28+
bHIcEjc/r8xBvvS0XJXPnFjj7tfInHff8vcKW9XBuuBM3hR81GzhRiMRNBEckR8z
29+
LsK0Z3pKHNAP86lqKpjOJcCTJdkdHEiMgYQxE5MH/2VNUyxYhjREwmEyNSIGH6yz
30+
G7Wn12miB2H4lCG6oUV5v1/AXGAl3CdH9IPFmfkVnQuAkNLCoHYk/OEwCLvrMZo6
31+
0+7wPf8wUwysLqvsf9YpDS8glqpWn/j3px5I3LhccTDMy8wsA/NupY5bwrYSyRde
32+
XJO2l0hu5E57XOsaBC94cJt8vJ3kSPGl7IKDdfW80L+CxtBVVshLb7bdrG9/FRKE
33+
jcAGKT7EXqM9/OzIgGTjNkSex2ATcvVS/Yy9b4s2r4CdoblOJgT7EVqN6jNCN4JI
34+
WgdI6eMaLwj6F5KpWV/cmTr/o7TAVtYRUIKGptiKU0DnjzaRqjMopnMMDaBHBxg=
35+
=q4m+
36+
-----END PGP PUBLIC KEY BLOCK-----

conf/master.tmpl

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
timeout: 60
2+
3+
log_file: file:///dev/log
4+
log_level: %(loglevel)s
5+
log_fmt_logfile: "%(logfmt)s"
6+
7+
state_output: mixed
8+
9+
fileserver_backend:
10+
- roots
11+
12+
file_roots:
13+
base:
14+
- /srv/salt
15+
- /srv/margarita

0 commit comments

Comments
 (0)