Skip to content

Commit

Permalink
more work on gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
vankasteelj committed Apr 3, 2016
1 parent 7dd514f commit c8f8458
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 81 deletions.
46 changes: 19 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
cache/
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

.idea/
*.iml

# build files
node_modules/
src/app/vendor
src/app/themes
build/
cache/
dist/windows/*-Setup.exe
dist/windows/update.exe
dist/linux/linux-installer
dist/linux/*.deb
src/app/css/app.css
*git.json

# temp files
pids
logs
results

npm-debug.log

app.nw

.sass-cache
*-ck.js
*.srt
*.DS_Store

# vim swap files
lib-cov
.idea/
*.swp

src/app/css/app.css
*.sublime-*
dist/windows/*-Setup.exe
dist/windows/update.exe
dist/linux/linux-installer
dist/linux/*.deb
*.bat
*.db
*git.json
*openvpn*
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.iml
21 changes: 5 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,17 @@ The [master](https://github.com/butterproject/butter-desktop) branch which conta

#### Quickstart with `npm start`:

1. `npm install -g grunt-cli bower`
2. `npm start` (this runs `npm install && grunt build && grunt start` for you)
1. `npm install -g gulp-cli bower`
2. `npm start` (this runs `npm install && gulp build && gulp run` for you)

If you want to use the more granular control over whats getting run, use this:

#### Quickstart:

1. `npm install -g grunt-cli bower`
1. `npm install -g gulp-cli bower`
2. `npm install`
3. `grunt build`
4. `grunt start`

If you encounter trouble with the above method, you can try:

1. `npm install -g bower grunt-cli` (Linux: you may need to run with `sudo`)
1. `cd desktop`
1. `npm install`
1. `bower install`
1. `grunt lang`
1. `grunt nwjs`
1. `grunt css`
1. `grunt start`
3. `gulp build`
4. `gulp run`

Optionally, you may simply run `./make_butter.sh` if you are on a Linux or Mac based operating system.

Expand Down
63 changes: 33 additions & 30 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,63 @@
var availablePlatforms = [
'linux32',
'linux64',
'win32',
'osx64'
];

/* variables */
var nwVersion = '0.12.3';

var availablePlatforms = ['linux32', 'linux64', 'win32', 'osx64'];

/* gulpfile */
var gulp = require('gulp'),
nwBuilder = require('nw-builder'),
yargs = require('yargs'),
nib = require('nib'),
stylus = require('gulp-stylus'),
currentPlatform = require('nw-builder/lib/detectCurrentPlatform.js'),
argv = require('yargs').argv,
pkJson = require('./package.json'),
parsePlatforms = function () {
var req = argv.platforms.split(','), avail = [];
var req = yargs.argv.platforms.split(','), avail = [];
for (var pl in req) {
if (availablePlatforms.indexOf(req[pl]) !== -1) {
avail.push(req[pl]);
}
}
return avail;
return req[0] === 'all' ? availablePlatforms : avail;
};

var nw = new nwBuilder({
files: [],
version: nwVersion,
platforms: argv.platforms ? parsePlatforms() : [currentPlatform()],
buildType: 'versioned',
zip: false,
macIcns: './src/app/images/butter.icns',
quiet: true
version: nwVersion,
platforms: yargs.argv.platforms ? parsePlatforms() : [currentPlatform()],
}).on('log', console.log);

// link default task to 'build'
gulp.task('default', ['build']);
/* gulp tasks */
gulp.task('default', ['run']);
gulp.task('build', ['css', 'nwjs']);

gulp.task('nwjs', function () { // download and compile nwjs
// required files
nw.options.files = ['./src/**', '!./src/app/styl/**', './node_modules/**', '!./node_modules/**/*.bin', './package.json', './README.md', './CHANGELOG.md', './LICENSE.txt', './.git.json'];
// remove junk files
nw.options.files = nw.options.files.concat(['!./node_modules/**/*.c', '!./node_modules/**/*.h', '!./node_modules/**/Makefile', '!./node_modules/**/*.h', '!./**/test*/**', '!./**/doc*/**', '!./**/example*/**', '!./**/demo*/**', '!./**/bin/**', '!./**/build/**', '!./**/.*/**']);
// remove devdeps
for (var dep in pkJson.devDependencies) {
nw.options.files = nw.options.files.concat(['!./node_modules/'+dep+'/**']);
}

gulp.task('build', function () {
nw.options.files = ['./src/**', '!./src/app/styl/**',
'./node_modules/**', '!./node_modules/bower/**',
'!./node_modules/*grunt*/**', '!./node_modules/stylus/**',
'!./node_modules/nw-gyp/**', '!./node_modules/**/*.bin',
'!./node_modules/**/*.c', '!./node_modules/**/*.h',
'!./node_modules/**/Makefile', '!./node_modules/**/*.h',
'!./**/test*/**', '!./**/doc*/**', '!./**/example*/**',
'!./**/demo*/**', '!./**/bin/**', '!./**/build/**', '!./**/.*/**',
'./package.json', './README.md', './CHANGELOG.md', './LICENSE.txt',
'./.git.json'
];
return nw.build().catch(function(error) {
console.error(error);
});
});

gulp.task('run', function () {
gulp.task('run', function () { // run nwjs
nw.options.files = './**';
return nw.run().catch(function(error) {
console.error(error);
});
});

gulp.task('css', function () { // compile styl
return gulp.src('src/app/styl/*.styl')
.pipe(stylus({
use: nib()
}))
.pipe(gulp.dest('src/app/themes/'));
});
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
"version": "0.3.8-5a",
"releaseName": "There's nothing on TV",
"scripts": {
"prestart": "npm install && grunt build && grunt start",
"postinstall": "node_modules/.bin/bower install --config.interactive=false && grunt setup",
"postupdate": "node_modules/.bin/bower update --config.interactive=false && grunt setup",
"test": "grunt --verbose",
"start": "nw"
"prestart": "npm install && gulp build && gulp run",
"postinstall": "node_modules/.bin/bower install --config.interactive=false",
"postupdate": "node_modules/.bin/bower update --config.interactive=false",
"start": "gulp"
},
"window": {
"title": "Butter",
Expand Down Expand Up @@ -76,11 +75,13 @@
"trakt.tv-ondeck": "0.x",
"underscore": "1.x.x",
"upnp-mediarenderer-client": "1.x.x",
"urijs": "1.x.x"
"urijs": "1.x.x",
"xmlbuilder": "4.1.0"
},
"devDependencies": {
"bower": "1.7.x",
"stylus": "0.x.x",
"gulp-stylus": "^2.3.1",
"nib": "^1.1.0",
"stylus": "^0.54.2",
"gulp": "^3.9.0",
"nw-builder": "^2.0.2",
"yargs": "^3.31.0"
Expand Down

0 comments on commit c8f8458

Please sign in to comment.