1
0
Kaynağa Gözat

AmberCli: check if required version of Node.js is used

Manfred Kroehnert 12 yıl önce
ebeveyn
işleme
07907108b1
4 değiştirilmiş dosya ile 236 ekleme ve 202 silme
  1. 16 11
      cli/js/AmberCli.deploy.js
  2. 72 65
      cli/js/AmberCli.js
  3. 139 125
      cli/js/amber-cli.js
  4. 9 1
      cli/st/AmberCli.st

+ 16 - 11
cli/js/AmberCli.deploy.js

@@ -62,20 +62,27 @@ smalltalk.method({
 selector: "main",
 selector: "main",
 fn: function (){
 fn: function (){
 var self=this;
 var self=this;
-var args;
+var args,nodeMinorVersion;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2;
+var $1,$2,$3;
+nodeMinorVersion=_st(_st(_st(_st(process)._version())._tokenize_("."))._second())._asNumber();
+$1=_st(nodeMinorVersion).__lt((8));
+if(smalltalk.assert($1)){
+_st(console)._log_(_st("You are currently using Node.js ").__comma(_st(process)._version()));
+_st(console)._log_("Required is at least Node.js v0.8.x or greater.");
+return (-1);
+};
 args=_st(process)._argv();
 args=_st(process)._argv();
 _st(args)._removeFrom_to_((1),(3));
 _st(args)._removeFrom_to_((1),(3));
-$1=_st(args)._isEmpty();
-if(smalltalk.assert($1)){
+$2=_st(args)._isEmpty();
+if(smalltalk.assert($2)){
 _st(self)._help_(nil);
 _st(self)._help_(nil);
 } else {
 } else {
-$2=_st(self)._handleArguments_(args);
-return $2;
+$3=_st(self)._handleArguments_(args);
+return $3;
 };
 };
-return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args},smalltalk.AmberCli.klass)})},
-messageSends: ["argv", "removeFrom:to:", "ifTrue:ifFalse:", "help:", "handleArguments:", "isEmpty"]}),
+return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},smalltalk.AmberCli.klass);});},
+messageSends: ["asNumber", "second", "tokenize:", "version", "ifTrue:", "log:", ",", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "help:", "handleArguments:", "isEmpty"]}),
 smalltalk.AmberCli.klass);
 smalltalk.AmberCli.klass);
 
 
 smalltalk.addMethod(
 smalltalk.addMethod(
@@ -772,9 +779,7 @@ selector: "defaultPort",
 fn: function (){
 fn: function (){
 var self=this;
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=(4000);
-return $1;
+return (4000);
 }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
 }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
 messageSends: []}),
 messageSends: []}),
 smalltalk.FileServer.klass);
 smalltalk.FileServer.klass);

Dosya farkı çok büyük olduğundan ihmal edildi
+ 72 - 65
cli/js/AmberCli.js


Dosya farkı çok büyük olduğundan ihmal edildi
+ 139 - 125
cli/js/amber-cli.js


+ 9 - 1
cli/st/AmberCli.st

@@ -73,7 +73,15 @@ serve: args
 main
 main
 	"Main entry point for Amber applications.
 	"Main entry point for Amber applications.
 	Parses commandline arguments and starts the according subprogram."
 	Parses commandline arguments and starts the according subprogram."
-	| args |
+	| args nodeMinorVersion |
+
+	nodeMinorVersion := ((process version) tokenize: '.') second asNumber.
+	nodeMinorVersion < 8 ifTrue: [
+		console log: 'You are currently using Node.js ', (process version).
+		console log: 'Required is at least Node.js v0.8.x or greater.'.
+		^ -1.
+	].
+
 	args := process argv.
 	args := process argv.
 	"Remove the first args which contain the path to the node executable and the script file."
 	"Remove the first args which contain the path to the node executable and the script file."
 	args removeFrom: 1 to: 3.
 	args removeFrom: 1 to: 3.

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor