Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
deployment via shipit
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar committed Jul 24, 2015
1 parent 1b88711 commit 686fff8
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 22 deletions.
13 changes: 13 additions & 0 deletions 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'
] );
};
21 changes: 21 additions & 0 deletions 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);
};
54 changes: 34 additions & 20 deletions gulpfile.js
Expand Up @@ -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() );
};
Expand Down Expand Up @@ -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',
Expand All @@ -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 );
} );
4 changes: 4 additions & 0 deletions package.json
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion provision/base.sh
Expand Up @@ -16,4 +16,5 @@ nvm alias default 0.12.5

# install global npm packages

npm install -g gulp@3.9.0
npm install -g gulp@3.9.0
npm install -g shipit-cli@1.3.0
1 change: 1 addition & 0 deletions shipitfile.js
@@ -0,0 +1 @@
module.exports = require('./deploy/shipit').init;
2 changes: 1 addition & 1 deletion src/app/views/mainLanding.js
Expand Up @@ -25,7 +25,7 @@ export default React.createClass( {

<section id="about">
<div className="col-ld-12 text-center">
<h3>Soapee is a Saponification Calculator and Soap Recipe Database.</h3>
<h3>Soapee is a Saponification Calculator and a Soap Recipe Database.</h3>
<p className="lead"><Link to="signup">Register</Link> today to start creating, saving and sharing all your soap recipes.</p>
</div>
</section>
Expand Down
2 changes: 2 additions & 0 deletions webpack.config.js
Expand Up @@ -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',
Expand All @@ -33,6 +34,7 @@ module.exports = function ( options ) {
'react-portal',
'react-router',
'react-social',
'react-textarea-autosize',
'reflux',
'scribe-editor',
'scribe-plugin-sanitizer',
Expand Down

0 comments on commit 686fff8

Please sign in to comment.