Skip to content

Commit

Permalink
First try to fix installation for plantingjs django app.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariusz Niemczyk committed Feb 26, 2017
1 parent d189612 commit 0e9bf2d
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ coverage/
*.pyc
settings.json
.tern-port
github_deploy_key
github_deploy_key.pub
20 changes: 14 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
language: node_js
node_js:
- "4.2.4"
- node
install:
- "npm install"
- npm install
script:
- "npm run build"
- "npm run lint"
- "npm run test"
- npm run lint
- npm run test
- if [ "$TRAVIS_BRANCH" == "master" ]; then
npm start;
bash travis_deploy.sh;
else
npm run build;
fi
after_success:
- "npm run codecov"
- npm run codecov
env:
global:
- GH_REF: komitywa/plantingjs.git
Binary file added github_deploy_key.enc
Binary file not shown.
18 changes: 17 additions & 1 deletion gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import csso from 'gulp-csso';
import del from 'del';
import domain from 'domain';
import eslint from 'gulp-eslint';
import { existsSync, readFileSync } from 'fs';
import { existsSync, readFileSync, writeFileSync } from 'fs';
import flatten from 'gulp-flatten';
import filter from 'gulp-filter';
import gif from 'gulp-if';
Expand All @@ -33,6 +33,8 @@ import size from 'gulp-size';
import tap from 'gulp-tap';
import useref from 'gulp-useref';

import {resolve} from 'path';

const SETTINGS_PATH = './settings.json';
const settings = existsSync(SETTINGS_PATH) ?
JSON.parse(readFileSync(SETTINGS_PATH, 'utf-8')) : {};
Expand All @@ -46,6 +48,20 @@ gulp.task('default', function() {
gulp.start('build');
});

gulp.task('deploy_json', ['clean'], function(cb) {
return sequence(
'clean',
['js', 'css', 'fonts', 'extras'],
'buildsize',
cb
);
});

gulp.task('autodeploy', ['clean', 'deploy_json'], function() {
const file = readFileSync(resolve(__dirname, './src/deploy_package.json'), 'utf-8');
return writeFileSync('./dist/package.json', file);
});


/* Removing whole ./dist directory */
gulp.task('clean', del.bind(null, './dist'));
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"bugs": "https://github.com/komitywa/plantingjs/issues",
"license": "MIT",
"scripts": {
"serve": "./node_modules/.bin/gulp serve",
"build": "./node_modules/.bin/gulp build",
"lint": "./node_modules/.bin/gulp lint",
"test": "./node_modules/.bin/gulp test",
"codecov": "./node_modules/.bin/codecov"
"serve": "gulp serve",
"build": "gulp build",
"lint": "gulp lint",
"test": "gulp test",
"codecov": "codecov",
"postinstall": "gulp",
"start": "gulp autodeploy"
},
"author": {
"name": "Komitywa",
Expand Down
14 changes: 14 additions & 0 deletions src/deploy_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "plantingjs",
"version": "0.0.1",
"bugs": "https://github.com/komitywa/plantingjs/issues",
"license": "MIT",
"scripts": {},
"author": {
"name": "Komitywa",
"email": "[email protected]",
"url": "http://komitywa.org"
},
"private": true,
"main": "./js/main.js"
}
15 changes: 15 additions & 0 deletions travis_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e # exit with nonzero exit code if anything fails

openssl aes-256-cbc -K $encrypted_7a9f37839964_key -iv $encrypted_7a9f37839964_iv -in github_deploy_key.enc -out github_deploy_key -d
chmod 600 github_deploy_key
eval `ssh-agent -s`
ssh-add github_deploy_key

cd dist
git init
git config user.name "Travis CI"
git config user.email "[email protected]"
git add .
git commit -m "Automatic deploy of compiled library"
git push --force --quiet "[email protected]:${GH_REF}" master:autodeploy > /dev/null 2>&1

0 comments on commit 0e9bf2d

Please sign in to comment.