-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
102 lines (79 loc) · 2.96 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/** Osprey Portfolio - gulp.js
**/
'use strict';
var zip = require('gulp-zip');
var clean = require('gulp-clean');
var bump = require('gulp-bump');
var gulp = require('gulp');
var gutil = require( 'gulp-util' );
var ftp = require( 'vinyl-ftp' );
const debug = require('gulp-debug');
const filter = require('gulp-filter');
const chmod = require('gulp-chmod');
const merge = require('merge-stream');
const newer = require('gulp-newer');
var logins = require('./logins.json');
gulp.task('all',['vendor','mainfiles','textfiles','ini','lib']);
var bintrayopts = {
username: 'mbwhite',
organization: 'calanais',
repository: 'BCDEmail',
pkg: {
name: 'BCDEmail'
},
apikey: logins.bintraykey,
baseUrl: null // default: Bintray.apiBaseUrl
};
gulp.task('css', function() {
gulp.src(
[''
]
).pipe(gulp.dest('dist/css');
});
// copy all the (newer) files to the 'dist' directory
gulp.task('copyfiles', function() {
// let vendor = gulp.src('vendor/**').pipe(newer('dist/vendor')).pipe(gulp.dest('dist/vendor'));
let tentcss = gulp.src('node_modules/tent-css/dist/**').pipe(newer('dist/lib/tentcss')).pipe(gulp.dest('dist/lib/tentcss'));
let lightbox2 = gulp.src('node_modules/lightbox2/dist/**').pipe(newer('dist/lib/lightbox2')).pipe(gulp.dest('dist/lib/lightbox2'));
let php = gulp.src('app/*.php').pipe(newer('dist')).pipe(chmod(0o755)).pipe(gulp.dest('dist/'));
let img = gulp.src('imagedata/**').pipe(newer('dist')).pipe(gulp.dest('dist/'));
let html = gulp.src('app/*.html').pipe(newer('dist')).pipe(gulp.dest('dist'));
return merge(tentcss,lightbox2,php,img,html);
});
// ------------------------------------------------------------------
gulp.task('bump-json', function() {
return gulp.src('./package.json')
.pipe(bump({type:'patch'}))
.pipe(gulp.dest('./'));
});
gulp.task('bump-ini', function() {
return gulp.src('./app/bcdemail.ini')
.pipe(bump({type:'patch'}))
.pipe(gulp.dest('./app'));
});
gulp.task('bintray', ['bump-json','bump-ini'], function() {
let version=require('./package.json').version;
return gulp.src([ 'dist/**/*' ])
.pipe(zip('bcdemail-'+version+'.zip'))
.pipe(gulp.dest('.'))
.pipe(bintray(bintrayopts))
//.pipe(clean())
});
// Upload to the temporary ftp location
gulp.task( 'ftpdeploy',['copyfiles'],function () {
var conn = ftp.create( {
host: 'ftp.proterra.me.uk',
user: 'mbwhite',
password: logins.ftppwd,
parallel: 5,
log: gutil.log
} );
var globs = [
'dist/**/*'
];
// using base = '.' will transfer everything to /public_html correctly
// turn off buffering in gulp.src for best performance
return gulp.src( globs, { base: 'dist', buffer: false } )
.pipe( conn.newer( '/public_html/osprey-voting' ) ) // only upload newer files
.pipe( conn.dest( '/public_html/osprey-voting' ) )
} );