Skip to content

Commit

Permalink
Adding a command line for the blog
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Jun 10, 2024
1 parent e3ab14f commit b1b5119
Show file tree
Hide file tree
Showing 23 changed files with 246 additions and 149 deletions.
16 changes: 9 additions & 7 deletions src/Pillar-Cli/ClapPillarArchetypeCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
<commandline>
^ (ClapCommand id: self commandName asSymbol)
Expand All @@ -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
]
12 changes: 7 additions & 5 deletions src/Pillar-Cli/ClapPillarBuildCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
<commandline>

Expand Down
12 changes: 7 additions & 5 deletions src/Pillar-Cli/ClapPillarCheckCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
<commandline>
| target |
Expand Down
18 changes: 10 additions & 8 deletions src/Pillar-Cli/ClapPillarCommand.class.st
Original file line number Diff line number Diff line change
@@ -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 [
<commandline>

Expand All @@ -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.
Expand All @@ -60,7 +62,7 @@ ClapPillarCommand class >> printVersion: stream [

]

{ #category : #accessing }
{ #category : 'accessing' }
ClapPillarCommand >> project [
^ project ifNil: [ project := PRProject on: FileSystem workingDirectory ]
]
12 changes: 7 additions & 5 deletions src/Pillar-Cli/ClapPillarGenerateTestsCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
<commandline>
| target |
Expand Down
20 changes: 11 additions & 9 deletions src/Pillar-Cli/ClapPillarServeCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
<commandline>
^ (ClapCommand id: self commandName asSymbol)
Expand All @@ -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.
Expand All @@ -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 ]
Expand Down
14 changes: 8 additions & 6 deletions src/Pillar-Cli/ClapPillarUpdateBuildCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
<commandline>
^ (ClapCommand id: self commandName asSymbol)
Expand All @@ -29,7 +31,7 @@ ClapPillarUpdateBuildCommand class >> commandSpecification [

]

{ #category : #execution }
{ #category : 'execution' }
ClapPillarUpdateBuildCommand >> execute [
self project updateBuild
]
16 changes: 9 additions & 7 deletions src/Pillar-Cli/ClapPillarUpdateTemplateCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
<commandline>
^ (ClapCommand id: self commandName asSymbol)
Expand All @@ -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
]
24 changes: 13 additions & 11 deletions src/Pillar-Cli/PRAbstractCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ You can obtain the same doing;
"
Class {
#name : #PRAbstractCommand,
#superclass : #Object,
#name : 'PRAbstractCommand',
#superclass : 'Object',
#instVars : [
'configuration',
'baseDirectory',
'configurationFileName',
'workingDirectory',
'extraArguments'
],
#category : 'Pillar-Cli-Model'
#category : 'Pillar-Cli-Model',
#package : 'Pillar-Cli',
#tag : 'Model'
}

{ #category : #accessing }
{ #category : 'accessing' }
PRAbstractCommand >> buildConfiguration [

| confFileReference |
Expand All @@ -53,27 +55,27 @@ PRAbstractCommand >> buildConfiguration [
extendedWith: (extraArguments copyWith: ('baseDirectory' -> workingDirectory))
]

{ #category : #accessing }
{ #category : 'accessing' }
PRAbstractCommand >> configuration [

^ configuration ifNil: [
self configuration: self buildConfiguration.
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.
Expand All @@ -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
Expand Down
Loading

0 comments on commit b1b5119

Please sign in to comment.