Переглянути джерело

FileServer: add class documentation

Manfred Kroehnert 11 роки тому
батько
коміт
419d20cafa
2 змінених файлів з 29 додано та 0 видалено
  1. 1 0
      cli/js/AmberCli.js
  2. 28 0
      cli/st/AmberCli.st

+ 1 - 0
cli/js/AmberCli.js

@@ -159,6 +159,7 @@ smalltalk.AmberCli.klass);
 
 
 smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
+smalltalk.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a    FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a    FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol."
 smalltalk.addMethod(
 smalltalk.method({
 selector: "base64Decode:",

+ 28 - 0
cli/st/AmberCli.st

@@ -68,6 +68,34 @@ main
 Object subclass: #FileServer
 	instanceVariableNames: 'path http fs url host port basePath util username password fallbackPage'
 	package: 'AmberCli'!
+!FileServer commentStamp!
+I am the Amber Smalltalk FileServer.
+My runtime requirement is a functional Node.js executable.
+
+To start a FileServer instance on port `4000` use the following code:
+
+    FileServer new start
+
+A parameterized instance can be created with the following code:
+
+    FileServer createServerWithArguments: options
+
+Here, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.
+A list of all available parameters can be printed to the commandline by passing `--help` as parameter.
+See the `Options` section for further details on how options are mapped to instance methods.
+
+After startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.
+
+
+## Options
+
+Each option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.
+The trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.
+Afterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.
+
+## Adding new commandline parameters
+
+Adding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol.!
 
 !FileServer methodsFor: 'accessing'!