Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced Json by STONJSON, removing dependency on Json #14

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions repository/BaselineOfMustache/BaselineOfMustache.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@ BaselineOfMustache >> baseline: spec [
<baseline>

spec for: #'common' do: [
spec project: 'JSON' with: [
spec
className: #ConfigurationOfJSON;
versionString: #'stable';
loads: #('default' );
repository: 'http://smalltalkhub.com/mc/PharoExtras/JSON/main/' ].
spec
package: 'Mustache-Core';
package: 'Mustache-Tests' with: [
spec requires: #('Mustache-Core' ). ];
package: #'Mustache-Cli' with: [
spec requires: #('JSON' ). ].
package: #'Mustache-Cli'.
spec
group: 'Core' with: #('Mustache-Core' );
group: 'Tests' with: #('Mustache-Tests' );
Expand Down
27 changes: 14 additions & 13 deletions repository/Mustache-Cli/MustacheCommandLineHandler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ Options:
[--baseDirectory] a directory where files can be found
"
Class {
#name : #MustacheCommandLineHandler,
#superclass : #CommandLineHandler,
#name : 'MustacheCommandLineHandler',
#superclass : 'CommandLineHandler',
#instVars : [
'baseDirectory'
],
#category : 'Mustache-Cli'
#category : 'Mustache-Cli',
#package : 'Mustache-Cli'
}

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
MustacheCommandLineHandler class >> commandName [
^'mustache'
]

{ #category : #activation }
{ #category : 'activation' }
MustacheCommandLineHandler >> activate [
| result template json partials |
self activateHelp
Expand All @@ -35,41 +36,41 @@ MustacheCommandLineHandler >> activate [
template := (self baseDirectory resolve: self templateOption) contents.
partials := self partialsToDictionary: self partialsOption.
result := (MustacheTemplate on: template)
value: (Json readFrom: json readStream)
value: (STONJSON fromStream: json readStream)
partials: partials.
self stdout nextPutAll: result.
self stdout flush.
self exitSuccess
]

{ #category : #activation }
{ #category : 'activation' }
MustacheCommandLineHandler >> baseDirectory [
^ baseDirectory ifNil: [ FileSystem workingDirectory ]
]

{ #category : #accessing }
{ #category : 'accessing' }
MustacheCommandLineHandler >> errorFileNotFound: aString [
self help.
self exitFailure: 'The file ', aString, ' was not found'.
]

{ #category : #accessing }
{ #category : 'accessing' }
MustacheCommandLineHandler >> errorNeed: aString [
self help.
self exitFailure: 'You need to define ', aString.
]

{ #category : #accessing }
{ #category : 'accessing' }
MustacheCommandLineHandler >> jsonDataOption [
^ self optionAt: 'data' ifAbsent: [ self errorNeed: 'data' ]
]

{ #category : #accessing }
{ #category : 'accessing' }
MustacheCommandLineHandler >> partialsOption [
^ self optionAt: 'partials' ifAbsent: [ '' ].
]

{ #category : #private }
{ #category : 'private' }
MustacheCommandLineHandler >> partialsToDictionary: aString [
| fileNames file partials name |
self flag: #TODO.
Expand All @@ -87,7 +88,7 @@ MustacheCommandLineHandler >> partialsToDictionary: aString [
^ partials
]

{ #category : #accessing }
{ #category : 'accessing' }
MustacheCommandLineHandler >> templateOption [
^ self optionAt: 'template' ifAbsent: [ self errorNeed: 'template' ]
]
2 changes: 1 addition & 1 deletion repository/Mustache-Cli/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #'Mustache-Cli' }
Package { #name : 'Mustache-Cli' }
Loading