Parcourir la source

Merge branch 'bug-755' of https://github.com/tomrake/amber

Conflicts:
	cli/js/AmberCli.js
	cli/st/AmberCli.st
Nicolas Petton il y a 10 ans
Parent
commit
d98168eba5
3 fichiers modifiés avec 444 ajouts et 217 suppressions
  1. 32 19
      cli/js/AmberCli.js
  2. 7 2
      cli/st/AmberCli.st
  3. 405 196
      cli/support/amber-cli.js

+ 32 - 19
cli/js/AmberCli.js

@@ -252,13 +252,8 @@ protocol: 'initialization',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-var $2,$4,$3,$1,$6,$8,$7,$5,$9;
-$2=self["@fs"];
-$4=self._basePath();
-$ctx1.sendIdx["basePath"]=1;
-$3=_st($4).__comma("index.html");
-$ctx1.sendIdx[","]=1;
-$1=_st($2)._existsSync_($3);
+var $1,$3,$5,$4,$2,$6;
+$1=_st(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
 $ctx1.sendIdx["existsSync:"]=1;
 if(! smalltalk.assert($1)){
 _st(console)._warn_("Warning: project directory does not contain index.html.");
@@ -268,27 +263,27 @@ $ctx1.sendIdx["warn:"]=2;
 };
 _st(console)._warn_("    You can also specify a page to be served by default,");
 $ctx1.sendIdx["warn:"]=3;
-_st(console)._warn_("        for all paths the do not map to file, with --fallback-page.");
+_st(console)._warn_("    for all paths that do not map to a file, with --fallback-page.");
 $ctx1.sendIdx["warn:"]=4;
-$6=self["@fs"];
-$8=self._basePath();
-$ctx1.sendIdx["basePath"]=2;
-$7=_st($8).__comma("st");
-$ctx1.sendIdx[","]=2;
-$5=_st($6)._existsSync_($7);
+$3=self["@fs"];
+$5=self._basePath();
+$ctx1.sendIdx["basePath"]=1;
+$4=_st($5).__comma("st");
+$ctx1.sendIdx[","]=1;
+$2=_st($3)._existsSync_($4);
 $ctx1.sendIdx["existsSync:"]=2;
-if(! smalltalk.assert($5)){
+if(! smalltalk.assert($2)){
 _st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
 $ctx1.sendIdx["warn:"]=5;
 };
-$9=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("js"));
-if(! smalltalk.assert($9)){
+$6=_st(self["@fs"])._existsSync_(_st(self._basePath()).__comma("js"));
+if(! smalltalk.assert($6)){
 _st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
 };
 return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
 args: [],
-source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: '    You can specify the directory containing index.html with --base-path.'.].\x0a\x09\x09console warn: '    You can also specify a page to be served by default,'.\x0a\x09\x09console warn: '        for all paths the do not map to file, with --fallback-page.'.\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
-messageSends: ["ifFalse:", "existsSync:", ",", "basePath", "warn:"],
+source: "checkDirectoryLayout\x0a\x09(fs existsSync:\x09(self withBasePath: 'index.html')) ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: '    You can specify the directory containing index.html with --base-path.'.].\x0a\x09\x09console warn: '    You can also specify a page to be served by default,'.\x0a\x09\x09console warn: '    for all paths that do not map to a file, with --fallback-page.'.\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
+messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:", ",", "basePath"],
 referencedClasses: []
 }),
 smalltalk.FileServer);
@@ -933,6 +928,24 @@ referencedClasses: []
 }),
 smalltalk.FileServer);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "withBasePath:",
+protocol: 'private',
+fn: function (aBaseRelativePath){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},smalltalk.FileServer)})},
+args: ["aBaseRelativePath"],
+source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^\x09path join: self basePath with: aBaseRelativePath",
+messageSends: ["join:with:", "basePath"],
+referencedClasses: []
+}),
+smalltalk.FileServer);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "writeData:toFileNamed:",

+ 7 - 2
cli/st/AmberCli.st

@@ -168,11 +168,11 @@ username: aUsername
 !FileServer methodsFor: 'initialization'!
 
 checkDirectoryLayout
-	(fs existsSync: self basePath, 'index.html') ifFalse: [
+	(fs existsSync:	(self withBasePath: 'index.html')) ifFalse: [
 		console warn: 'Warning: project directory does not contain index.html.'.
 		console warn: '    You can specify the directory containing index.html with --base-path.'.].
 		console warn: '    You can also specify a page to be served by default,'.
-		console warn: '        for all paths the do not map to file, with --fallback-page.'.
+		console warn: '    for all paths that do not map to a file, with --fallback-page.'.
 	(fs existsSync: self basePath, 'st') ifFalse: [
 		console warn: 'Warning: project directory is missing an "st" directory'].
 	(fs existsSync: self basePath, 'js') ifFalse: [
@@ -229,6 +229,11 @@ require: aModuleString
 	^require value: aModuleString
 !
 
+withBasePath: aBaseRelativePath
+	"return a file path which is relative to the basePath."
+	^	path join: self basePath with: aBaseRelativePath
+!
+
 writeData: data toFileNamed: aFilename
 	console log: aFilename
 ! !

Fichier diff supprimé car celui-ci est trop grand
+ 405 - 196
cli/support/amber-cli.js


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff