Reputation: 487
I would like to write Pharo Smalltalk scripts that load and save Smalltalk packages to disk in tonel format but I don't understand the API for saving packages.
Loading from Tonel on disk into the image works like this:
(TonelReader on: aRepositoryDirectory fileName: packageName)
version load.
but what is the inverse operation that saves a package onto disk? (assuming that the package name and target directory are supplied.)
(I explicitly want to avoid using advanced tools like Metacello and Iceberg here. I want to either use the Tonel library directly or else Monticello without depending on any previous repository configuration.)
Upvotes: 3
Views: 257
Reputation: 25895
Perhaps unsurprisingly, it looks like the inverse of TonelReader
is implemented by TonelWriter
:
[[[ TonelWriter on: ('someDirectory' asFileReference ensureCreateDirectory) ]]]
Here is a full example courtesy Luke:
[ :packageName :directory |
TonelWriter fileOut: packageName asPackage mcWorkingCopy on: directory.
] value: 'BaselineOfTonel' value: '/tmp/tonel-test'
Upvotes: 5