Refactor gulp commands and travis config for whitenoise integration.

This commit is contained in:
Christopher Charbonneau Wells 2017-10-23 13:50:20 -04:00
parent f0e0ec38e3
commit 89b47b1f99
10 changed files with 75 additions and 28 deletions

View File

@ -17,6 +17,7 @@ install:
before_script:
- gulp lint
- gulp build
- gulp collectstatic
script:
- gulp coverage
after_success:

View File

@ -23,16 +23,12 @@ The demo instance resets every hour. Login credentials are:
### Installation
```
git clone https://github.com/cdubz/babybuddy.git
cd babybuddy
pip install pipenv
pipenv install --dev
pipenv shell
python manage.py migrate
npm install -g gulp-cli
npm install
gulp build
python manage.py runserver
gulp migrate
gulp
```
Open [http://127.0.0.1:8000](http://127.0.0.1:8000) and log in with the default

View File

@ -123,10 +123,6 @@ STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'babybuddy/static'),
]
# Django Rest Framework
# http://www.django-rest-framework.org/#

View File

@ -7,13 +7,8 @@
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{% block title %}{% endblock %} | Baby Buddy</title>
{% if debug %}
<link rel="stylesheet" href="{% static "babybuddy/css/app.css" %}" />
<link rel="stylesheet" href="{% static "babybuddy/css/vendor.css" %}" />
{% else %}
<link rel="stylesheet" href="{% static "babybuddy/css/app.min.css" %}" />
<link rel="stylesheet" href="{% static "babybuddy/css/vendor.min.css" %}" />
{% endif %}
<link rel="stylesheet" href="{% static "babybuddy/css/app.css" %}" />
<link rel="stylesheet" href="{% static "babybuddy/css/vendor.css" %}" />
</head>
<body style="padding-top: 3rem;">
@ -30,13 +25,8 @@
{% block page %}{% endblock %}
{% if debug %}
<script src="{% static "babybuddy/js/vendor.js" %}"></script>
<script src="{% static "babybuddy/js/app.js" %}"></script>
{% else %}
<script src="{% static "babybuddy/js/vendor.min.js" %}"></script>
<script src="{% static "babybuddy/js/app.min.js" %}"></script>
{% endif %}
{% block javascript %}{% endblock %}
</body>

View File

@ -1,4 +1,4 @@
const requireDir = require('require-dir');
var requireDir = require('require-dir');
requireDir('./tasks', { recurse: true });

View File

@ -1,4 +1,4 @@
const gulp = require('gulp');
gulp.task('build', ['scripts', 'styles', 'extras', 'compress']);
gulp.task('build', ['scripts', 'styles', 'extras']);

View File

@ -1,4 +1,8 @@
const gulp = require('gulp');
var gulp = require('gulp');
var runSequence = require('run-sequence');
gulp.task('default', ['scripts', 'styles', 'extras', 'watch']);
gulp.task('default', function(cb) {
runSequence(['build', 'watch'], 'runserver', cb);
});

View File

@ -0,0 +1,50 @@
var gulp = require('gulp');
var spawn = require('child_process').spawn;
gulp.task('collectstatic', function(cb) {
spawn(
'pipenv',
[
'run',
'python',
'manage.py',
'collectstatic'
],
{
stdio: 'inherit'
}
).on('exit', cb);
});
gulp.task('reset', function(cb) {
spawn(
'pipenv',
[
'run',
'python',
'manage.py',
'reset',
'--no-input'
],
{
stdio: 'inherit'
}
).on('exit', cb);
});
gulp.task('runserver', function(cb) {
spawn(
'pipenv',
[
'run',
'python',
'manage.py',
'runserver'
],
{
stdio: 'inherit'
}
).on('exit', cb);
});

9
package-lock.json generated
View File

@ -6848,6 +6848,15 @@
"once": "1.3.3"
}
},
"run-sequence": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/run-sequence/-/run-sequence-2.2.0.tgz",
"integrity": "sha512-xW5DmUwdvoyYQUMPKN8UW7TZSFs7AxtT59xo1m5y91jHbvwGlGgOmdV1Yw5P68fkjf3aHUZ4G1o1mZCtNe0qtw==",
"requires": {
"chalk": "1.1.3",
"gulp-util": "3.0.8"
}
},
"rw": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/rw/-/rw-0.1.4.tgz",

View File

@ -35,9 +35,10 @@
"popper.js": "^1.12.5",
"pump": "^1.0.2",
"require-dir": "^0.3.2",
"run-sequence": "^2.2.0",
"tempusdominus-bootstrap-4": "^5.0.0-alpha9"
},
"scripts": {
"heroku-postbuild": "npm rebuild node-sass && gulp build"
"scripts": {
"heroku-postbuild": "npm rebuild node-sass && gulp build"
}
}