Browse Source

`amber init` runs `grunt`. Fixes #1009.

Herbert Vojčík 10 years ago
parent
commit
60fc490573

+ 2 - 1
external/amber-cli/package.json

@@ -40,7 +40,8 @@
     "grunt-init-amber": "~0.12.0",
     "grunt-init": "~0.3.1",
     "bower": "~1.3.2",
-    "amber-dev": "~0.1.1"
+    "amber-dev": "~0.1.1",
+    "grunt-cli": "~0.1.13"
   },
   "devDependencies": {
     "grunt": "~0.4.0",

+ 38 - 3
external/amber-cli/src/AmberCli.js

@@ -1457,6 +1457,27 @@ referencedClasses: []
 }),
 globals.Initer);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "gruntThenDo:",
+protocol: 'action',
+fn: function (aBlock){
+var self=this;
+var child;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+child=_st(self["@childProcess"])._exec_thenDo_(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","grunt"),aBlock);
+$1=_st(child)._stdout();
+$ctx1.sendIdx["stdout"]=1;
+_st($1)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
+return self}, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},globals.Initer)})},
+args: ["aBlock"],
+source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: (path join: nmPath with: '.bin' with: 'grunt')\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
+messageSends: ["exec:thenDo:", "join:with:with:", "pipe:options:", "stdout"],
+referencedClasses: []
+}),
+globals.Initer);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "initialize",
@@ -1524,7 +1545,7 @@ protocol: 'action',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4,$5,$6,$receiver;
+var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
 self._gruntInitThenDo_((function(error){
 return smalltalk.withContext(function($ctx2) {
 if(($receiver = error) == null || $receiver.isNil){
@@ -1534,12 +1555,26 @@ if(($receiver = error2) == null || $receiver.isNil){
 return self._npmInstallThenDo_((function(error3){
 return smalltalk.withContext(function($ctx4) {
 if(($receiver = error3) == null || $receiver.isNil){
+return self._gruntThenDo_((function(error4){
+return smalltalk.withContext(function($ctx5) {
+if(($receiver = error4) == null || $receiver.isNil){
+return _st(process)._exit();
+} else {
+$7=console;
+_st($7)._log_("grunt exec error:");
+$ctx5.sendIdx["log:"]=7;
+$8=_st($7)._log_(error4);
+$8;
 return _st(process)._exit();
+$ctx5.sendIdx["exit"]=4;
+};
+}, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)})}));
 } else {
 $5=console;
 _st($5)._log_("npm install exec error:");
 $ctx4.sendIdx["log:"]=5;
 $6=_st($5)._log_(error3);
+$ctx4.sendIdx["log:"]=6;
 $6;
 return _st(process)._exit();
 $ctx4.sendIdx["exit"]=3;
@@ -1569,8 +1604,8 @@ $ctx2.sendIdx["exit"]=1;
 }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)})}));
 return self}, function($ctx1) {$ctx1.fill(self,"start",{},globals.Initer)})},
 args: [],
-source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09process exit ]]]]]]",
-messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit", "bowerInstallThenDo:", "npmInstallThenDo:"],
+source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09process exit ]]]]]]]]",
+messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:"],
 referencedClasses: []
 }),
 globals.Initer);

+ 15 - 1
external/amber-cli/src/AmberCli.st

@@ -961,6 +961,14 @@ gruntInitThenDo: aBlock
 	process stdin pipe: child stdin options: #{ 'end' -> false }
 !
 
+gruntThenDo: aBlock
+	| child |
+	child := childProcess
+		exec: (path join: nmPath with: '.bin' with: 'grunt')
+		thenDo: aBlock.
+	child stdout pipe: process stdout options: #{ 'end' -> false }
+!
+
 npmInstallThenDo: aBlock
 	| child |
 	child := childProcess
@@ -988,7 +996,13 @@ start
 		process exit ]
 	ifNil: [
 
-	process exit ]]]]]]
+	self gruntThenDo: [ :error4 | error4
+	ifNotNil: [
+		console log: 'grunt exec error:'; log: error4.
+		process exit ]
+	ifNil: [
+
+	process exit ]]]]]]]]
 ! !
 
 !Initer methodsFor: 'initialization'!

+ 38 - 3
external/amber-cli/support/amber-cli.js

@@ -57756,6 +57756,27 @@ referencedClasses: []
 }),
 globals.Initer);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "gruntThenDo:",
+protocol: 'action',
+fn: function (aBlock){
+var self=this;
+var child;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+child=_st(self["@childProcess"])._exec_thenDo_(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","grunt"),aBlock);
+$1=_st(child)._stdout();
+$ctx1.sendIdx["stdout"]=1;
+_st($1)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
+return self}, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},globals.Initer)})},
+args: ["aBlock"],
+source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: (path join: nmPath with: '.bin' with: 'grunt')\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
+messageSends: ["exec:thenDo:", "join:with:with:", "pipe:options:", "stdout"],
+referencedClasses: []
+}),
+globals.Initer);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "initialize",
@@ -57823,7 +57844,7 @@ protocol: 'action',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4,$5,$6,$receiver;
+var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
 self._gruntInitThenDo_((function(error){
 return smalltalk.withContext(function($ctx2) {
 if(($receiver = error) == null || $receiver.isNil){
@@ -57833,12 +57854,26 @@ if(($receiver = error2) == null || $receiver.isNil){
 return self._npmInstallThenDo_((function(error3){
 return smalltalk.withContext(function($ctx4) {
 if(($receiver = error3) == null || $receiver.isNil){
+return self._gruntThenDo_((function(error4){
+return smalltalk.withContext(function($ctx5) {
+if(($receiver = error4) == null || $receiver.isNil){
 return _st(process)._exit();
 } else {
+$7=console;
+_st($7)._log_("grunt exec error:");
+$ctx5.sendIdx["log:"]=7;
+$8=_st($7)._log_(error4);
+$8;
+return _st(process)._exit();
+$ctx5.sendIdx["exit"]=4;
+};
+}, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)})}));
+} else {
 $5=console;
 _st($5)._log_("npm install exec error:");
 $ctx4.sendIdx["log:"]=5;
 $6=_st($5)._log_(error3);
+$ctx4.sendIdx["log:"]=6;
 $6;
 return _st(process)._exit();
 $ctx4.sendIdx["exit"]=3;
@@ -57868,8 +57903,8 @@ $ctx2.sendIdx["exit"]=1;
 }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)})}));
 return self}, function($ctx1) {$ctx1.fill(self,"start",{},globals.Initer)})},
 args: [],
-source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09process exit ]]]]]]",
-messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit", "bowerInstallThenDo:", "npmInstallThenDo:"],
+source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09process exit ]]]]]]]]",
+messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:"],
 referencedClasses: []
 }),
 globals.Initer);