-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathindex.js
More file actions
43 lines (36 loc) · 1.58 KB
/
index.js
File metadata and controls
43 lines (36 loc) · 1.58 KB
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
'use strict';
var BinWrapper = require('bin-wrapper');
var chalk = require('chalk');
var fs = require('fs');
var path = require('path');
/**
* Initialize a new BinWrapper
*/
var bin = new BinWrapper({ global: false })
.src('https://raw.github.com/toshgoodson/pandoc-bin/0.1.0/vendor/osx/pandoc', 'darwin')
.src('https://raw.github.com/toshgoodson/pandoc-bin/0.1.0/vendor/linux/x86/pandoc', 'linux', 'x86')
.src('https://raw.github.com/toshgoodson/pandoc-bin/0.1.0/vendor/linux/x64/pandoc', 'linux', 'x64')
.src('https://raw.github.com/toshgoodson/pandoc-bin/0.1.0/vendor/win/pandoc.exe', 'win32')
.dest(path.join(__dirname, 'vendor'))
.use(process.platform === 'win32' ? 'pandoc.exe' : 'pandoc');
/**
* Only run check if binary doesn't already exist
*/
fs.exists(bin.path(), function (exists) {
if (!exists) {
console.log(chalk.yellow('⧗ Downloading Pandoc (~20-50MB depending on OS). This may take a minute or so.'));
bin.run(['--version'], function (err) {
if (err) {
console.log(chalk.red('✗ pre-build test failed'));
console.log(chalk.red("⚠ I don't have a working binary for your system. If you believe I am incorrect about this or if you want to request a binary for your system, please file an issue on this module's github page. ⚠"));
console.log(chalk.yellow('As an alternative to this module, please refer to http://johnmacfarlane.net/pandoc/installing.html for installing Pandoc on your system.'));
} else {
console.log(chalk.green('✓ pre-build test passed successfully'));
}
});
}
});
/**
* Module exports
*/
module.exports.path = bin.path();