SystemOrganization addCategory: #'Package-Builder-Model'! SystemOrganization addCategory: #'Package-Builder-View'! Object subclass: #PBBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBBuilder methodsFor: 'building' stamp: 'lr 10/18/2008 14:43'! build: aModel selected: aCollection self subclassResponsibility! ! !PBBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:34'! comment self subclassResponsibility! ! !PBBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:34'! title self subclassResponsibility! ! PBBuilder subclass: #PBFileOutBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBFileOutBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:35'! comment ^ 'Creates a Smalltalk FileOut that loads the complete source.'! ! !PBFileOutBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:35'! title ^ 'File Out'! ! PBBuilder subclass: #PBInstallerBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBInstallerBuilder methodsFor: 'building' stamp: 'lr 10/18/2008 15:18'! build: aModel selected: aCollection ^ WACollectionMimeDocument contentType: 'text/plain' content: (String streamContents: [ :stream | stream nextPut: $"; nextPutAll: aModel title; nextPut: $ ; nextPutAll: aModel version; nextPut: $"; cr. stream nextPutAll: '(HTTPSocket httpGet: ''http://installer.pbwiki.com/f/Installer.st'') fileIn.'; cr. stream nextPutAll: '!!'; cr. aCollection do: [ :each | stream nextPutAll: 'Installer monticello'; cr. stream nextPutAll: ' http: '; print: each location; cr. stream nextPutAll: ' install: '; print: each name; cr. stream nextPutAll: '!!'; cr ] ])! ! !PBInstallerBuilder methodsFor: 'accessing' stamp: 'lr 10/18/2008 14:45'! comment ^ 'Creates a small scripts that loads the sources from Monticello.'! ! !PBInstallerBuilder methodsFor: 'accessing' stamp: 'lr 10/18/2008 14:44'! title ^ 'Monticello'! ! PBBuilder subclass: #PBMapBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBMapBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:35'! comment ^ 'Creates a Monticello Map that loads the requested packages from public repositories.'! ! !PBMapBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:33'! title ^ 'Monticello Map'! ! PBBuilder subclass: #PBMonticelloBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBMonticelloBuilder methodsFor: 'building' stamp: 'lr 10/18/2008 14:43'! build: aModel selected: aCollection! ! !PBMonticelloBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:35'! comment ^ 'Creates a changeset that loads the requested packages from public repositories.'! ! !PBMonticelloBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:33'! title ^ 'Monticello'! ! PBBuilder subclass: #PBUniverseBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBUniverseBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:35'! comment ^ 'Creates a packages file, that can be used with Package Universes.'! ! !PBUniverseBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:33'! title ^ 'Package Universe'! ! Object subclass: #PBPackage instanceVariableNames: 'title comment name location group dependencies' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBPackage methodsFor: 'comparing' stamp: 'lr 10/4/2008 21:00'! = aPackage ^ self class = aPackage class and: [ self name = aPackage name ]! ! !PBPackage methodsFor: 'querying' stamp: 'lr 10/18/2008 14:37'! addDependenciesTo: aCollection (aCollection includes: self) ifFalse: [ self dependencies do: [ :each | each addDependenciesTo: aCollection ]. aCollection addLast: self ]. ^ aCollection! ! !PBPackage methodsFor: 'adding' stamp: 'lr 10/4/2008 21:09'! addDependency: aPackage (aPackage isNil or: [ aPackage = self or: [ dependencies includes: aPackage ] ]) ifFalse: [ dependencies := dependencies copyWith: aPackage ]. ^ aPackage ! ! !PBPackage methodsFor: 'querying' stamp: 'lr 10/18/2008 11:05'! allDependencies "Answer an ordered collection of dependencies for the receiving package." ^ self addDependenciesTo: OrderedCollection new! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 22:06'! comment ^ comment! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 22:06'! comment: aString comment := aString! ! !PBPackage methodsFor: 'querying' stamp: 'lr 10/4/2008 21:07'! dependencies "Answer the direct dependencies." ^ dependencies! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:01'! group ^ group! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:01'! group: aString group := aString! ! !PBPackage methodsFor: 'comparing' stamp: 'lr 10/4/2008 21:00'! hash ^ name hash! ! !PBPackage methodsFor: 'querying' stamp: 'lr 10/18/2008 12:44'! id ^ name copyUpToLast: $-! ! !PBPackage methodsFor: 'initialization' stamp: 'lr 10/4/2008 21:10'! initialize dependencies := #()! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:46'! location ^ location! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:45'! location: aString location := aString! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:11'! name ^ name! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:11'! name: aString name := aString! ! !PBPackage methodsFor: 'printing' stamp: 'lr 10/4/2008 21:52'! printOn: aStream super printOn: aStream. aStream nextPutAll: ' ('; print: self title; nextPutAll: ')'! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:45'! title ^ title! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:45'! title: aString title := aString! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:01'! url ^ url! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:01'! url: aString url := aString! ! Object subclass: #PBSource instanceVariableNames: 'title version packages groups groupsAndPackages' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBSource class methodsFor: 'accessing' stamp: 'lr 10/18/2008 10:30'! seaside | model | model := self new. model title: 'Seaside'; version: '2.9.0-alpha1'. model initialize: (PDPackageAnalyzer onPackages: WADevelopment packages) using: [ :package | ((package name includesSubString: 'Scriptaculous') or: [ (package name includesSubString: 'JQuery') or: [ (package name includesSubString: 'Comet') or: [ (package name includesSubString: 'RSS') or: [ (package name includesSubString: 'HTML5') ] ] ] ]) ifTrue: [ package group: 'Web 2.0' ]. ((package name includesSubString: 'Kom') or: [ (package name includesSubString: 'Swazoo') ]) ifTrue: [ package group: 'Server' ]. (package name includesSubString: 'Development') ifTrue: [ package group: 'Development' ]. (package name includesSubString: 'Examples') ifTrue: [ package group: 'Examples' ]. (package name includesSubString: 'Tests') ifTrue: [ package group: 'Tests' ]. (package group isNil) ifTrue: [ package group: 'Core' ]. (package name includesSubString: 'Squeak') ifTrue: [ package group: nil ]. (package name includesSubString: 'Swazoo') ifFalse: [ package ] ]. ^ model! ! !PBSource methodsFor: 'adding' stamp: 'lr 10/4/2008 21:49'! addPackage: aPackage (aPackage isNil or: [ packages includes: aPackage ]) ifTrue: [ ^ aPackage ]. aPackage group notNil ifTrue: [ (groupsAndPackages at: aPackage group ifAbsentPut: [ OrderedCollection new ]) addLast: aPackage. (groups includes: aPackage group) ifFalse: [ groups add: aPackage group ] ]. ^ packages add: aPackage! ! !PBSource methodsFor: 'enumerating' stamp: 'lr 10/4/2008 22:03'! groupsAndPackagesDo: aBlock groups do: [ :group | aBlock value: group value: (groupsAndPackages at: group) ]! ! !PBSource methodsFor: 'initialization' stamp: 'lr 10/4/2008 20:55'! initialize packages := Set new. groups := OrderedCollection new. groupsAndPackages := Dictionary new! ! !PBSource methodsFor: 'initialization' stamp: 'lr 10/18/2008 11:19'! initialize: anAnalizer using: aValuable | imported working repository dependency | imported := anAnalizer relation packages collect: [ :package | working := MCWorkingCopy allManagers detect: [ :each | each packageInfo = package info ] ifNone: [ self error: 'Working copy for ' , package packageName , ' not found.' ]. repository := working repositoryGroup repositories detect: [ :each | each isKindOf: MCHttpRepository ] ifNone: [ self error: 'HTTP repository for ' , package packageName , ' not found.' ]. package -> (PBPackage new title: working packageName; name: working currentVersionInfo name; location: repository locationWithTrailingSlash; yourself) ]. imported do: [ :assoc | assoc key dependentPackages do: [ :dependent | dependency := imported detect: [ :each | each key info = dependent info ] ifNone: [ nil ]. dependency isNil ifFalse: [ assoc value addDependency: dependency value ] ]. self addPackage: (aValuable value: assoc value) ]! ! !PBSource methodsFor: 'querying' stamp: 'lr 10/4/2008 22:19'! packages ^ packages! ! !PBSource methodsFor: 'printing' stamp: 'lr 10/4/2008 21:52'! printOn: aStream super printOn: aStream. aStream nextPutAll: ' ('; print: self title; nextPutAll: ')'! ! !PBSource methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:52'! title ^ title! ! !PBSource methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:52'! title: aString title := aString! ! !PBSource methodsFor: 'accessing' stamp: 'lr 10/4/2008 20:35'! version ^ version! ! !PBSource methodsFor: 'accessing' stamp: 'lr 10/4/2008 20:35'! version: aString version := aString! ! WAComponent subclass: #PBBuilderView instanceVariableNames: 'model selected dependent' classVariableNames: 'SourceModel Builders' poolDictionaries: '' category: 'Package-Builder-View'! PBBuilderView class instanceVariableNames: 'builderClasses'! PBBuilderView class instanceVariableNames: 'builderClasses'! !PBBuilderView class methodsFor: 'accessing' stamp: 'lr 10/18/2008 12:58'! builders ^ Builders ifNil: [ Builders := PBBuilder allSubclasses collect: [ :each | each new ] ]! ! !PBBuilderView class methodsFor: 'initialization' stamp: 'lr 10/4/2008 22:00'! initialize | application | application := self registerAsApplication: 'builder'. application addLibrary: SULibrary. application configuration addParent: WADevelopmentConfiguration instance ! ! !PBBuilderView class methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:37'! model ^ SourceModel ifNil: [ SourceModel := PBSource seaside ]! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 10/18/2008 15:06'! add: aCollection selected addAll: aCollection. self refresh! ! !PBBuilderView methodsFor: 'accessing-dynamic' stamp: 'lr 10/18/2008 15:08'! dependent ^ dependent! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 10/18/2008 15:11'! download: aBuilder self requestContext returnResponse: (WAResponse document: (aBuilder build: self model selected: self dependent))! ! !PBBuilderView methodsFor: 'initialization' stamp: 'lr 10/18/2008 14:35'! initialize super initialize. selected := Set new. dependent := OrderedCollection new! ! !PBBuilderView methodsFor: 'testing' stamp: 'lr 10/4/2008 22:38'! isChecked: aPackage ^ dependent includes: aPackage! ! !PBBuilderView methodsFor: 'testing' stamp: 'lr 10/4/2008 22:56'! isDisabled: aPackage (selected includes: aPackage) ifTrue: [ ^ false ]. (dependent includes: aPackage) ifTrue: [ ^ true ]. ^ false ! ! !PBBuilderView methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:58'! model ^ model ifNil: [ self class model ]! ! !PBBuilderView methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:54'! model: aSource model := aSource! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 10/18/2008 13:08'! refresh dependent := OrderedCollection new. selected do: [ :package | package addDependenciesTo: dependent ]! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 10/18/2008 12:59'! renderContentOn: html self renderIntroOn: html. self renderGroupsOn: html. self renderDownloadOn: html! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 10/18/2008 15:06'! renderDownloadOn: html html heading level: 2; with: 'Download'. html unorderedList: [ self class builders do: [ :each | html listItem: [ html anchor title: each comment; callback: [ self download: each ]; with: each title ] ] ]! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 10/18/2008 15:06'! renderGroupsOn: html html table: [ self model groupsAndPackagesDo: [ :group :packages | html tableRow: [ html tableHeading colSpan: 3; with: [ html anchor callback: [ self add: packages ]; with: group ] ]. packages do: [ :package | html tableRow: [ self renderPackage: package on: html ] ] ] ]! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 10/4/2008 21:55'! renderIntroOn: html html paragraph: [ html text: 'You are downloading '; text: self model title; text: ' '; text: self model version; text: '.' ]! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 10/18/2008 15:06'! renderPackage: aPackage on: html html tableData class: 'checkbox'; with: [ html anchor id: aPackage id; callback: [ self toggle: aPackage ]; class: 'checked' if: (self isChecked: aPackage); class: 'disabled' if: (self isDisabled: aPackage) ]. html tableData class: 'title'; with: [ html label for: aPackage id; with: aPackage name ]. html tableData class: 'description'; with: aPackage comment! ! !PBBuilderView methodsFor: 'accessing-dynamic' stamp: 'lr 10/18/2008 15:08'! selected ^ selected! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 10/18/2008 12:37'! style ^ '.checkbox a { width: 10px; height: 10px; display: block; border: 2px black solid; } .checkbox a.checked { background-color: black; } .checkbox a.disabled { border-color: gray; background-color: gray; }'! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 10/18/2008 15:06'! toggle: aPackage (self isChecked: aPackage) ifTrue: [ selected remove: aPackage ifAbsent: [ ] ] ifFalse: [ selected add: aPackage ]. self refresh! ! PBBuilderView initialize!