Skip to content

Commit

Permalink
fix(phantomjs binary): fixed PR grafana#2832 so that it works on linu…
Browse files Browse the repository at this point in the history
…x, now phantomjs based server side rendershould work on mac and linux, maybe even windows
  • Loading branch information
torkelo committed Sep 29, 2015
1 parent 8b02938 commit 81a660e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ awsconfig
/emails/dist
/public_gen
/tmp
vendor/phantomjs/phantomjs

docs/AWS_S3_BUCKET
docs/GIT_BRANCH
Expand Down
15 changes: 9 additions & 6 deletions tasks/options/phantomjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ module.exports = function(config,grunt) {

var m=grunt.file.read(confDir+"location.js")
var src=/= \"([^\"]*)\"/.exec(m)[1];

if (!grunt.file.isPathAbsolute(src)) {
src = confDir+src;
}

var exec = require('child_process').execFileSync;

try {
var ph=exec(src,['-v'], { stdio: 'ignore' });
grunt.verbose.writeln('Using '+ src);
grunt.file.copy(src, dest, { encoding: null });
grunt.config('copy.phantom_bin', {
src: src,
dest: dest,
options: { mode: true},
});
grunt.task.run('copy:phantom_bin');
} catch (err) {
grunt.verbose.writeln(err);
grunt.fail.warn('No working Phantomjs binary available')
}

} else {
grunt.log.writeln('Phantomjs already imported from node');
grunt.log.writeln('Phantomjs already imported from node');
}
});
};

0 comments on commit 81a660e

Please sign in to comment.