Skip to content

Commit

Permalink
download ceval sf from github releases
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Mar 20, 2017
1 parent 0783ee5 commit 99cf1ea
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project/project
project/target
public/trans
public/compiled
public/vendor/stockfish
public/images/?N-bg.svg
public/piece/alpha
public/piece/cburnett
Expand Down
7 changes: 0 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,12 @@
[submodule "public/vendor/shepherd"]
path = public/vendor/shepherd
url = https://github.com/HubSpot/shepherd
[submodule "public/vendor/stockfish.js"]
path = public/vendor/stockfish.js
url = https://github.com/niklasf/stockfish.js
[submodule "public/vendor/flatpickr"]
path = public/vendor/flatpickr
url = https://github.com/chmln/flatpickr
[submodule "public/vendor/bar-rating"]
path = public/vendor/bar-rating
url = https://github.com/antennaio/jquery-bar-rating
[submodule "public/vendor/stockfish.pexe"]
path = public/vendor/stockfish.pexe
url = https://github.com/niklasf/stockfish.pexe
branch = ddugovic
[submodule "public/vendor/jquery-textcomplete"]
path = public/vendor/jquery-textcomplete
url = https://github.com/yuku-t/jquery-textcomplete
1 change: 0 additions & 1 deletion public/vendor/stockfish.js
Submodule stockfish.js deleted from 96ca31
1 change: 0 additions & 1 deletion public/vendor/stockfish.pexe
Submodule stockfish.pexe deleted from a8bee1
6 changes: 3 additions & 3 deletions ui/ceval/src/ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ module.exports = function(opts) {
var isDeeper = m.prop(false);

var pool = makePool(stockfishProtocol, {
asmjs: '/assets/vendor/stockfish.js/stockfish.js?v=18',
pnacl: pnaclSupported && '/assets/vendor/stockfish.pexe/nacl/stockfish.nmf?v=16',
wasm: wasmSupported && '/assets/vendor/stockfish.js/stockfish.wasm.js?v=18',
asmjs: lichess.assetUrl('/assets/vendor/stockfish/stockfish.js'),
pnacl: pnaclSupported && lichess.assetUrl('/assets/vendor/stockfish/stockfish.nmf'),
wasm: wasmSupported && lichess.assetUrl('/assets/vendor/stockfish/stockfish.wasm.js'),
onCrash: opts.onCrash
}, {
minDepth: minDepth,
Expand Down
36 changes: 34 additions & 2 deletions ui/site/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var browserify = require('browserify');
var uglify = require('gulp-uglify');
var streamify = require('gulp-streamify');
var concat = require('gulp-concat');
var request = require('request');
var download = require('gulp-download-stream');

var destination = '../../public/compiled/';
var onError = function(error) {
Expand All @@ -31,6 +33,34 @@ gulp.task('ab', function() {
}
});

function latestGithubRelease(repo, cb) {
request({
url: 'https://api.github.com/repos/' + repo + '/releases/latest',
headers: {
'User-Agent': 'lila/gulpfile.js'
}
}, function(err, res, body) {
var release = JSON.parse(body);
cb(release.assets.map(function (asset) {
return asset.browser_download_url;
}));
});
}

gulp.task('stockfish.pexe', function() {
latestGithubRelease('niklasf/stockfish.pexe', function(urls) {
download(urls)
.pipe(gulp.dest('../../public/vendor/stockfish/'));
});
});

gulp.task('stockfish.js', function() {
latestGithubRelease('niklasf/stockfish.js', function(urls) {
download(urls)
.pipe(gulp.dest('../../public/vendor/stockfish/'));
});
});

gulp.task('prod-source', function() {
return browserify('./src/index.js', {
standalone: standalone
Expand Down Expand Up @@ -78,8 +108,10 @@ gulp.task('standalones', function() {
.pipe(gulp.dest(destination));
});

gulp.task('dev', ['jquery-fill', 'ab', 'standalones', 'dev-source'], makeBundle('lichess.site.source.js'));
gulp.task('prod', ['jquery-fill', 'ab', 'standalones', 'prod-source'], makeBundle('lichess.site.source.min.js'));
var tasks = ['jquery-fill', 'ab', 'standalones', 'stockfish.pexe', 'stockfish.js'];

gulp.task('dev', tasks.concat(['dev-source']), makeBundle('lichess.site.source.js'));
gulp.task('prod', tasks.concat(['prod-source']), makeBundle('lichess.site.source.min.js'));

gulp.task('default', ['dev'], function() {
return gulp.watch('src/*.js', ['dev']);
Expand Down
2 changes: 2 additions & 0 deletions ui/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"devDependencies": {
"browserify": "^14",
"gulp": "^3",
"gulp-download-stream": "0.0.13",
"gulp-streamify": "^1",
"gulp-uglify": "^2",
"gulp-util": "^3",
"request": "^2.81.0",
"uglify-js": "^2",
"vinyl-source-stream": "^1"
},
Expand Down

0 comments on commit 99cf1ea

Please sign in to comment.