File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ var client = require('./lib/client.js');
2
2
3
3
var values = ( function ( ) {
4
4
var args = process . argv . splice ( 2 ) ;
5
-
6
5
if ( args . length == 0 ) {
7
6
console . log ( 'Usage: ./activity.js -t <timeout> -m "<message>"' ) ;
8
7
process . exit ( 1 ) ;
@@ -33,6 +32,14 @@ var values = (function(){
33
32
} ;
34
33
35
34
args . forEach ( function ( v , i ) {
35
+ if ( v == '-t' ) {
36
+ vals [ v ] = arg_parser [ v ] ( args [ i + 1 ] ) ;
37
+ } else if ( v == '-m' ) {
38
+ vals [ v ] = arg_parser [ v ] ( args . splice ( i + 1 ) . join ( " " ) ) ;
39
+ } else {
40
+ new Error ( "No argument for " + v ) ;
41
+ }
42
+ /*This suddenly stopped working when upgrading node
36
43
if(v.charAt(0)=='-'){
37
44
if(arg_parser[v]!==undefined){
38
45
if(args.length>=i+2){
@@ -44,6 +51,7 @@ var values = (function(){
44
51
throw Error('Could not parse arguments '+v);
45
52
}
46
53
}
54
+ */
47
55
} ) ;
48
56
return vals ;
49
57
} ( ) ) ;
@@ -60,6 +68,7 @@ var updater = new client.UpdateClient({
60
68
//,port : "3000"
61
69
} ) ;
62
70
71
+
63
72
updater . activity ( values [ '-m' ] , values [ '-t' ] , function ( res ) {
64
73
console . log ( 'STATUS: ' + res . statusCode ) ;
65
74
res . setEncoding ( 'utf8' ) ;
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
- node ../activity.js $*
3
+ # http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
4
+ source=" ${BASH_SOURCE[0]} "
5
+ while [ -h " $source " ]; do # resolve $source until the file is no longer a symlink
6
+ dir=" $( cd -P " $( dirname " $source " ) " && pwd ) "
7
+ source=" $( readlink " $source " ) "
8
+ # if $source was a relative symlink, we need to resolve
9
+ # it relative to the path where the symlink file was located
10
+ [[ $source != /* ]] && source=" $dir /$source "
11
+ done
12
+ dir=" $( cd -P " $( dirname " $source " ) " && pwd ) "
13
+
14
+ project_dir=" $( dirname " $dir " ) "
15
+
16
+
17
+ node $project_dir /activity.js $*
You can’t perform that action at this time.
0 commit comments