From b1b51192f6989a661d0365fda844260506aa8a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Mon, 10 Jun 2024 11:23:54 +0200 Subject: [PATCH] Adding a command line for the blog --- .../ClapPillarArchetypeCommand.class.st | 16 +++--- .../ClapPillarBuildCommand.class.st | 12 ++-- .../ClapPillarCheckCommand.class.st | 12 ++-- src/Pillar-Cli/ClapPillarCommand.class.st | 18 +++--- .../ClapPillarGenerateTestsCommand.class.st | 12 ++-- .../ClapPillarServeCommand.class.st | 20 ++++--- .../ClapPillarUpdateBuildCommand.class.st | 14 +++-- .../ClapPillarUpdateTemplateCommand.class.st | 16 +++--- src/Pillar-Cli/PRAbstractCommand.class.st | 24 ++++---- .../PRArchetypeCommandLineHandler.class.st | 14 +++-- ...typeConfigurationInstallerCommand.class.st | 8 ++- .../PRBloggerCommandLineHandler.class.st | 55 +++++++++++++++++++ .../PRBuildCommandLineHandler.class.st | 16 +++--- src/Pillar-Cli/PRCommandLineHandler.class.st | 14 +++-- src/Pillar-Cli/PRDependencyCommand.class.st | 24 ++++---- .../PREvalCommandLineHandler.class.st | 12 ++-- ...RFileDependencyCommandLineHandler.class.st | 14 +++-- ...ImageDependencyCommandLineHandler.class.st | 14 +++-- .../PRServeCommandLineHandler.class.st | 12 ++-- .../PRSubCommandLineHandler.class.st | 32 ++++++----- ...RUpdateTemplateCommandLineHandler.class.st | 14 +++-- src/Pillar-Cli/PRWatcher.class.st | 20 ++++--- src/Pillar-Cli/package.st | 2 +- 23 files changed, 246 insertions(+), 149 deletions(-) create mode 100644 src/Pillar-Cli/PRBloggerCommandLineHandler.class.st diff --git a/src/Pillar-Cli/ClapPillarArchetypeCommand.class.st b/src/Pillar-Cli/ClapPillarArchetypeCommand.class.st index 13106d91..3b03c14d 100644 --- a/src/Pillar-Cli/ClapPillarArchetypeCommand.class.st +++ b/src/Pillar-Cli/ClapPillarArchetypeCommand.class.st @@ -5,17 +5,19 @@ The pillar project contains a basic template and skeleton pillar files following **Example of usage: **`./pillar archetype book` " Class { - #name : #ClapPillarArchetypeCommand, - #superclass : #ClapPillarCommand, - #category : #'Pillar-Cli-Clap' + #name : 'ClapPillarArchetypeCommand', + #superclass : 'ClapPillarCommand', + #category : 'Pillar-Cli-Clap', + #package : 'Pillar-Cli', + #tag : 'Clap' } -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarArchetypeCommand class >> commandName [ ^'archetype' ] -{ #category : #'command line' } +{ #category : 'command line' } ClapPillarArchetypeCommand class >> commandSpecification [ ^ (ClapCommand id: self commandName asSymbol) @@ -31,12 +33,12 @@ ClapPillarArchetypeCommand class >> commandSpecification [ (self with: args) execute ] ] -{ #category : #execution } +{ #category : 'execution' } ClapPillarArchetypeCommand >> execute [ self project installArchetypeNamed: self requestedArchetype asString. ] -{ #category : #activation } +{ #category : 'activation' } ClapPillarArchetypeCommand >> requestedArchetype [ ^ (arguments at: #requestedArchetype) value: self ] diff --git a/src/Pillar-Cli/ClapPillarBuildCommand.class.st b/src/Pillar-Cli/ClapPillarBuildCommand.class.st index c851fa90..fda110eb 100644 --- a/src/Pillar-Cli/ClapPillarBuildCommand.class.st +++ b/src/Pillar-Cli/ClapPillarBuildCommand.class.st @@ -19,17 +19,19 @@ This method is based on existing writing targets and generate a CLAP command for 2. Associate and create if needed, a PRDocument and a Writer " Class { - #name : #ClapPillarBuildCommand, - #superclass : #ClapPillarCommand, - #category : #'Pillar-Cli-Clap' + #name : 'ClapPillarBuildCommand', + #superclass : 'ClapPillarCommand', + #category : 'Pillar-Cli-Clap', + #package : 'Pillar-Cli', + #tag : 'Clap' } -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarBuildCommand class >> commandName [ ^'build' ] -{ #category : #'command line' } +{ #category : 'command line' } ClapPillarBuildCommand class >> commandSpecification [ diff --git a/src/Pillar-Cli/ClapPillarCheckCommand.class.st b/src/Pillar-Cli/ClapPillarCheckCommand.class.st index be18ae8e..8bcdf231 100644 --- a/src/Pillar-Cli/ClapPillarCheckCommand.class.st +++ b/src/Pillar-Cli/ClapPillarCheckCommand.class.st @@ -2,17 +2,19 @@ I am a commandline to **check the code in all the codeblocks of a file, then I generate a report**. " Class { - #name : #ClapPillarCheckCommand, - #superclass : #ClapPillarCommand, - #category : #'Pillar-Cli-Clap' + #name : 'ClapPillarCheckCommand', + #superclass : 'ClapPillarCommand', + #category : 'Pillar-Cli-Clap', + #package : 'Pillar-Cli', + #tag : 'Clap' } -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarCheckCommand class >> commandName [ ^ 'check' ] -{ #category : #'command line' } +{ #category : 'command line' } ClapPillarCheckCommand class >> commandSpecification [ | target | diff --git a/src/Pillar-Cli/ClapPillarCommand.class.st b/src/Pillar-Cli/ClapPillarCommand.class.st index c5521672..c551cb34 100644 --- a/src/Pillar-Cli/ClapPillarCommand.class.st +++ b/src/Pillar-Cli/ClapPillarCommand.class.st @@ -1,18 +1,20 @@ Class { - #name : #ClapPillarCommand, - #superclass : #ClapApplication, + #name : 'ClapPillarCommand', + #superclass : 'ClapApplication', #instVars : [ 'project' ], - #category : #'Pillar-Cli-Clap' + #category : 'Pillar-Cli-Clap', + #package : 'Pillar-Cli', + #tag : 'Clap' } -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarCommand class >> commandName [ self subclassResponsibility ] -{ #category : #'command line' } +{ #category : 'command line' } ClapPillarCommand class >> commandSpecification [ @@ -37,14 +39,14 @@ ClapPillarCommand class >> commandSpecification [ ] ] -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarCommand class >> pillarCommandsList [ ^ self allSubclasses select: [ :each | each isAbstract not ] thenCollect: [ :each | each commandSpecification ] ] -{ #category : #printing } +{ #category : 'printing' } ClapPillarCommand class >> printVersion: stream [ stream newLine. stream newLine. @@ -60,7 +62,7 @@ ClapPillarCommand class >> printVersion: stream [ ] -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarCommand >> project [ ^ project ifNil: [ project := PRProject on: FileSystem workingDirectory ] ] diff --git a/src/Pillar-Cli/ClapPillarGenerateTestsCommand.class.st b/src/Pillar-Cli/ClapPillarGenerateTestsCommand.class.st index f246544a..b9144f02 100644 --- a/src/Pillar-Cli/ClapPillarGenerateTestsCommand.class.st +++ b/src/Pillar-Cli/ClapPillarGenerateTestsCommand.class.st @@ -2,17 +2,19 @@ I am a commandline to **generate tests from examples in the codeblocks of some file(s)**. " Class { - #name : #ClapPillarGenerateTestsCommand, - #superclass : #ClapPillarCommand, - #category : #'Pillar-Cli-Clap' + #name : 'ClapPillarGenerateTestsCommand', + #superclass : 'ClapPillarCommand', + #category : 'Pillar-Cli-Clap', + #package : 'Pillar-Cli', + #tag : 'Clap' } -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarGenerateTestsCommand class >> commandName [ ^ 'generateTests' ] -{ #category : #'command line' } +{ #category : 'command line' } ClapPillarGenerateTestsCommand class >> commandSpecification [ | target | diff --git a/src/Pillar-Cli/ClapPillarServeCommand.class.st b/src/Pillar-Cli/ClapPillarServeCommand.class.st index 5f34f695..63c3ea6f 100644 --- a/src/Pillar-Cli/ClapPillarServeCommand.class.st +++ b/src/Pillar-Cli/ClapPillarServeCommand.class.st @@ -4,21 +4,23 @@ I am a command line handler to **serve of the current project**. **Example of usage: **`./pillar serve -w` " Class { - #name : #ClapPillarServeCommand, - #superclass : #ClapPillarCommand, + #name : 'ClapPillarServeCommand', + #superclass : 'ClapPillarCommand', #instVars : [ 'port', 'baseurl' ], - #category : #'Pillar-Cli-Clap' + #category : 'Pillar-Cli-Clap', + #package : 'Pillar-Cli', + #tag : 'Clap' } -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarServeCommand class >> commandName [ ^ 'serve' ] -{ #category : #'command line' } +{ #category : 'command line' } ClapPillarServeCommand class >> commandSpecification [ ^ (ClapCommand id: self commandName asSymbol) @@ -40,12 +42,12 @@ ClapPillarServeCommand class >> commandSpecification [ ] -{ #category : #activation } +{ #category : 'activation' } ClapPillarServeCommand >> baseurl [ ^ baseurl ifNil: [ baseurl := (arguments at: #baseurl) value] ] -{ #category : #execution } +{ #category : 'execution' } ClapPillarServeCommand >> execute [ self port. self baseurl. @@ -68,12 +70,12 @@ ClapPillarServeCommand >> execute [ ^ self watch. ] -{ #category : #activation } +{ #category : 'activation' } ClapPillarServeCommand >> port [ ^ port ifNil: [ port := (arguments at: #port) value] ] -{ #category : #activation } +{ #category : 'activation' } ClapPillarServeCommand >> watch [ (arguments at: #watch) isExplicit ifFalse: [ ^ self ] diff --git a/src/Pillar-Cli/ClapPillarUpdateBuildCommand.class.st b/src/Pillar-Cli/ClapPillarUpdateBuildCommand.class.st index 626bdce6..3d0f233a 100644 --- a/src/Pillar-Cli/ClapPillarUpdateBuildCommand.class.st +++ b/src/Pillar-Cli/ClapPillarUpdateBuildCommand.class.st @@ -6,17 +6,19 @@ Indeed, directory 'archetypes' used by CLAP isn't updated automatically by Git o So use me when a file in 'archetype' changed to update it. " Class { - #name : #ClapPillarUpdateBuildCommand, - #superclass : #ClapPillarCommand, - #category : #'Pillar-Cli-Clap' + #name : 'ClapPillarUpdateBuildCommand', + #superclass : 'ClapPillarCommand', + #category : 'Pillar-Cli-Clap', + #package : 'Pillar-Cli', + #tag : 'Clap' } -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarUpdateBuildCommand class >> commandName [ ^ 'updateBuild' ] -{ #category : #'command line' } +{ #category : 'command line' } ClapPillarUpdateBuildCommand class >> commandSpecification [ ^ (ClapCommand id: self commandName asSymbol) @@ -29,7 +31,7 @@ ClapPillarUpdateBuildCommand class >> commandSpecification [ ] -{ #category : #execution } +{ #category : 'execution' } ClapPillarUpdateBuildCommand >> execute [ self project updateBuild ] diff --git a/src/Pillar-Cli/ClapPillarUpdateTemplateCommand.class.st b/src/Pillar-Cli/ClapPillarUpdateTemplateCommand.class.st index f519194a..4e7291b9 100644 --- a/src/Pillar-Cli/ClapPillarUpdateTemplateCommand.class.st +++ b/src/Pillar-Cli/ClapPillarUpdateTemplateCommand.class.st @@ -6,17 +6,19 @@ I assume that the support folder is read only and the user did not modify it. **Example of usage:** `./pillar updateTemplate book` " Class { - #name : #ClapPillarUpdateTemplateCommand, - #superclass : #ClapPillarCommand, - #category : #'Pillar-Cli-Clap' + #name : 'ClapPillarUpdateTemplateCommand', + #superclass : 'ClapPillarCommand', + #category : 'Pillar-Cli-Clap', + #package : 'Pillar-Cli', + #tag : 'Clap' } -{ #category : #accessing } +{ #category : 'accessing' } ClapPillarUpdateTemplateCommand class >> commandName [ ^ 'updateTemplate' ] -{ #category : #'command line' } +{ #category : 'command line' } ClapPillarUpdateTemplateCommand class >> commandSpecification [ ^ (ClapCommand id: self commandName asSymbol) @@ -31,12 +33,12 @@ ClapPillarUpdateTemplateCommand class >> commandSpecification [ ] -{ #category : #execution } +{ #category : 'execution' } ClapPillarUpdateTemplateCommand >> execute [ self project installTemplateNamed: self requestedTemplate ] -{ #category : #activation } +{ #category : 'activation' } ClapPillarUpdateTemplateCommand >> requestedTemplate [ ^ (arguments at: #requestedTemplate) value: self ] diff --git a/src/Pillar-Cli/PRAbstractCommand.class.st b/src/Pillar-Cli/PRAbstractCommand.class.st index 6a4bcd6a..686ba34a 100644 --- a/src/Pillar-Cli/PRAbstractCommand.class.st +++ b/src/Pillar-Cli/PRAbstractCommand.class.st @@ -22,8 +22,8 @@ You can obtain the same doing; " Class { - #name : #PRAbstractCommand, - #superclass : #Object, + #name : 'PRAbstractCommand', + #superclass : 'Object', #instVars : [ 'configuration', 'baseDirectory', @@ -31,10 +31,12 @@ Class { 'workingDirectory', 'extraArguments' ], - #category : 'Pillar-Cli-Model' + #category : 'Pillar-Cli-Model', + #package : 'Pillar-Cli', + #tag : 'Model' } -{ #category : #accessing } +{ #category : 'accessing' } PRAbstractCommand >> buildConfiguration [ | confFileReference | @@ -53,7 +55,7 @@ PRAbstractCommand >> buildConfiguration [ extendedWith: (extraArguments copyWith: ('baseDirectory' -> workingDirectory)) ] -{ #category : #accessing } +{ #category : 'accessing' } PRAbstractCommand >> configuration [ ^ configuration ifNil: [ @@ -61,19 +63,19 @@ PRAbstractCommand >> configuration [ configuration ] ] -{ #category : #accessing } +{ #category : 'accessing' } PRAbstractCommand >> configuration: aConfiguration [ configuration := aConfiguration ] -{ #category : #accessing } +{ #category : 'accessing' } PRAbstractCommand >> configurationFileName: aFileName [ configurationFileName := aFileName ] -{ #category : #api } +{ #category : 'api' } PRAbstractCommand >> createConfiguration: confFilename baseDirectory: baseDirectoryArg argDictionary: arguments [ | confFile | baseDirectory := baseDirectoryArg. @@ -92,20 +94,20 @@ PRAbstractCommand >> createConfiguration: confFilename baseDirectory: baseDirect ifFalse: [ ConfigurationForPillar newFromDictionary: arguments ] ] -{ #category : #api } +{ #category : 'api' } PRAbstractCommand >> doIt [ "by default does nothing. Now the relation with createConfiguration:... is not clear. For example the PRArchetypeConfiguratioInstaller should probably not override the createConfiguration: but define a doIt method performing the download and action." ] -{ #category : #accessing } +{ #category : 'accessing' } PRAbstractCommand >> extraArguments: aDictionary [ extraArguments := aDictionary ] -{ #category : #accessing } +{ #category : 'accessing' } PRAbstractCommand >> workingDirectory: aDirectory [ workingDirectory := aDirectory diff --git a/src/Pillar-Cli/PRArchetypeCommandLineHandler.class.st b/src/Pillar-Cli/PRArchetypeCommandLineHandler.class.st index b42adf6b..f858f0f0 100644 --- a/src/Pillar-Cli/PRArchetypeCommandLineHandler.class.st +++ b/src/Pillar-Cli/PRArchetypeCommandLineHandler.class.st @@ -7,24 +7,26 @@ Example of usage: ./pillar archetype book " Class { - #name : #PRArchetypeCommandLineHandler, - #superclass : #PRSubCommandLineHandler, - #category : 'Pillar-Cli-Handlers' + #name : 'PRArchetypeCommandLineHandler', + #superclass : 'PRSubCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PRArchetypeCommandLineHandler class >> commandName [ ^ 'archetype' ] -{ #category : #activation } +{ #category : 'activation' } PRArchetypeCommandLineHandler >> activate [ self project installArchetypeNamed: self requestedArchetype. self exitSuccess ] -{ #category : #activation } +{ #category : 'activation' } PRArchetypeCommandLineHandler >> requestedArchetype [ | nonOptions | diff --git a/src/Pillar-Cli/PRArchetypeConfigurationInstallerCommand.class.st b/src/Pillar-Cli/PRArchetypeConfigurationInstallerCommand.class.st index 6ce3f3cb..86d89d62 100644 --- a/src/Pillar-Cli/PRArchetypeConfigurationInstallerCommand.class.st +++ b/src/Pillar-Cli/PRArchetypeConfigurationInstallerCommand.class.st @@ -9,7 +9,9 @@ There should be a one to one mapping between the argument name and the github/pi " Class { - #name : #PRArchetypeConfigurationInstallerCommand, - #superclass : #PRAbstractCommand, - #category : 'Pillar-Cli-Model' + #name : 'PRArchetypeConfigurationInstallerCommand', + #superclass : 'PRAbstractCommand', + #category : 'Pillar-Cli-Model', + #package : 'Pillar-Cli', + #tag : 'Model' } diff --git a/src/Pillar-Cli/PRBloggerCommandLineHandler.class.st b/src/Pillar-Cli/PRBloggerCommandLineHandler.class.st new file mode 100644 index 00000000..82e29d3b --- /dev/null +++ b/src/Pillar-Cli/PRBloggerCommandLineHandler.class.st @@ -0,0 +1,55 @@ +" +here is a typical example of the use of this command line + +To build a book pdf +./pharo-ui Pillar.image pillar build pdf + + +To use a template +./pharo-ui Pillar.image pillar build --templatable html + +To use a specific build strategy: +pillar build -a pdf >> build all Pillar documents found in directory +pillar build -m pdf >> default build, only index.pillar is build +NOTE: there is no flag for ""list"" as buildList is called only if files are given as positionals after format +" +Class { + #name : 'PRBloggerCommandLineHandler', + #superclass : 'PRSubCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' +} + +{ #category : 'accessing' } +PRBloggerCommandLineHandler class >> commandName [ + ^ 'blog' +] + +{ #category : 'activation' } +PRBloggerCommandLineHandler >> activate [ + + | blog | + blog := MicBlogCreator + createFrom: FileSystem workingDirectory / 'blogsrc' to: FileSystem workingDirectory / 'bloghtml'. + +] + +{ #category : 'activation' } +PRBloggerCommandLineHandler >> requestedBuilder [ + + | nonOptions | + "also managed ./pillar build book (to be backward compatible)" + nonOptions := self arguments reject: [ :a | a beginsWith: '-' ]. + ^ nonOptions + ifNotEmpty: [ nonOptions first ] + ifEmpty: [ self errorMissingParameter: 'template' ]. +] + +{ #category : 'activation' } +PRBloggerCommandLineHandler >> requestedFiles [ + + | nonOptions | + nonOptions := self arguments reject: [ :a | a beginsWith: '-' ]. + ^ nonOptions allButFirst +] diff --git a/src/Pillar-Cli/PRBuildCommandLineHandler.class.st b/src/Pillar-Cli/PRBuildCommandLineHandler.class.st index fb0a64d3..7b5e796e 100644 --- a/src/Pillar-Cli/PRBuildCommandLineHandler.class.st +++ b/src/Pillar-Cli/PRBuildCommandLineHandler.class.st @@ -14,17 +14,19 @@ pillar build -m pdf >> default build, only index.pillar is build NOTE: there is no flag for ""list"" as buildList is called only if files are given as positionals after format " Class { - #name : #PRBuildCommandLineHandler, - #superclass : #PRSubCommandLineHandler, - #category : #'Pillar-Cli-Handlers' + #name : 'PRBuildCommandLineHandler', + #superclass : 'PRSubCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PRBuildCommandLineHandler class >> commandName [ ^ 'build' ] -{ #category : #activation } +{ #category : 'activation' } PRBuildCommandLineHandler >> activate [ | target result | @@ -42,7 +44,7 @@ PRBuildCommandLineHandler >> activate [ result exitProcess ] -{ #category : #activation } +{ #category : 'activation' } PRBuildCommandLineHandler >> requestedBuilder [ | nonOptions | @@ -53,7 +55,7 @@ PRBuildCommandLineHandler >> requestedBuilder [ ifEmpty: [ self errorMissingParameter: 'template' ]. ] -{ #category : #activation } +{ #category : 'activation' } PRBuildCommandLineHandler >> requestedFiles [ | nonOptions | diff --git a/src/Pillar-Cli/PRCommandLineHandler.class.st b/src/Pillar-Cli/PRCommandLineHandler.class.st index e2e3e366..eab06ee7 100644 --- a/src/Pillar-Cli/PRCommandLineHandler.class.st +++ b/src/Pillar-Cli/PRCommandLineHandler.class.st @@ -12,22 +12,24 @@ A typical example is " Class { - #name : #PRCommandLineHandler, - #superclass : #BasicCommandLineHandler, - #category : #'Pillar-Cli-Handlers' + #name : 'PRCommandLineHandler', + #superclass : 'BasicCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PRCommandLineHandler class >> commandName [ ^ 'pillar' ] -{ #category : #testing } +{ #category : 'testing' } PRCommandLineHandler class >> isResponsibleFor: aCommandLineArguments [ ^ aCommandLineArguments includesSubCommand: self commandName ] -{ #category : #private } +{ #category : 'private' } PRCommandLineHandler >> subCommandsRoot [ ^ PRSubCommandLineHandler ] diff --git a/src/Pillar-Cli/PRDependencyCommand.class.st b/src/Pillar-Cli/PRDependencyCommand.class.st index 804d3941..1f9adb45 100644 --- a/src/Pillar-Cli/PRDependencyCommand.class.st +++ b/src/Pillar-Cli/PRDependencyCommand.class.st @@ -14,15 +14,17 @@ PRDependencyScripter new printDependencies " Class { - #name : #PRDependencyCommand, - #superclass : #PRAbstractCommand, + #name : 'PRDependencyCommand', + #superclass : 'PRAbstractCommand', #instVars : [ 'dependencyVisitor' ], - #category : 'Pillar-Cli-Model' + #category : 'Pillar-Cli-Model', + #package : 'Pillar-Cli', + #tag : 'Model' } -{ #category : #api } +{ #category : 'api' } PRDependencyCommand >> dependencies [ | cache inputFile | cache := Set new. @@ -31,39 +33,39 @@ PRDependencyCommand >> dependencies [ ^ cache ] -{ #category : #private } +{ #category : 'private' } PRDependencyCommand >> dependencyVisitor [ ^ dependencyVisitor ] -{ #category : #api } +{ #category : 'api' } PRDependencyCommand >> doIt [ self printDependencies ] -{ #category : #api } +{ #category : 'api' } PRDependencyCommand >> forFiles [ dependencyVisitor := PRFileDependencies new ] -{ #category : #api } +{ #category : 'api' } PRDependencyCommand >> forImages [ dependencyVisitor := PRImageDependencies new ] -{ #category : #private } +{ #category : 'private' } PRDependencyCommand >> initialize [ super initialize. self forFiles. ] -{ #category : #private } +{ #category : 'private' } PRDependencyCommand >> inputFile [ ^ configuration propertyAt: 'inputFile' ] -{ #category : #printing } +{ #category : 'printing' } PRDependencyCommand >> printDependencies [ | path pathWithoutFile | path := self inputFile pathString substrings: '/'. diff --git a/src/Pillar-Cli/PREvalCommandLineHandler.class.st b/src/Pillar-Cli/PREvalCommandLineHandler.class.st index 51b9cfad..f25ad55f 100644 --- a/src/Pillar-Cli/PREvalCommandLineHandler.class.st +++ b/src/Pillar-Cli/PREvalCommandLineHandler.class.st @@ -1,15 +1,17 @@ Class { - #name : #PREvalCommandLineHandler, - #superclass : #PRSubCommandLineHandler, - #category : #'Pillar-Cli-Handlers' + #name : 'PREvalCommandLineHandler', + #superclass : 'PRSubCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PREvalCommandLineHandler class >> commandName [ ^ 'eval' ] -{ #category : #activation } +{ #category : 'activation' } PREvalCommandLineHandler >> activate [ | nonOptions | diff --git a/src/Pillar-Cli/PRFileDependencyCommandLineHandler.class.st b/src/Pillar-Cli/PRFileDependencyCommandLineHandler.class.st index 342bdc0f..8670d55c 100644 --- a/src/Pillar-Cli/PRFileDependencyCommandLineHandler.class.st +++ b/src/Pillar-Cli/PRFileDependencyCommandLineHandler.class.st @@ -7,23 +7,25 @@ A typical example is ./pharo-ui Pillar.image pillar fileDependencies --configurationFile=pillar.conf Chapters/Chapter1/chapter1.pillar " Class { - #name : #PRFileDependencyCommandLineHandler, - #superclass : #PRSubCommandLineHandler, - #category : 'Pillar-Cli-Handlers' + #name : 'PRFileDependencyCommandLineHandler', + #superclass : 'PRSubCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PRFileDependencyCommandLineHandler class >> commandName [ ^ 'fileDependencies' ] -{ #category : #activation } +{ #category : 'activation' } PRFileDependencyCommandLineHandler >> activate [ self command doIt ] -{ #category : #activation } +{ #category : 'activation' } PRFileDependencyCommandLineHandler >> newCommand [ ^ PRDependencyCommand new forFiles diff --git a/src/Pillar-Cli/PRImageDependencyCommandLineHandler.class.st b/src/Pillar-Cli/PRImageDependencyCommandLineHandler.class.st index 7234cd15..3e26488e 100644 --- a/src/Pillar-Cli/PRImageDependencyCommandLineHandler.class.st +++ b/src/Pillar-Cli/PRImageDependencyCommandLineHandler.class.st @@ -7,23 +7,25 @@ A typical example is ./pharo-ui Pillar.image pillar imageDependencies --configurationFile=pillar.conf Chapters/Chapter1/chapter1.pillar " Class { - #name : #PRImageDependencyCommandLineHandler, - #superclass : #PRSubCommandLineHandler, - #category : 'Pillar-Cli-Handlers' + #name : 'PRImageDependencyCommandLineHandler', + #superclass : 'PRSubCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PRImageDependencyCommandLineHandler class >> commandName [ ^ 'imageDependencies' ] -{ #category : #activation } +{ #category : 'activation' } PRImageDependencyCommandLineHandler >> activate [ self command doIt ] -{ #category : #activation } +{ #category : 'activation' } PRImageDependencyCommandLineHandler >> newCommand [ ^ PRDependencyCommand new forImages diff --git a/src/Pillar-Cli/PRServeCommandLineHandler.class.st b/src/Pillar-Cli/PRServeCommandLineHandler.class.st index c88461f1..30a65c26 100644 --- a/src/Pillar-Cli/PRServeCommandLineHandler.class.st +++ b/src/Pillar-Cli/PRServeCommandLineHandler.class.st @@ -6,17 +6,19 @@ Example of usage: ./pillar serve -w " Class { - #name : #PRServeCommandLineHandler, - #superclass : #PRSubCommandLineHandler, - #category : 'Pillar-Cli-Handlers' + #name : 'PRServeCommandLineHandler', + #superclass : 'PRSubCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PRServeCommandLineHandler class >> commandName [ ^ 'serve' ] -{ #category : #activation } +{ #category : 'activation' } PRServeCommandLineHandler >> activate [ | baseurl watch port watcher | baseurl := self optionAt: 'baseurl' ifAbsent: [ '' ]. diff --git a/src/Pillar-Cli/PRSubCommandLineHandler.class.st b/src/Pillar-Cli/PRSubCommandLineHandler.class.st index 6bce8d22..6c2ab993 100644 --- a/src/Pillar-Cli/PRSubCommandLineHandler.class.st +++ b/src/Pillar-Cli/PRSubCommandLineHandler.class.st @@ -10,42 +10,44 @@ and kick its execution. Subclasses should set the configurationInstaller " Class { - #name : #PRSubCommandLineHandler, - #superclass : #CommandLineHandler, + #name : 'PRSubCommandLineHandler', + #superclass : 'CommandLineHandler', #instVars : [ 'baseDirectory', 'configurationInstaller', 'configuration', 'project' ], - #category : 'Pillar-Cli-Handlers' + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PRSubCommandLineHandler class >> argumentsOutOfConfiguration [ "such keys should get ignored after being treated by the command line" ^ #('configurationFile' 'to') ] -{ #category : #accessing } +{ #category : 'accessing' } PRSubCommandLineHandler class >> defaultConfigurationFileName [ ^ 'pillar.conf' ] -{ #category : #testing } +{ #category : 'testing' } PRSubCommandLineHandler class >> isAbstract [ ^ self == PRSubCommandLineHandler ] -{ #category : #private } +{ #category : 'private' } PRSubCommandLineHandler >> add: argument to: arguments [ "From the argument string '--key=value', add the key/value pair to the arguments dictionary." ^ arguments add: (self parseKeyValueArgument: argument) ] -{ #category : #accessing } +{ #category : 'accessing' } PRSubCommandLineHandler >> command [ | command | @@ -56,7 +58,7 @@ PRSubCommandLineHandler >> command [ ^ command ] -{ #category : #accessing } +{ #category : 'accessing' } PRSubCommandLineHandler >> configurationFileName [ ^ self @@ -64,18 +66,18 @@ PRSubCommandLineHandler >> configurationFileName [ ifAbsent: [ self class defaultConfigurationFileName ] ] -{ #category : #'error handling' } +{ #category : 'error handling' } PRSubCommandLineHandler >> error: aString [ self stderr << aString; lf. self exitFailure ] -{ #category : #'error handling' } +{ #category : 'error handling' } PRSubCommandLineHandler >> errorMissingParameter: aParameterName [ self error: 'Missing required parameter --', aParameterName ] -{ #category : #accessing } +{ #category : 'accessing' } PRSubCommandLineHandler >> extraArguments [ "We parse the options --key=value into associations" @@ -90,7 +92,7 @@ PRSubCommandLineHandler >> extraArguments [ ^ argumentsDictionary ] -{ #category : #private } +{ #category : 'private' } PRSubCommandLineHandler >> parseKeyValueArgument: argument [ | key value argumentStream | @@ -102,13 +104,13 @@ PRSubCommandLineHandler >> parseKeyValueArgument: argument [ ^ key -> value ] -{ #category : #accessing } +{ #category : 'accessing' } PRSubCommandLineHandler >> project [ ^ project ifNil: [ project := PRProject on: self workingDirectory ] ] -{ #category : #accessing } +{ #category : 'accessing' } PRSubCommandLineHandler >> workingDirectory [ ^ self diff --git a/src/Pillar-Cli/PRUpdateTemplateCommandLineHandler.class.st b/src/Pillar-Cli/PRUpdateTemplateCommandLineHandler.class.st index 791fbf6a..58bd018b 100644 --- a/src/Pillar-Cli/PRUpdateTemplateCommandLineHandler.class.st +++ b/src/Pillar-Cli/PRUpdateTemplateCommandLineHandler.class.st @@ -8,24 +8,26 @@ Example of usage: ./pillar updateTemplate book " Class { - #name : #PRUpdateTemplateCommandLineHandler, - #superclass : #PRSubCommandLineHandler, - #category : 'Pillar-Cli-Handlers' + #name : 'PRUpdateTemplateCommandLineHandler', + #superclass : 'PRSubCommandLineHandler', + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #accessing } +{ #category : 'accessing' } PRUpdateTemplateCommandLineHandler class >> commandName [ ^ 'updateTemplate' ] -{ #category : #activation } +{ #category : 'activation' } PRUpdateTemplateCommandLineHandler >> activate [ self project installTemplateNamed: self requestedTemplate. self exitSuccess ] -{ #category : #activation } +{ #category : 'activation' } PRUpdateTemplateCommandLineHandler >> requestedTemplate [ | nonOptions | diff --git a/src/Pillar-Cli/PRWatcher.class.st b/src/Pillar-Cli/PRWatcher.class.st index 85fca4fd..9dc3a7fc 100644 --- a/src/Pillar-Cli/PRWatcher.class.st +++ b/src/Pillar-Cli/PRWatcher.class.st @@ -3,22 +3,24 @@ A class to watch served sites. Each 5 seconds, the website is regenerated " Class { - #name : #PRWatcher, - #superclass : #Object, + #name : 'PRWatcher', + #superclass : 'Object', #instVars : [ 'process', 'project' ], - #category : #'Pillar-Cli-Handlers' + #category : 'Pillar-Cli-Handlers', + #package : 'Pillar-Cli', + #tag : 'Handlers' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } PRWatcher class >> stopAll [ self allInstancesDo: #stop ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } PRWatcher >> generateHtml [ | target | @@ -30,7 +32,7 @@ PRWatcher >> generateHtml [ on: Error do: [ : error | self logError: error ]" ] -{ #category : #private } +{ #category : 'private' } PRWatcher >> logError: anError [ Smalltalk logStdErrorDuring: [ :stderr| @@ -42,12 +44,12 @@ PRWatcher >> logError: anError [ anError signalerContext shortDebugStackOn: stderr.]. ] -{ #category : #accessing } +{ #category : 'accessing' } PRWatcher >> project: anObject [ project := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } PRWatcher >> start [ Stdio stdout nextPutAll: 'Watching: true'; lf. @@ -57,7 +59,7 @@ PRWatcher >> start [ self generateHtml ] ] -{ #category : #accessing } +{ #category : 'accessing' } PRWatcher >> stop [ process terminate diff --git a/src/Pillar-Cli/package.st b/src/Pillar-Cli/package.st index 9cfcbb8b..9624fded 100644 --- a/src/Pillar-Cli/package.st +++ b/src/Pillar-Cli/package.st @@ -1 +1 @@ -Package { #name : #'Pillar-Cli' } +Package { #name : 'Pillar-Cli' }