2022-04-27 16:02:39 +00:00
|
|
|
"
|
|
|
|
I model common operations made with several markup files.
|
|
|
|
"
|
|
|
|
Class {
|
|
|
|
#name : #MarkupFile,
|
|
|
|
#superclass : #Object,
|
|
|
|
#instVars : [
|
|
|
|
'file'
|
|
|
|
],
|
2022-07-16 17:29:57 +00:00
|
|
|
#category : #MiniDocs
|
2022-04-27 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #persistence }
|
|
|
|
MarkupFile class >> exportAsFileOn: aFileReferenceOrFileName containing: text [
|
|
|
|
| file |
|
|
|
|
file := aFileReferenceOrFileName asFileReference.
|
|
|
|
file ensureDelete.
|
|
|
|
file exists ifFalse: [ file ensureCreateFile ].
|
|
|
|
file writeStreamDo: [ :stream |
|
|
|
|
stream nextPutAll: text withUnixLineEndings].
|
|
|
|
self inform: 'Exported as: ', String cr, file fullName.
|
|
|
|
^ file
|
|
|
|
]
|
2022-07-19 22:25:21 +00:00
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
MarkupFile class >> installTemplate: anUrl into: aFolder [
|
|
|
|
|
|
|
|
| fileName |
|
|
|
|
fileName := anUrl asUrl segments last.
|
|
|
|
(aFolder / fileName) exists
|
|
|
|
ifTrue: [ (aFolder / fileName) ensureDeleteFile ]
|
|
|
|
ifFalse: [ aFolder ensureCreateDirectory ].
|
|
|
|
ZnClient new
|
|
|
|
url: anUrl;
|
|
|
|
downloadTo: aFolder.
|
|
|
|
^ aFolder
|
|
|
|
]
|