Skip to content

Commit

Permalink
[fix] Dynamic VERSION definition based on package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Southern committed Jul 12, 2013
1 parent 7e48ec4 commit 4831602
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.PHONY: all clean

all:
@mkdir -p build
cat version.gypi | sed -e 's/{{VERSION}}/'$(shell cat package.json | grep -i version | grep -oE "\"[^\"]+\",*$$" | grep -oE "[0-9a-z\.\+\-]+")'/' > ./build/version.gypi
node-gyp configure build

clean:
Expand Down
3 changes: 3 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
'includes': [
'build/version.gypi'
],
'targets': [
{
'target_name': 'x509',
Expand Down
2 changes: 0 additions & 2 deletions include/addon.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef __addon_h
#define __addon_h

#define VERSION "0.0.1"

#include <cstdlib>
#include <cstdio>

Expand Down
7 changes: 7 additions & 0 deletions version.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
'target_defaults': {
'defines': [
'VERSION="{{VERSION}}"'
]
}
}

0 comments on commit 4831602

Please sign in to comment.