Skip to content

Commit

Permalink
Deploying via rsync
Browse files Browse the repository at this point in the history
  • Loading branch information
etianen committed Oct 5, 2014
1 parent 7638871 commit cc7fc77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
43 changes: 13 additions & 30 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var rename = require("gulp-rename");
var concat = require("gulp-concat");
var clean = require("gulp-clean");
var minifyCSS = require("gulp-minify-css");
var awspublish = require("gulp-awspublish");
var replace = require("gulp-replace");
var shell = require("gulp-shell");


var API_JS_BUILD_ROOT = path.join("build", "api", meta.version);
Expand Down Expand Up @@ -153,41 +153,24 @@ gulp.task("dist", ["build"], function() {

// Publishing.

function publishToBucket(stream, bucketName) {
var publisher = awspublish.create({
key: process.env.HTML5MEDIA_AWS_ACCESS_KEY_ID,
secret: process.env.HTML5MEDIA_AWS_SECRET_ACCESS_KEY,
bucket: bucketName
});
return stream
.pipe(publisher.publish({
"Cache-Control": "public, max-age=315360000"
}))
.pipe(publisher.sync())
.pipe(publisher.cache())
.pipe(awspublish.reporter());
}
var publishViaRsync = function(src, dest) {
return "rsync -rh --progress --delete " + src + " " + process.env.HTML5MEDIA_HOST + ":" + dest;
};


gulp.task("publish-www", ["dist"], function() {
return publishToBucket(gulp.src([
"dist/www/**"
]), "html5media.info");
});
gulp.task("publish-www", ["dist"], shell.task([
publishViaRsync("dist/www/*", process.env.HTML5MEDIA_PATH_WWW),
]));


gulp.task("publish-media", ["dist"], function() {
return publishToBucket(gulp.src([
"dist/media/**"
]), "media.html5media.info");
});
gulp.task("publish-media", ["dist"], shell.task([
publishViaRsync("dist/media/*", process.env.HTML5MEDIA_PATH_MEDIA),
]));


gulp.task("publish-api", ["dist"], function() {
return publishToBucket(gulp.src([
"dist/api/**"
]), "api.html5media.info");
});
gulp.task("publish-api", ["dist"], shell.task([
publishViaRsync("dist/api/*", process.env.HTML5MEDIA_PATH_API),
]));


gulp.task("publish", ["publish-www", "publish-media", "publish-api"]);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"description": "html5media enables <video> and <audio> tags in all major browsers",
"devDependencies": {
"gulp": "~3.6.0",
"gulp-awspublish": "0.0.13",
"gulp-clean": "~0.2.4",
"gulp-concat": "^2.3.4",
"gulp-minify-css": "~0.3.1",
"gulp-rename": "~1.2.0",
"gulp-replace": "~0.2.0",
"gulp-shell": "^0.2.9",
"gulp-uglify": "~0.2.1"
},
"repository": {
Expand Down

0 comments on commit cc7fc77

Please sign in to comment.