On Sat, Mar 02, 2013 at 05:37:04PM +0100, Holger Hans Peter Freyther wrote:
> Hi,
Hi again,
> Proposal:
> Create a new kind of Package that is actually just the git repository. With
> some tooling help one could:
>
> - Have gst-sunit work on the unpackaged package.
> - Make it more easy to load the CWD into an image without any of
> the above issues.
based on the chat with today. I have attached a prototype for this new
kind of package format. It can be used like this:
PackageLoader
addDirPackage: 'packages/stinst/parser/package.xml;
fileInPackage: 'Parser.dir'.
For every dir package the package will be made available as NAME and
NAME.dir. This is done to easily take presedence over the normal package.
What do you think? Somehow it would be cleaner if the new package and
the star package would have a common base class instead of subclassing
the star one. On the other hand the package.xml is a 'star' thing.
comments?
holger
PS: Any ideas of an in-situ output? My goal is really to work on a package
and use PackageLoader dirPackageOut: 'Parser'. And everything is written
back to where it came from. Does anyone share this idea with me?
Namespace current: Kernel [
StarPackage subclass: DirPackage [
<category: 'Language-Packaging'>
<comment: 'I can parse a package.xml from a directort and treat it
like a package. This allows loading packages from a directory without
the need of zipping them first.'>
DirPackage class >> file: aFile [
^ self new
file: aFile;
yourself
]
directory [
^ self file asFile directory.
]
name [
"Pick the name of the loaded package"
^ self loadedPackage name.
]
loadedPackage [
<category: 'accessing'>
| file package |
loadedPackage isNil ifFalse: [^loadedPackage].
file := self file asFile.
package := Package parse: file readStream.
package isNil
ifTrue: [^self error: 'invalid disabled-package tag inside a star
file'].
package relativeDirectory: file directory.
package baseDirectories: {file directory}.
package name isNil
ifTrue: [^self error: 'package name must not be nil'].
loadedPackage := package.
^loadedPackage
]
]
PackageContainer subclass: DirPackageDirectory [
| files |
<category: 'Language-Packaging'>
<comment: 'I hold a list of package.xml paths to load from a
directory to avoid creating zip files first.'>
DirPackageDirectory class >> on: aFile [
^ self new
add: aFile;
yourself
]
add: aFile [
self files add: aFile.
]
files [
^ files ifNil: [files := OrderedCollection new].
]
refresh: aDate [
self files do: [:file | | package |
package := DirPackage file: file.
(self packages)
at: package name put: package;
at: package name, '.dir' put: package]
]
]
]
PackageLoader class extend [
addDirPackage: aFile [
"Make sure that root is initialized."
self refresh.
"Add the 'directory' to the packages"
root add: (Kernel.DirPackageDirectory on: aFile).
"Update the package descriptions"
self refresh.
]
]
_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk