Git repo npmization: Do not use @VERSION

When the Git repository will be a npm package, there will be no
preprocessing step and thus no @VERSION substitution. Let's get rid of
it.

Part of a fix for GH-32.
redux
David Majda 12 years ago
parent d742ca5dc6
commit c6cf129635

@ -54,19 +54,12 @@ PREPROCESS=perl -e ' \
\ \
use File::Basename; \ use File::Basename; \
\ \
open(my $$f, "$(VERSION_FILE)") or die "Can\x27t open $(VERSION_FILE): $$!"; \
my $$PEGJS_VERSION = <$$f>; \
close($$f); \
chomp($$PEGJS_VERSION); \
\
sub preprocess { \ sub preprocess { \
my $$file = shift; \ my $$file = shift; \
my $$output = ""; \ my $$output = ""; \
\ \
open(my $$f, $$file) or die "Can\x27t open $$file: $$!"; \ open(my $$f, $$file) or die "Can\x27t open $$file: $$!"; \
while(<$$f>) { \ while(<$$f>) { \
s/\@VERSION/$$PEGJS_VERSION/g; \
\
if (/^\s*\/\/\s*\@include\s*"([^"]*)"\s*$$/) { \ if (/^\s*\/\/\s*\@include\s*"([^"]*)"\s*$$/) { \
$$output .= preprocess(dirname($$file) . "/" . $$1); \ $$output .= preprocess(dirname($$file) . "/" . $$1); \
next; \ next; \

@ -268,7 +268,7 @@ PEG.compiler.passes.generateCode = function(ast, options) {
grammar: [ grammar: [
'(function(){', '(function(){',
' /*', ' /*',
' * Generated by PEG.js @VERSION.', ' * Generated by PEG.js 0.7.0.',
' *', ' *',
' * http://pegjs.majda.cz/', ' * http://pegjs.majda.cz/',
' */', ' */',

@ -1,5 +1,5 @@
/* /*
* PEG.js @VERSION * PEG.js 0.7.0
* *
* http://pegjs.majda.cz/ * http://pegjs.majda.cz/
* *
@ -12,7 +12,7 @@ var PEG = (function(undefined) {
var PEG = { var PEG = {
/* PEG.js version (uses semantic versioning). */ /* PEG.js version (uses semantic versioning). */
VERSION: "@VERSION", VERSION: "0.7.0",
/* /*
* Generates a parser from a specified grammar and returns it. * Generates a parser from a specified grammar and returns it.

Loading…
Cancel
Save