From 686fff8370fd0b60d51f9e573a7abfff1391e626 Mon Sep 17 00:00:00 2001 From: Nazar Aziz Date: Fri, 24 Jul 2015 16:18:09 +0100 Subject: [PATCH] deployment via shipit --- deploy/deploy.js | 13 +++++++++ deploy/shipit.js | 21 ++++++++++++++ gulpfile.js | 54 +++++++++++++++++++++++------------- package.json | 4 +++ provision/base.sh | 3 +- shipitfile.js | 1 + src/app/views/mainLanding.js | 2 +- webpack.config.js | 2 ++ 8 files changed, 78 insertions(+), 22 deletions(-) create mode 100644 deploy/deploy.js create mode 100644 deploy/shipit.js create mode 100644 shipitfile.js diff --git a/deploy/deploy.js b/deploy/deploy.js new file mode 100644 index 0000000..54d807a --- /dev/null +++ b/deploy/deploy.js @@ -0,0 +1,13 @@ +var utils = require( 'shipit-utils' ); + + +module.exports = function ( gruntOrShipit ) { + require( 'shipit-deploy' )( gruntOrShipit ); + + utils.registerTask( gruntOrShipit, 'deploy-local', [ + 'deploy:init', + 'deploy:update', + 'deploy:publish', + 'deploy:clean' + ] ); +}; \ No newline at end of file diff --git a/deploy/shipit.js b/deploy/shipit.js new file mode 100644 index 0000000..41057c7 --- /dev/null +++ b/deploy/shipit.js @@ -0,0 +1,21 @@ +var config = { + default: { + workspace: './build', + deployTo: '/var/www/soapee.com/ui/', + rsync: ['--del'], + keepReleases: 3, + deleteOnRollback: false + }, + + production: { + servers: 'soapee.com' + } +}; + +module.exports.config = config; + +module.exports.init = function(shipit) { + require('./deploy')(shipit); + + shipit.initConfig(config); +}; \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 999e691..0db2dee 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,9 +8,11 @@ var stylus = require( 'gulp-stylus' ); var clean = require( 'gulp-clean' ); var rsync = require( 'gulp-rsync' ); var runSequence = require( 'run-sequence' ); +var imagemin = require( 'gulp-imagemin' ); +var shipitCaptain = require('shipit-captain'); function handleError( task ) { - return function( err ) { + return function ( err ) { this.emit( 'end' ); gutil.log( 'Error handler for', task, err.toString() ); }; @@ -54,6 +56,15 @@ gulp.task( 'clean:build', function () { .pipe( clean() ); } ); +gulp.task( 'build:image:min', function () { + return gulp.src( './build/bundle/*.jpg' ) + .pipe( imagemin( { + progressive: true, + svgoPlugins: [ { removeViewBox: false } ] + } ) ) + .pipe( gulp.dest( 'build/bundle' ) ); +} ); + gulp.task( 'build:cp:index', function () { return gulp.src( [ './src/index.html', @@ -62,26 +73,29 @@ gulp.task( 'build:cp:index', function () { .pipe( gulp.dest( 'build/' ) ); } ); +gulp.task( 'build:webpack', function () { + return gulp.src( 'src/app/app.js' ) + .pipe( gulpWebpack( require( './webpack.prod.js' ), webpack ) ) + .pipe( gulp.dest( 'build/bundle/' ) ); +} ); + + gulp.task( 'build', function ( cb ) { - runSequence( 'clean:build', [ 'stylus:compile', 'build:cp:index' ], function () { - return gulp.src( 'src/app/app.js' ) - .pipe( gulpWebpack( require( './webpack.prod.js' ), webpack ) ) - .pipe( gulp.dest( 'build/bundle/' ) ) - .on( 'end', cb ); - } ); + runSequence( + 'clean:build', + [ 'stylus:compile', 'build:cp:index' ], + 'build:webpack', + 'build:image:min', + cb + ); } ); -gulp.task( 'deploy', [ 'build' ], function () { - return gulp.src( 'build/**' ) - .pipe( rsync( { - root: 'build', - hostname: '176.58.125.89', - username: 'nazar', - destination: '/var/www/charts.charb.it/spa/', - incremental: true, - progress: true, - recursive: true, - clean: true, - compress: true - } ) ); +gulp.task( 'deploy', [ 'build' ], function ( cb ) { + var options = { + init: require( './deploy/shipit' ).init, + run: 'deploy-local', + targetEnv: 'production' + }; + + shipitCaptain( require( './deploy/shipit' ).config, options, cb ); } ); \ No newline at end of file diff --git a/package.json b/package.json index b44123b..fb3e3b2 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,10 @@ "gulp-webpack": "1.5.0", "react-hot-loader": "1.2.8", "run-sequence": "1.1.1", + "shipit-captain": "0.4.0", + "shipit-cli": "1.3.0", + "shipit-deploy": "2.0.0", + "shipit-utils": "1.3.0", "style-loader": "0.12.3", "url-loader": "0.5.6", "webpack": "1.10.1", diff --git a/provision/base.sh b/provision/base.sh index 7822f23..5dbe174 100644 --- a/provision/base.sh +++ b/provision/base.sh @@ -16,4 +16,5 @@ nvm alias default 0.12.5 # install global npm packages -npm install -g gulp@3.9.0 \ No newline at end of file +npm install -g gulp@3.9.0 +npm install -g shipit-cli@1.3.0 \ No newline at end of file diff --git a/shipitfile.js b/shipitfile.js new file mode 100644 index 0000000..46a1480 --- /dev/null +++ b/shipitfile.js @@ -0,0 +1 @@ +module.exports = require('./deploy/shipit').init; \ No newline at end of file diff --git a/src/app/views/mainLanding.js b/src/app/views/mainLanding.js index 00763a7..267bc5c 100644 --- a/src/app/views/mainLanding.js +++ b/src/app/views/mainLanding.js @@ -25,7 +25,7 @@ export default React.createClass( {
-

Soapee is a Saponification Calculator and Soap Recipe Database.

+

Soapee is a Saponification Calculator and a Soap Recipe Database.

Register today to start creating, saving and sharing all your soap recipes.

diff --git a/webpack.config.js b/webpack.config.js index a90d982..e4e8353 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -17,6 +17,7 @@ module.exports = function ( options ) { 'bootstrap/dist/js/bootstrap.min.js', 'assets/css/theme.css', 'assets/css/animate.css', + 'checkit', 'classnames', 'events', 'jquery', @@ -33,6 +34,7 @@ module.exports = function ( options ) { 'react-portal', 'react-router', 'react-social', + 'react-textarea-autosize', 'reflux', 'scribe-editor', 'scribe-plugin-sanitizer',