1
0
Просмотр исходного кода

Merge remote-tracking branch 'upstream/amber-create' into extract-cli

Conflicts:
	package.json
Herbert Vojčík 11 лет назад
Родитель
Сommit
ca83ef1b70
5 измененных файлов с 509 добавлено и 126 удалено
  1. 5 1
      CHANGELOG
  2. 189 14
      cli/src/AmberCli.js
  3. 56 0
      cli/src/AmberCli.st
  4. 255 110
      cli/support/amber-cli.js
  5. 4 1
      package.json

+ 5 - 1
CHANGELOG

@@ -1,4 +1,4 @@
-??nd ??? 2014 - Release 0.12.4
+11th April 2014 - Release 0.12.4
 ===================================
 
 Highlights:
@@ -6,6 +6,10 @@ Highlights:
 * Fixed backward compatibility for pre-0.12.3 loader syntax.
 * `namespace/_source` is not needed to map and is recommended
   not to use; `.st` files are by default committed to the `.js` location.
+* All sources, including js files into the src/ directory
+* Many improvements in Helios, especially in its debugger and
+  inspector, as well as UI-related improvements
+* New Helios dark theme by @BenjaminVanRyseghem
 
 Commits: https://github.com/amber-smalltalk/amber/compare/0.12.3...0.12.4
 Issues:  https://github.com/amber-smalltalk/amber/issues?milestone=12&state=closed

+ 189 - 14
cli/src/AmberCli.js

@@ -81,6 +81,23 @@ referencedClasses: ["Transcript"]
 }),
 globals.AmberCli.klass);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "init:",
+protocol: 'commands',
+fn: function (args){
+var self=this;
+function $Initer(){return globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
+return smalltalk.withContext(function($ctx1) { 
+_st(_st($Initer())._new())._start();
+return self}, function($ctx1) {$ctx1.fill(self,"init:",{args:args},globals.AmberCli.klass)})},
+args: ["args"],
+source: "init: args\x0a\x09Initer new start",
+messageSends: ["start", "new"],
+referencedClasses: ["Initer"]
+}),
+globals.AmberCli.klass);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "main",
@@ -262,7 +279,7 @@ var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $2,$1,$receiver;
 $2=self["@basePath"];
