-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #188, upgrade to Asciidoctor.js 1.5.6-rc.1
* Remove 'bestikk-opal-compiler' dependency (we now use 'opal-compiler' directly) * Remove async dependency (not used anymore) * Simplify build scripts and use ECMAScript 6 syntax * Run the task examples on Travis * The examples task does not run the task build anymore
- Loading branch information
1 parent
3d2a945
commit 249e026
Showing
8 changed files
with
592 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,39 @@ | ||
var Builder = require('./builder.js'); | ||
var builder = new Builder(); | ||
const log = require('bestikk-log'); | ||
const bfs = require('bestikk-fs'); | ||
const CompilerModule = require('./compiler.js'); | ||
|
||
builder.build(); | ||
const clean = function () { | ||
log.task('clean'); | ||
removeBuildDirSync(); // remove build directory | ||
}; | ||
|
||
const removeBuildDirSync = function () { | ||
log.debug('remove build directory'); | ||
bfs.removeSync('build'); | ||
bfs.mkdirsSync('build'); | ||
}; | ||
|
||
const compile = function () { | ||
CompilerModule.compile(); | ||
}; | ||
|
||
const copyToDist = function () { | ||
log.task('copy to dist/'); | ||
removeDistDirSync(); | ||
bfs.copySync('build/asciidoctor-reveal.js', 'dist/main.js'); | ||
}; | ||
|
||
const removeDistDirSync = function () { | ||
log.debug('remove dist directory'); | ||
bfs.removeSync('dist'); | ||
bfs.mkdirsSync('dist'); | ||
}; | ||
|
||
if (process.env.SKIP_BUILD) { | ||
log.info('SKIP_BUILD environment variable is true, skipping "build" task'); | ||
return; | ||
} | ||
|
||
clean(); | ||
compile(); | ||
copyToDist(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const fs = require('fs'); | ||
const log = require('bestikk-log'); | ||
const OpalBuilder = require('opal-compiler').Builder; | ||
|
||
module.exports.compile = function () { | ||
log.task('compile'); | ||
|
||
const opalBuilder = OpalBuilder.create(); | ||
opalBuilder.appendPaths('lib'); | ||
opalBuilder.setCompilerOptions({dynamic_require_severity: 'ignore'}); | ||
const module = 'asciidoctor-revealjs'; | ||
log.debug(module); | ||
const data = opalBuilder.build(module).toString(); | ||
fs.writeFileSync('build/asciidoctor-reveal.js', data, 'utf8'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,29 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const log = require('bestikk-log'); | ||
const Builder = require('./builder.js'); | ||
const builder = new Builder(); | ||
|
||
const examplesDir = 'examples'; | ||
|
||
log.task('examples'); | ||
builder.examples(); | ||
|
||
// Load asciidoctor.js and local asciidoctor-reveal.js | ||
const asciidoctor = require('asciidoctor.js')(); | ||
require('../build/asciidoctor-reveal.js'); | ||
|
||
// Convert *a* document using the reveal.js converter | ||
var attributes = {'revealjsdir': 'node_modules/reveal.js@'}; | ||
var options = {safe: 'safe', backend: 'revealjs', attributes: attributes, to_dir: examplesDir}; | ||
|
||
fs.readdir(examplesDir, (err, files) => { | ||
files.forEach(function (filename) { | ||
if (path.extname(filename) === '.adoc') { | ||
try { | ||
asciidoctor.convertFile(path.join(examplesDir, filename), options); | ||
log.info(`Successfully converted ${filename}`); | ||
} | ||
catch (err) { | ||
log.error(`Error converting ${filename}: ${err}`); | ||
} | ||
} | ||
}); | ||
}); |
Oops, something went wrong.