Skip to content

Commit

Permalink
Merge pull request #536 from gibson042/2017-05-cli-output
Browse files Browse the repository at this point in the history
Improve CLI output
  • Loading branch information
tylerlong committed May 31, 2017
2 parents 952fe49 + ef07012 commit e08496d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
@@ -1,9 +1,7 @@
sudo: required
dist: trusty
addons:
apt:
packages:
- google-chrome-beta
chrome: stable
code_climate:
repo_token: e87e6bf1c253e0555437ebd23235fdfe2749b889358e7c6d100e4ea5b4f2e091
language: node_js
Expand Down
10 changes: 5 additions & 5 deletions lib/phantomscript.js
Expand Up @@ -63,10 +63,10 @@ page.content = [

page.injectJs('../dist/mermaid.js')
page.onConsoleMessage = function (msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")')
log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")')
}

console.log('Num files to execute : ' + files.length)
log('Num files to execute : ' + files.length)

files.forEach(function (file) {
var contents = fs.read(file)
Expand All @@ -75,7 +75,7 @@ files.forEach(function (file) {
var oDOM
var svgContent

console.log('ready to execute png: ' + filename + '.png ')
log('ready to execute: ' + file)

// this JS is executed in this statement is sandboxed, even though it doesn't
// look like it. we need to serialize then unserialize the svgContent that's
Expand All @@ -100,7 +100,7 @@ files.forEach(function (file) {
}

page.render(outputPath + '.png')
console.log('saved png: ' + filename + '.png')
log('saved png: ' + outputPath + '.png')
}

if (options.svg) {
Expand All @@ -109,7 +109,7 @@ files.forEach(function (file) {
, serialize.serializeToString(oDOM) + '\n'
, 'w'
)
log('saved svg: ' + filename + '.svg')
log('saved svg: ' + outputPath + '.svg')
}
})

Expand Down
5 changes: 3 additions & 2 deletions test/cli_test-samples.js
Expand Up @@ -4,6 +4,7 @@ const path = require('path')
const test = require('tape')
const rimraf = require('rimraf')

const localSearchPath = './node_modules/.bin' + path.delimiter + process.env.PATH
const testDir = 'test/fixtures/samples/'.replace('/', path.sep)
const phantomjs = 'node_modules/.bin/phantomjs '.replace('/', path.sep)
const loadHtmlSaveScreenshotPngScripts = testDir + path.sep + 'load_html_save_screenshot_png.phantomjs'
Expand All @@ -28,7 +29,7 @@ function execPhantomjsToLoadHtmlSaveScreenshotPng (html, verify) {
function execCmd (cmd, verify) {
console.log('cmd: ', cmd)
exec(cmd,
{ env: { PATH: './node_modules/.bin' + path.delimiter + process.env.PATH } },
{ env: Object.assign({}, process.env, { PATH: localSearchPath }) },
function (error, stdout, stderr) {
console.log('error:', error, '\nstdout:\n', stdout, '\nstderr:\n', stderr)
verify(error, stdout, stderr)
Expand Down Expand Up @@ -72,7 +73,7 @@ test.skip('sequence syntax error', function (t) {
});

['', 'fo', 'tspan', 'old'].forEach(function (textPlacement) {
test('sequence svg text placelment: ' + textPlacement, function (t) {
test('sequence svg text placement: ' + textPlacement, function (t) {
t.plan(2)
const args = ['--svg',
'--outputDir=' + testDir,
Expand Down

0 comments on commit e08496d

Please sign in to comment.