-if(($receiver = $2) == nil || $receiver == null){
+if(($receiver = $2) == null || $receiver.isNil){
 $1=_st(self._class())._defaultBasePath();
 } else {
 $1=$2;
@@ -530,7 +547,8 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-globals.FileServer.superclass.fn.prototype._initialize.apply(_st(self), []);
+($ctx1.supercall = true, globals.FileServer.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
 self["@path"]=self._require_("path");
 $ctx1.sendIdx["require:"]=1;
 self["@http"]=self._require_("http");
@@ -576,7 +594,7 @@ return true;
 };
 $3=_st(_st(aRequest)._headers())._at_("authorization");
 $ctx1.sendIdx["at:"]=1;
-if(($receiver = $3) == nil || $receiver == null){
+if(($receiver = $3) == null || $receiver.isNil){
 header="";
 } else {
 header=$3;
@@ -587,7 +605,7 @@ return false;
 } else {
 $5=_st(header)._tokenize_(" ");
 $ctx1.sendIdx["tokenize:"]=1;
-if(($receiver = $5) == nil || $receiver == null){
+if(($receiver = $5) == null || $receiver.isNil){
 token="";
 } else {
 token=$5;
@@ -742,7 +760,7 @@ self._respondFileNamed_to_($3,aResponse);
 } else {
 $5=_st(_st(aUrl)._pathname()).__comma("/");
 $7=_st(aUrl)._search();
-if(($receiver = $7) == nil || $receiver == null){
+if(($receiver = $7) == null || $receiver.isNil){
 $6="";
 } else {
 $6=$7;
@@ -1001,7 +1019,7 @@ $2=self._basePath();
 $ctx1.sendIdx["basePath"]=1;
 _st($1)._stat_then_($2,(function(err,stat){
 return smalltalk.withContext(function($ctx2) {
-if(($receiver = err) == nil || $receiver == null){
+if(($receiver = err) == null || $receiver.isNil){
 $3=_st(stat)._isDirectory();
 if(! smalltalk.assert($3)){
 $4=console;
@@ -1304,7 +1322,7 @@ var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $2,$1,$receiver;
 $2=self["@mimeTypes"];
-if(($receiver = $2) == nil || $receiver == null){
+if(($receiver = $2) == null || $receiver.isNil){
 self["@mimeTypes"]=self._defaultMimeTypes();
 $1=self["@mimeTypes"];
 } else {
@@ -1366,6 +1384,162 @@ referencedClasses: []
 globals.FileServer.klass);
 
 
+smalltalk.addClass('Initer', globals.Object, ['path', 'childProcess', 'nmPath'], 'AmberCli');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "bowerInstallThenDo:",
+protocol: 'action',
+fn: function (aBlock){
+var self=this;
+var child;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+child=_st(self["@childProcess"])._exec_thenDo_(_st(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","bower")).__comma(" install"),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,"bowerInstallThenDo:",{aBlock:aBlock,child:child},globals.Initer)})},
+args: ["aBlock"],
+source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: (path join: nmPath with: '.bin' with: 'bower'), ' install'\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: "dirname",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return __dirname;
+return self}, function($ctx1) {$ctx1.fill(self,"dirname",{},globals.Initer)})},
+args: [],
+source: "dirname\x0a\x09<return __dirname>",
+messageSends: [],
+referencedClasses: []
+}),
+globals.Initer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "gruntInitThenDo:",
+protocol: 'action',
+fn: function (aBlock){
+var self=this;
+var child;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$3,$4,$2,$5,$6,$7;
+$1=self["@childProcess"];
+$3=_st(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","grunt-init")).__comma(" ");
+$4=_st(_st(_st(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
+$ctx1.sendIdx["replace:with:"]=1;
+$2=_st($3).__comma($4);
+$ctx1.sendIdx[","]=1;
+child=_st($1)._exec_thenDo_($2,aBlock);
+$5=_st(child)._stdout();
+$ctx1.sendIdx["stdout"]=1;
+_st($5)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
+$ctx1.sendIdx["pipe:options:"]=1;
+$6=_st(process)._stdin();
+$ctx1.sendIdx["stdin"]=1;
+_st($6)._resume();
+$7=_st(process)._stdin();
+$ctx1.sendIdx["stdin"]=2;
+_st($7)._pipe_options_(_st(child)._stdin(),globals.HashedCollection._newFromPairs_(["end",false]));
+return self}, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child},globals.Initer)})},
+args: ["aBlock"],
+source: "gruntInitThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: (path join: nmPath with: '.bin' with: 'grunt-init'), ' ', (((path join: nmPath with: 'grunt-init-amber') replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:')\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }.\x0a\x09process stdin resume.\x0a\x09process stdin pipe: child stdin options: #{ 'end' -> false }",
+messageSends: ["exec:thenDo:", ",", "join:with:with:", "replace:with:", "join:with:", "pipe:options:", "stdout", "resume", "stdin"],
+referencedClasses: []
+}),
+globals.Initer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.Initer.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
+self["@path"]=_st(require)._value_("path");
+$ctx1.sendIdx["value:"]=1;
+self["@childProcess"]=_st(require)._value_("child_process");
+self["@nmPath"]=_st(self["@path"])._join_with_(self._rootDirname(),"node_modules");
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Initer)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
+messageSends: ["initialize", "value:", "join:with:", "rootDirname"],
+referencedClasses: []
+}),
+globals.Initer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "rootDirname",
+protocol: 'private',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@path"])._join_with_with_(self._dirname(),"..","..");
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"rootDirname",{},globals.Initer)})},
+args: [],
+source: "rootDirname\x0a\x09^ path join: self dirname with: '..' with: '..'",
+messageSends: ["join:with:with:", "dirname"],
+referencedClasses: []
+}),
+globals.Initer);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "start",
+protocol: 'action',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3,$4,$receiver;
+self._gruntInitThenDo_((function(error){
+return smalltalk.withContext(function($ctx2) {
+if(($receiver = error) == null || $receiver.isNil){
+return self._bowerInstallThenDo_((function(error2){
+return smalltalk.withContext(function($ctx3) {
+if(($receiver = error2) == null || $receiver.isNil){
+error2;
+} else {
+$3=console;
+_st($3)._log_("bower install exec error:");
+$ctx3.sendIdx["log:"]=3;
+$4=_st($3)._log_(error2);
+$4;
+};
+return _st(process)._exit();
+}, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)})}));
+} else {
+$1=console;
+_st($1)._log_("grunt-init exec error:");
+$ctx2.sendIdx["log:"]=1;
+$2=_st($1)._log_(error);
+$ctx2.sendIdx["log:"]=2;
+$2;
+return _st(process)._exit();
+$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 |\x0a\x09\x09error ifNotNil: [ console log: 'grunt-init exec error:'; log: error. process exit ]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09self bowerInstallThenDo: [ :error2 |\x0a\x09\x09\x09\x09error2 ifNotNil: [ console log: 'bower install exec error:'; log: error2 ].\x0a\x09\x09\x09\x09process exit ]]]",
+messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit", "bowerInstallThenDo:", "ifNotNil:"],
+referencedClasses: []
+}),
+globals.Initer);
+
+
+
 smalltalk.addClass('NodeTestRunner', globals.Object, [], 'AmberCli');
 
 smalltalk.addMethod(
@@ -1527,7 +1701,7 @@ var $3,$4,$2,$1,$receiver;
 $1=self._parseAssignment_do_(buffer,(function(name,expr){
 var varName,value;
 return smalltalk.withContext(function($ctx2) {
-if(($receiver = name) == nil || $receiver == null){
+if(($receiver = name) == null || $receiver.isNil){
 varName=self._nextResultName();
 } else {
 varName=name;
@@ -1538,7 +1712,7 @@ self["@session"];
 _st((function(){
 return smalltalk.withContext(function($ctx3) {
 $3=_st(varName).__comma(" := ");
-if(($receiver = expr) == nil || $receiver == null){
+if(($receiver = expr) == null || $receiver.isNil){
 $4=buffer;
 } else {
 $4=expr;
@@ -1776,7 +1950,8 @@ fn: function (){
 var self=this;
 function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
 return smalltalk.withContext(function($ctx1) { 
-globals.Repl.superclass.fn.prototype._initialize.apply(_st(self), []);
+($ctx1.supercall = true, globals.Repl.superclass.fn.prototype._initialize.apply(_st(self), []));
+$ctx1.supercall = false;
 self["@session"]=_st($DoIt())._new();
 self["@readline"]=_st(require)._value_("readline");
 $ctx1.sendIdx["value:"]=1;
@@ -1800,7 +1975,7 @@ return smalltalk.withContext(function($ctx1) {
 var $2,$3,$1,$receiver;
 $2=_st(aClass)._superclass();
 $ctx1.sendIdx["superclass"]=1;
-if(($receiver = $2) == nil || $receiver == null){
+if(($receiver = $2) == null || $receiver.isNil){
 $1=_st(aClass)._instanceVariableNames();
 } else {
 $3=_st(aClass)._instanceVariableNames();
@@ -1861,7 +2036,7 @@ var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2,$receiver;
 $1=self["@resultCount"];
-if(($receiver = $1) == nil || $receiver == null){
+if(($receiver = $1) == null || $receiver.isNil){
 self["@resultCount"]=(1);
 } else {
 self["@resultCount"]=_st(self["@resultCount"]).__plus((1));
@@ -2095,7 +2270,7 @@ return smalltalk.withContext(function($ctx1) {
 var $receiver;
 _st(_st(process)._stdin())._on_do_("keypress",(function(s,key){
 return smalltalk.withContext(function($ctx2) {
-if(($receiver = key) == nil || $receiver == null){
+if(($receiver = key) == null || $receiver.isNil){
 return key;
 } else {
 return self._onKeyPress_(key);
@@ -2140,7 +2315,7 @@ $3=_st(aClass)._name();
 $ctx1.sendIdx["name"]=1;
 $2=_st($3)._matchesOf_("\x5cd+$");
 $ctx1.sendIdx["matchesOf:"]=1;
-if(($receiver = $2) == nil || $receiver == null){
+if(($receiver = $2) == null || $receiver.isNil){
 $1=_st(_st(aClass)._name()).__comma("2");
 } else {
 var counter;

+ 56 - 0
cli/src/AmberCli.st

@@ -60,6 +60,10 @@ help: args
 	self commandLineSwitches do: [ :each | console log: each ]
 !
 
+init: args
+	Initer new start
+!
+
 repl: args
 	^ Repl new createInterface
 !
@@ -933,6 +937,58 @@ main
 		^ fileServer start]
 ! !
 
+Object subclass: #Initer
+	instanceVariableNames: 'path childProcess nmPath'
+	package: 'AmberCli'!
+
+!Initer methodsFor: 'action'!
+
+bowerInstallThenDo: aBlock
+	| child |
+	child := childProcess
+		exec: (path join: nmPath with: '.bin' with: 'bower'), ' install'
+		thenDo: aBlock.
+	child stdout pipe: process stdout options: #{ 'end' -> false }
+!
+
+gruntInitThenDo: aBlock
+	| child |
+	child := childProcess
+		exec: (path join: nmPath with: '.bin' with: 'grunt-init'), ' ', (((path join: nmPath with: 'grunt-init-amber') replace: '\\' with: '\\') replace: ':' with: '\:')
+		thenDo: aBlock.
+	child stdout pipe: process stdout options: #{ 'end' -> false }.
+	process stdin resume.
+	process stdin pipe: child stdin options: #{ 'end' -> false }
+!
+
+start
+	self gruntInitThenDo: [ :error |
+		error ifNotNil: [ console log: 'grunt-init exec error:'; log: error. process exit ]
+		ifNil: [
+			self bowerInstallThenDo: [ :error2 |
+				error2 ifNotNil: [ console log: 'bower install exec error:'; log: error2 ].
+				process exit ]]]
+! !
+
+!Initer methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	path := require value: 'path'.
+	childProcess := require value: 'child_process'.
+	nmPath := path join: self rootDirname with: 'node_modules'
+! !
+
+!Initer methodsFor: 'private'!
+
+dirname
+	<return __dirname>
+!
+
+rootDirname
+	^ path join: self dirname with: '..' with: '..'
+! !
+
 Object subclass: #NodeTestRunner
 	instanceVariableNames: ''
 	package: 'AmberCli'!

Разница между файлами не показана из-за своего большого размера
+ 255 - 110
cli/support/amber-cli.js


+ 4 - 1
package.json

@@ -35,7 +35,10 @@
   "dependencies": {
     "es6-promise": "~0.1.1",
     "amdefine": "0.0.8",
-    "amber": "~0.12.4"
+    "amber": "~0.12.4",
+    "grunt-init-amber": "git://github.com/amber-smalltalk/grunt-init-amber.git",
+    "grunt-init": "~0.3.1",
+    "bower": "~1.3.2"
   },
   "devDependencies": {
     "grunt": "~0.4.0",

Некоторые файлы не были показаны из-за большого количества измененных файлов