SystemOrganization addCategory: #'Package-Builder-Model'! SystemOrganization addCategory: #'Package-Builder-View'! WAObject subclass: #PBBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBBuilder methodsFor: 'building' stamp: 'lr 2/10/2009 19:34'! build: aSource selected: aCollectionOfPackages base: aString url: aUrl self subclassResponsibility! ! !PBBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:34'! comment self subclassResponsibility! ! !PBBuilder methodsFor: 'private' stamp: 'lr 12/31/2008 10:50'! identifier: aString uppercase: aBoolean | upper input char | upper := aBoolean. input := aString readStream. ^ String streamContents: [ :stream | [ input atEnd ] whileFalse: [ char := input next. char isAlphaNumeric ifTrue: [ stream nextPut: (upper ifTrue: [ char asUppercase ] ifFalse: [ char asLowercase ]). upper := false ]. char = $- ifTrue: [ upper := true ] ] ]! ! !PBBuilder methodsFor: 'utilities' stamp: 'lr 2/10/2009 19:44'! repositoriesOf: aCollectionOfPackages base: aString | repositories | repositories := aCollectionOfPackages collect: [ :each | each location ]. repositories := repositories asSet asArray sort. ^ repositories copyWithFirst: aString! ! !PBBuilder methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:34'! title self subclassResponsibility! ! PBBuilder subclass: #PBConfigMapBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBConfigMapBuilder methodsFor: 'building' stamp: 'lr 2/10/2009 19:42'! build: aModel selected: aCollection base: aString url: anUrl ^ WAMimeDocument on: (String streamContents: [ :stream | stream nextPut: $(; cr. (self repositoriesOf: aCollection base: aString) do: [ :each | stream tab; nextPutAll: 'repository ('; print: each; nextPut: $); cr ]. aCollection do: [ :each | stream tab; nextPutAll: 'dependency ('; print: each title; nextPut: $ ; print: each name; nextPut: $ ; print: each uuid; nextPut: $); cr ]. stream nextPut: $); cr. stream nextPut: $"; nextPutAll: aModel title; nextPut: $ ; nextPutAll: aModel version; nextPut: $"; cr. stream nextPut: $"; nextPutAll: anUrl printString; nextPut: $" ]) mimeType: 'application/monticello-map' fileName: aModel title asLowercase , '-' , aModel version , '.mcm'! ! !PBConfigMapBuilder methodsFor: 'accessing' stamp: 'lr 12/24/2008 20:11'! comment ^ 'Creates a Monticello Configuration of the selected packages.'! ! !PBConfigMapBuilder methodsFor: 'accessing' stamp: 'lr 12/24/2008 20:11'! title ^ 'Monticello Configuration'! ! PBBuilder subclass: #PBInstallerBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBInstallerBuilder methodsFor: 'building' stamp: 'lr 2/10/2009 19:42'! build: aModel selected: aCollection base: aString url: anUrl ^ WAMimeDocument on: (String streamContents: [ :stream | stream nextPut: $"; nextPutAll: aModel title; nextPut: $ ; nextPutAll: aModel version; nextPut: $"; cr. stream nextPut: $"; nextPutAll: anUrl printString; nextPut: $"; cr. stream nextPut: $!!; cr. stream nextPutAll: '(HTTPSocket httpGet: ''http://installer.pbwiki.com/f/Installer.st'') fileIn.'; cr. stream nextPutAll: '!!'; cr. aCollection do: [ :package | stream nextPutAll: '(Installer http: '; print: aString; nextPut: $); cr. stream nextPutAll: ' install: '; print: package name; cr. stream nextPutAll: '!!'; cr ] ]) mimeType: 'application/smalltalk-changeset' fileName: aModel title asLowercase , '-' , aModel version , '.cs'! ! !PBInstallerBuilder methodsFor: 'accessing' stamp: 'lr 11/29/2008 16:51'! comment ^ 'Creates an Installer script that loads the sources from Monticello.'! ! !PBInstallerBuilder methodsFor: 'accessing' stamp: 'lr 11/29/2008 16:51'! title ^ 'Installer Script'! ! PBBuilder subclass: #PBLoadScriptBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBLoadScriptBuilder methodsFor: 'building' stamp: 'lr 2/10/2009 19:44'! build: aModel selected: aCollection base: aString url: anUrl ^ WAMimeDocument on: (String streamContents: [ :stream | stream nextPut: $"; nextPutAll: aModel title; nextPut: $ ; nextPutAll: aModel version; nextPut: $"; cr. stream nextPut: $"; nextPutAll: anUrl printString; nextPut: $"; cr. stream nextPut: $!!; cr. (self repositoriesOf: aCollection base: aString) do: [ :each | stream nextPutAll: 'MCRepositoryGroup default addRepository: ('. stream nextPutAll: (MCHttpRepository creationTemplateLocation: each user: '' password: ''); nextPut: $); cr. stream nextPut: $!!; cr ]. aCollection do: [ :package | stream nextPutAll: '[ (('; nextPutAll: (MCHttpRepository creationTemplateLocation: aString user: '' password: ''); nextPut: $); cr. stream tab; tab; nextPutAll: 'loadVersionFromFileNamed: '; print: package fileName; nextPut: $); cr. stream tab; tab; tab; nextPutAll: 'load ]'; cr. stream tab; nextPutAll: 'on: Warning do: [ :err | err resume ]'; cr. stream nextPut: $!!; cr ] ]) mimeType: 'application/smalltalk-changeset' fileName: aModel title asLowercase , '-' , aModel version , '.cs'! ! !PBLoadScriptBuilder methodsFor: 'accessing' stamp: 'lr 12/24/2008 20:13'! comment ^ 'Creates a Monticello load script of the selected packages.'! ! !PBLoadScriptBuilder methodsFor: 'accessing' stamp: 'lr 12/12/2008 18:41'! title ^ 'Load Script'! ! PBBuilder subclass: #PBSakeBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBSakeBuilder methodsFor: 'building' stamp: 'lr 2/10/2009 19:46'! build: aModel selected: aCollection base: aString url: anUrl ^ WAMimeDocument on: (String streamContents: [ :stream | stream nextPut: $"; nextPutAll: aModel title; nextPut: $ ; nextPutAll: aModel version; nextPut: $"; cr. stream nextPut: $"; nextPutAll: anUrl printString; nextPut: $"; cr. stream cr. stream nextPutAll: '(HTTPSocket httpGet: ''http://installer.pbwiki.com/f/Installer.st'') fileIn!!'; cr. stream nextPutAll: 'Installer install: ''Packages''!!'; cr. stream cr. stream nextPutAll: 'Packages subclass: #'; nextPutAll: (self className: aModel); cr. stream tab; nextPutAll: 'instanceVariableNames: '''''; cr. stream tab; nextPutAll: 'classVariableNames: '''''; cr. stream tab; nextPutAll: 'poolDictionaries: '''''; cr. stream tab; nextPutAll: 'category: ''Seaside-Sake''!!'; cr. stream cr. stream nextPut: $!!; nextPutAll: (self className: aModel); nextPutAll: ' class methodsFor: '; print: #accessing; nextPut: $!!; cr. stream nextPutAll: 'findPath'; cr. stream tab; nextPutAll: '^ Array with: self!! !!'; cr. stream cr. aCollection do: [ :package | stream nextPut: $!!; nextPutAll: (self className: aModel); nextPutAll: ' methodsFor: '; print: (package group ifNil: [ #private ]) asLowercase; nextPut: $!!; cr. stream nextPutAll: (self methodName: package); cr. stream tab; nextPutAll: 'self name: '; print: package title; nextPut: $.; cr. stream tab; nextPutAll: 'self version: '; print: aModel version; nextPut: $.; cr. stream tab; nextPutAll: 'self info url: '; print: aString , '/' , package fileName; nextPut: $.; cr. package comment isNil ifFalse: [ stream tab; nextPutAll: 'self info description: '; print: package comment; nextPut: $.; cr ]. package group isNil ifFalse: [ stream tab; nextPutAll: 'self info category: '; print: package group; nextPut: $.; cr ]. package dependencies isEmpty ifFalse: [ stream tab; nextPutAll: 'self dependsOn: #('. package dependencies do: [ :each | stream print: each title ] separatedBy: [ stream nextPut: $ ]. stream nextPutAll: ').'; cr ]. stream tab; nextPutAll: 'self action: self defaultAction'. package postloads do: [ :each | stream nextPut: $.; cr; tab; nextPutAll: 'self addAction: (self class named: '; print: each title; nextPutAll: ') defaultAction' ]. stream nextPutAll: '!! !!'; cr; cr ] ]) mimeType: 'text/smalltalk-filein' fileName: aModel title asLowercase , '-' , aModel version , '.st'! ! !PBSakeBuilder methodsFor: 'private' stamp: 'lr 12/31/2008 09:57'! className: aSource ^ self identifier: aSource titleAndVersion uppercase: true! ! !PBSakeBuilder methodsFor: 'accessing' stamp: 'lr 12/31/2008 10:42'! comment ^ 'Creates a class with the Sake definition of the selected packages.'! ! !PBSakeBuilder methodsFor: 'private' stamp: 'lr 12/31/2008 10:55'! methodName: aPackage ^ aPackage title select: [ :each | each isAlphaNumeric ]! ! !PBSakeBuilder methodsFor: 'accessing' stamp: 'lr 12/31/2008 10:42'! title ^ 'Sake Package Definition'! ! PBBuilder subclass: #PBUniverseBuilder instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBUniverseBuilder methodsFor: 'building' stamp: 'lr 2/10/2009 19:46'! build: aModel selected: aCollection base: aString url: anUrl ^ WAMimeDocument on: (String streamContents: [ :stream | stream nextPutAll: ''; cr. stream nextPutAll: ''; cr. aCollection do: [ :package | stream nextPutAll: ''; cr. stream tab; nextPutAll: ''; nextPutAll: package title escapeEntities; nextPutAll: ''; cr. stream tab; nextPutAll: ''; nextPutAll: package name escapeEntities; nextPutAll: ''; cr. package group isNil ifFalse: [ stream tab; nextPutAll: ''; nextPutAll: package group escapeEntities; nextPutAll: ''; cr ]. package comment isNil ifFalse: [ stream tab; nextPutAll: ''; nextPutAll: package comment escapeEntities; nextPutAll: ''; cr ]. stream tab; nextPutAll: ''; nextPutAll: (aString , '/' , package fileName) escapeEntities; nextPutAll: ''; cr. stream tab; nextPutAll: 'Seaside Core Development Team'; cr. package dependencies isEmpty ifFalse: [ stream tab; nextPutAll: ''; cr. package dependencies do: [ :each | stream tab; tab; nextPutAll: ''; nextPutAll: each title escapeEntities; nextPutAll: ''; cr ]. stream tab; nextPutAll: ''; cr ]. stream nextPutAll: ''; cr ] ]) mimeType: 'text/xml+universe' fileName: aModel title asLowercase , '-' , aModel version , '.packages'! ! !PBUniverseBuilder methodsFor: 'accessing' stamp: 'lr 12/31/2008 09:25'! comment ^ 'Creates a Package Universe from the selected packages.'! ! !PBUniverseBuilder methodsFor: 'accessing' stamp: 'lr 12/12/2008 15:46'! title ^ 'Package Universe'! ! WAObject subclass: #PBPackage instanceVariableNames: 'source title comment name uuid location group dependencies postloads' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! !PBPackage methodsFor: 'querying' stamp: 'lr 11/30/2008 13:32'! addDependenciesTo: aCollection (aCollection includes: self) ifFalse: [ self dependencies do: [ :each | each addDependenciesTo: aCollection ]. aCollection add: self. self postloads do: [ :each | each addDependenciesTo: aCollection ] ]. ^ aCollection! ! !PBPackage methodsFor: 'adding' stamp: 'lr 11/30/2008 13:05'! addDependency: aPackage | package | package := self source addPackage: aPackage. (package isNil or: [ dependencies includes: package ]) ifFalse: [ dependencies := dependencies copyWith: package ]. ^ package! ! !PBPackage methodsFor: 'adding' stamp: 'lr 11/30/2008 13:24'! addPostload: aPackage | package | package := self source addPackage: aPackage. (package isNil or: [ postloads includes: package ]) ifFalse: [ postloads := postloads copyWith: package. package addDependency: self ]. ^ package! ! !PBPackage methodsFor: 'adding' stamp: 'lr 12/18/2008 21:21'! addToSource: aSource ^ aSource packageNamed: self name ifAbsent: [ | working repository package | working := MCWorkingCopy allManagers detect: [ :each | self title = each packageName ] ifNone: [ self error: 'Working copy for ' , self title , ' not found.' ]. working modified ifTrue: [ self error: 'Working copy for ' , self title , ' is modified.' ]. repository := PBSource findRepository: working repositoryGroup repositories withVersion: working currentVersionInfo name. self name: working currentVersionInfo name. self location: repository locationWithTrailingSlash. self uuid: working currentVersionInfo id asString. aSource packages add: (self setSource: aSource) ]! ! !PBPackage methodsFor: 'querying' stamp: 'lr 11/30/2008 13:06'! allDependencies "Answer an ordered collection of dependencies for the receiving package." ^ self addDependenciesTo: OrderedCollection new! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:06'! comment "The pacakge description." ^ comment! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 22:06'! comment: aString comment := aString! ! !PBPackage methodsFor: 'accessing-readonly' stamp: 'lr 10/4/2008 21:07'! dependencies "Answer the direct dependencies." ^ dependencies! ! !PBPackage methodsFor: 'querying' stamp: 'lr 12/13/2008 13:17'! fileName ^ self name , '.mcz'! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:06'! group "The group name." ^ group! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 11/29/2008 16:57'! group: aString group := aString! ! !PBPackage methodsFor: 'querying' stamp: 'lr 10/18/2008 12:44'! id ^ name copyUpToLast: $-! ! !PBPackage methodsFor: 'initialization' stamp: 'lr 11/30/2008 13:50'! initialize super initialize. dependencies := #(). postloads := #()! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:05'! location "The repository URL." ^ location! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 11/29/2008 16:46'! location: aString location := (aString beginsWith: 'http://') ifFalse: [ 'http://' , aString ] ifTrue: [ aString ]! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:05'! name "The full version name." ^ name! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:11'! name: aString name := aString! ! !PBPackage methodsFor: 'querying' stamp: 'lr 10/18/2008 18:54'! packageName ^ self name copyUpToLast: $-! ! !PBPackage methodsFor: 'accessing-readonly' stamp: 'lr 11/30/2008 13:23'! postloads "Answer the postload packages." ^ postloads! ! !PBPackage methodsFor: 'printing' stamp: 'lr 11/30/2008 12:43'! printOn: aStream super printOn: aStream. aStream nextPut: $(; print: self title; nextPut: $)! ! !PBPackage methodsFor: 'initialization' stamp: 'lr 11/30/2008 13:04'! setSource: aSource source := aSource! ! !PBPackage methodsFor: 'accessing-readonly' stamp: 'lr 11/30/2008 13:04'! source ^ source! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:05'! title "The package name." ^ title! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/4/2008 21:45'! title: aString title := aString! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:06'! uuid "The version identifier." ^ uuid! ! !PBPackage methodsFor: 'accessing' stamp: 'lr 10/18/2008 18:36'! uuid: aString uuid := aString! ! !PBPackage methodsFor: 'querying' stamp: 'lr 2/10/2009 18:30'! version ^ (MCHttpRepository location: self location user: '' password: '') versionFromFileNamed: self fileName! ! WAObject subclass: #PBSource instanceVariableNames: 'name title version packages groups configs' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-Model'! PBSource class instanceVariableNames: 'repositoryCache repositoryCacheValidUntil baseDirectory baseUrl'! PBSource class instanceVariableNames: 'repositoryCache repositoryCacheValidUntil baseDirectory baseUrl'! !PBSource class methodsFor: 'accessing' stamp: 'lr 2/10/2009 19:07'! baseDirectory ^ baseDirectory ifNil: [ FileDirectory default directoryNamed: 'distributions' ]! ! !PBSource class methodsFor: 'accessing' stamp: 'lr 2/10/2009 19:08'! baseDirectory: aStringOrDirectory "Defines the base-directory where the files are stored. If this value is set to nil, it default to a subdirectory of of the current image-location." baseDirectory := aStringOrDirectory isString ifTrue: [ FileDirectory on: aStringOrDirectory ] ifFalse: [ aStringOrDirectory ]! ! !PBSource class methodsFor: 'accessing' stamp: 'lr 2/10/2009 19:08'! baseUrl ^ baseUrl! ! !PBSource class methodsFor: 'accessing' stamp: 'lr 2/10/2009 19:37'! baseUrl: aString "Defines the base-URL where the files are served from, when using an external web server." baseUrl := aString isNil ifFalse: [ aString last = $/ ifFalse: [ aString ] ifTrue: [ aString copyUpToLast: $/ ] ]! ! !PBSource class methodsFor: 'accessing' stamp: 'lr 2/10/2009 19:20'! filename ^ 'Manifest.obj'! ! !PBSource class methodsFor: 'querying' stamp: 'lr 12/18/2008 21:23'! findRepository: aCollection withVersion: aString (repositoryCache isNil or: [ repositoryCacheValidUntil isNil or: [ repositoryCacheValidUntil < TimeStamp now ] ]) ifTrue: [ repositoryCacheValidUntil := TimeStamp now + 1 hour. repositoryCache := Dictionary new ]. aCollection do: [ :repository | (repository isKindOf: MCHttpRepository) ifTrue: [ ((repositoryCache at: repository ifAbsentPut: [ repository allFileNames ]) anySatisfy: [ :each | each beginsWith: aString ]) ifTrue: [ ^ repository ] ] ]. self error: 'HTTP repository for ' , aString , ' not found.'! ! !PBSource class methodsFor: 'instance-creation' stamp: 'lr 2/10/2009 19:18'! load "Load all the distributions form the default directory." | distributions distribution | distributions := OrderedCollection new. self baseDirectory directoryNames sort do: [ :each | distribution := self load: each. distribution isNil ifFalse: [ distributions addLast: distribution ] ]. ^ distributions asArray! ! !PBSource class methodsFor: 'instance-creation' stamp: 'lr 2/10/2009 19:32'! load: aString "Load the distribution aString form the default directory." | directory stream model | directory := self baseDirectory directoryNamed: aString. (directory exists and: [ directory fileExists: self filename ]) ifFalse: [ ^ nil ]. stream := ReferenceStream on: (directory oldFileNamed: self filename) binary. model := [ stream next ] ensure: [ stream close ]. (model isKindOf: self) ifFalse: [ self error: 'Invalid file format.' ]. ^ model name: aString! ! !PBSource class methodsFor: 'distributions' stamp: 'lr 2/10/2009 19:02'! seaside "self seaside verify; save: '001-Seaside2.9.0-a2'" | model | model := self new. model title: 'Seaside'; version: '2.9.0-alpha2'. " packages " model addPackages: WAPackage packages. " groups " model addGroup: 'Core Library' select: [ :each | (each name beginsWith: 'Seaside-') ]. model addGroup: 'Server Adaptors' select: [ :each | (each name includesSubString: 'Adaptors') ]. model addGroup: 'Web 2.0' select: [ :each | (each name beginsWith: 'Javascript') or: [ (each name beginsWith: 'Scriptaculous') or: [ (each name beginsWith: 'JQuery') or: [ (each name beginsWith: 'Comet') or: [ (each name beginsWith: 'RSS') or: [ (each name beginsWith: 'HTML5') ] ] ] ] ] ]. model addGroup: 'Development' select: [ :each | (each name includesSubString: 'Development') ]. model addGroup: 'Examples' select: [ :each | (each name includesSubString: 'Examples') ]. model addGroup: 'Tests' select: [ :each | (each name includesSubString: 'Tests') ]. " special dependencies " (((model packageNamed: 'Seaside-Adaptors-Comanche') addDependency: 'KomHttpServer') addDependency: 'KomServices') addDependency: 'DynamicBindings'. ((model packageNamed: 'Seaside-Swazoo') group: nil; addDependency: 'Swazoo') addDependency: 'Sport'. ((model packageNamed: 'Seaside-Slime') group: 'Development'; addDependency: 'Refactoring-Core') addDependency: 'AST'. " special post load " model packages do: [ :each | (each name includesSubString: '-Squeak') ifTrue: [ (model packageNamed: (each title copyReplaceAll: '-Squeak' with: '') ifAbsent: [ model packageNamed: 'Seaside-Platform' ]) addPostload: each title. each group: nil ] ]. " configurations " model addConfig: 'Development' reject: [ :each | (each name includesSubString: 'Tests') or: [ (each name includesSubString: 'Swazoo') ] ]. model addConfig: 'Integration' reject: [ :each | (each name includesSubString: 'Examples') or: [ (each name includesSubString: 'Swazoo') ] ]. model addConfig: 'Deployment' reject: [ :each | (each name includesSubString: 'Examples') or: [ (each name includesSubString: 'Tests') or: [ (each name includesSubString: 'Slime') or: [ (each name includesSubString: 'Swazoo') ] or: [ (each name includesSubString: 'Development') ] ] ] ]. ^ model! ! !PBSource methodsFor: 'adding' stamp: 'lr 11/29/2008 17:25'! addConfig: aString reject: aBlock "Adds a configuration named aString containing those packages for which aBlock evaluates to false." self addConfig: aString select: [ :each | (aBlock value: each) not ]! ! !PBSource methodsFor: 'adding' stamp: 'lr 12/23/2008 14:06'! addConfig: aString select: aBlock "Adds a configuration named aString containing those packages for which aBlock evaluates to true." configs add: aString -> (self packagesSorted: (self packages select: [ :each | each group notNil and: [ aBlock value: each ] ]))! ! !PBSource methodsFor: 'adding' stamp: 'lr 11/29/2008 16:59'! addGroup: aString "Adds a group named aString." (groups includes: aString) ifFalse: [ groups add: aString ]! ! !PBSource methodsFor: 'adding' stamp: 'lr 11/29/2008 16:59'! addGroup: aString reject: aBlock "Adds a group named aString containing those packages for which aBlock evaluates to false." self addGroup: aString reject: [ :each | (aBlock value: each) not ]! ! !PBSource methodsFor: 'adding' stamp: 'lr 11/29/2008 16:59'! addGroup: aString select: aBlock "Adds a group named aString containing those packages for which aBlock evaluates to true." self addGroup: aString. self packages do: [ :each | (aBlock value: each) ifTrue: [ each group: aString ] ]! ! !PBSource methodsFor: 'adding' stamp: 'lr 11/29/2008 16:54'! addPackage: aPackage "Add a single package to the receiver. The package can be represented as a String, a PackageInfo, a WAPackage, or as a PBPackage. Answer an existing or newly added package." ^ aPackage addToSource: self! ! !PBSource methodsFor: 'adding' stamp: 'lr 11/29/2008 16:55'! addPackages: aCollection "Add a collection of packages to the receiver." ^ aCollection do: [ :each | self addPackage: each ]! ! !PBSource methodsFor: 'querying' stamp: 'lr 12/14/2008 17:46'! analizer | analizerClass | analizerClass := Smalltalk at: #PDPackageAnalyzer ifAbsent: [ self error: 'PDPackageAnalyzer not found' ]. ^ analizerClass onPackagesNamed: (self packages collect: [ :each | each title ])! ! !PBSource methodsFor: 'enumerating' stamp: 'lr 11/29/2008 16:49'! configurationsDo: aBlock aBlock value: 'All Packages' value: self packages. configs do: [ :assoc | aBlock value: assoc key value: assoc value ]. aBlock value: 'No Packages' value: Set new! ! !PBSource methodsFor: 'enumerating' stamp: 'lr 2/10/2009 19:30'! groupsDo: aBlock groups do: [ :group | aBlock value: group value: (self packagesSorted: (self packages select: [ :package | package group = group ])) ]! ! !PBSource methodsFor: 'initialization' stamp: 'lr 11/30/2008 13:50'! initialize super initialize. packages := Set new. groups := OrderedCollection new. configs := OrderedCollection new! ! !PBSource methodsFor: 'accessing' stamp: 'lr 2/10/2009 19:30'! name ^ name! ! !PBSource methodsFor: 'accessing' stamp: 'lr 2/10/2009 19:30'! name: aString name := aString! ! !PBSource methodsFor: 'querying' stamp: 'lr 11/30/2008 12:52'! packageNamed: aString ^ self packageNamed: aString ifAbsent: [ nil ]! ! !PBSource methodsFor: 'querying' stamp: 'lr 12/18/2008 16:14'! packageNamed: aString ifAbsent: aBlock ^ self packages detect: [ :each | each title beginsWith: aString ] ifNone: aBlock! ! !PBSource methodsFor: 'querying' stamp: 'lr 10/4/2008 22:19'! packages ^ packages! ! !PBSource methodsFor: 'querying' stamp: 'lr 11/29/2008 17:20'! packagesSorted: aCollection ^ aCollection asArray sort: [ :a :b | a title < b title ]! ! !PBSource methodsFor: 'printing' stamp: 'lr 10/4/2008 21:52'! printOn: aStream super printOn: aStream. aStream nextPutAll: ' ('; print: self title; nextPutAll: ')'! ! !PBSource methodsFor: 'actions' stamp: 'lr 2/10/2009 19:23'! save: aString | target stream repository | packages := self packagesSorted: packages. [ target := (self class baseDirectory directoryNamed: aString) assureExistence. stream := ReferenceStream on: (target forceNewFileNamed: self class filename). [ stream nextPut: self ] ensure: [ stream close ] ] ensure: [ packages := packages asSet ]. repository := MCDirectoryRepository new directory: target. packages do: [ :each | repository storeVersion: each version ] displayingProgress: 'Storing ' , self titleAndVersion! ! !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: 'querying' stamp: 'lr 12/18/2008 16:14'! titleAndVersion ^ self title , ' ' , self version! ! !PBSource methodsFor: 'actions' stamp: 'lr 12/18/2008 16:43'! verify self verify: self analizer! ! !PBSource methodsFor: 'actions' stamp: 'lr 12/14/2008 19:19'! verify: anAnalizer "Verify the receiving source model with the static code analysis." | relation other dependency | relation := anAnalizer relation. self packages do: [ :package | other := relation packages detect: [ :each | each packageName = package title ] ifNone: [ nil ]. other isNil ifFalse: [ other dependentPackages do: [ :depend | dependency := self packages detect: [ :each | each title = depend packageName ] ifNone: [ nil ]. dependency isNil ifFalse: [ (package allDependencies includes: dependency) ifFalse: [ package addDependency: dependency. Transcript show: package title; show: ' is missing '; show: dependency title; show: ' ('; show: (other dependencies detect: [ :each | each target = depend ]) reason; show: ')'; cr ] ] ] ] ]! ! !PBSource methodsFor: 'accessing' stamp: 'lr 10/4/2008 20:35'! version ^ version! ! !PBSource methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:02'! version: aString version := aString! ! !String methodsFor: '*package-builder' stamp: 'lr 11/29/2008 12:42'! addToSource: aSource ^ (PackageOrganizer default packageNamed: self ifAbsent: [ self error: 'Unknown package named ' , self printString ]) addToSource: aSource! ! !WAPackage methodsFor: '*package-builder' stamp: 'lr 11/29/2008 16:44'! addToSource: aSource | package | package := PBPackage new title: self name; name: self name; comment: self description; addToSource: aSource. dependencies do: [ :each | package addDependency: (aSource addPackage: each) ]. ^ package addToSource: aSource! ! WAComponent subclass: #PBBuilderView instanceVariableNames: 'model selected dependent url' classVariableNames: '' poolDictionaries: '' category: 'Package-Builder-View'! PBBuilderView class instanceVariableNames: 'distributions builders'! PBBuilderView class instanceVariableNames: 'distributions builders'! !PBBuilderView class methodsFor: 'accessing' stamp: 'lr 2/10/2009 18:46'! builders ^ builders ifNil: [ builders := Array with: PBLoadScriptBuilder new with: PBConfigMapBuilder new ]! ! !PBBuilderView class methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:16'! distributions ^ distributions ifNil: [ distributions := PBSource load ]! ! !PBBuilderView class methodsFor: 'initialization' stamp: 'lr 12/18/2008 21:00'! flush distributions := builders := nil! ! !PBBuilderView class methodsFor: 'initialization' stamp: 'lr 2/10/2009 18:47'! initialize | application | application := self registerAsApplication: 'builder'. application configuration at: #resourceBaseUrl put: 'http://builder.seaside.st/'. application addLibrary: JQGoogleLibrary! ! !PBBuilderView methodsFor: 'accessing-dynamic' stamp: 'lr 2/10/2009 19:36'! base ^ self model class baseUrl , '/' , self name , '/'! ! !PBBuilderView methodsFor: 'accessing-dynamic' stamp: 'lr 12/18/2008 16:17'! builders ^ self class builders! ! !PBBuilderView methodsFor: 'accessing' stamp: 'lr 10/18/2008 15:08'! dependent ^ dependent! ! !PBBuilderView methodsFor: 'accessing' stamp: 'lr 11/30/2008 12:32'! dependent: aCollection dependent := aCollection asSet! ! !PBBuilderView methodsFor: 'accessing-dynamic' stamp: 'lr 12/18/2008 16:17'! distributions ^ self class distributions! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 2/10/2009 19:35'! download: aBuilder self requestContext respond: (WAResponse document: (aBuilder build: self model selected: self ordered base: self base url: self url))! ! !PBBuilderView methodsFor: 'initialization' stamp: 'lr 12/18/2008 16:30'! initialRequest: aRequest | package | super initialRequest: aRequest. aRequest fields at: 'distribution' ifPresent: [ :value | self distributions do: [ :each | each titleAndVersion = value ifTrue: [ self model: each ] ] ]. aRequest fields at: 'packages' ifPresent: [ :value | (value findTokens: $,) do: [ :name | package := self model packageNamed: name ifAbsent: [ nil ]. package isNil ifFalse: [ self selected add: package ] ]. self refresh ]! ! !PBBuilderView methodsFor: 'initialization' stamp: 'lr 11/30/2008 12:32'! initialize super initialize. self dependent: #(). self selected: #() ! ! !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 12/18/2008 16:25'! model ^ model ifNil: [ model := self distributions last ]! ! !PBBuilderView methodsFor: 'accessing' stamp: 'lr 12/18/2008 16:25'! model: aSource self initialize. model := aSource! ! !PBBuilderView methodsFor: 'accessing-dynamic' stamp: 'lr 12/13/2008 12:58'! ordered "Answer all the packages in the order they should be loaded." | result | result := OrderedCollection new: self dependent size. self selected do: [ :package | package addDependenciesTo: result ]. ^ result asArray! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 11/30/2008 13:31'! refresh dependent := Set new. selected do: [ :package | package addDependenciesTo: dependent ]! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 12/29/2008 23:18'! renderBodyOn: html self renderIntroOn: html. self renderConfigsOn: html. self renderGroupsOn: html. self renderDownloadOn: html! ! !PBBuilderView methodsFor: 'rendering-body' stamp: 'lr 12/18/2008 16:56'! renderConfigsOn: html html heading level: 2; with: 'Configurations'. html unorderedList: [ self model configurationsDo: [ :label :packages | html listItem: [ html anchor onClick: (html jQuery getScript script: [ :s | self selected: packages; updateCheckboxesOn: s ]); with: label ] ] ]! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 12/30/2008 18:11'! renderContentOn: html url := html context actionUrl withoutParameters. html div id: 'page'; with: [ html div id: 'header'; with: [ self renderHeaderOn: html ]. html div id: 'content'; with: [ self renderBodyOn: html ]. html div id: 'footer'; with: [ self renderFooterOn: html ] ]! ! !PBBuilderView methodsFor: 'rendering-body' stamp: 'lr 12/24/2008 20:13'! renderDownloadOn: html html heading level: 2; with: 'Download'. html unorderedList: [ self class builders do: [ :each | html listItem: [ html anchor callback: [ self download: each ]; with: each title. html html: ' — '. html text: each comment ] ] ]! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 12/29/2008 23:18'! renderFooterOn: html! ! !PBBuilderView methodsFor: 'rendering-body' stamp: 'lr 12/18/2008 16:55'! renderGroupsOn: html html heading level: 2; with: 'Packages'. html table: [ self model groupsDo: [ :group :packages | html tableRow: [ html tableHeading colSpan: 3; with: [ html anchor onClick: (html jQuery getScript script: [ :s | self toggleAll: packages; updateCheckboxesOn: s ]); with: group ] ]. packages do: [ :package | html tableRow title: package name; with: [ self renderPackage: package on: html ] ] ] ]! ! !PBBuilderView methodsFor: 'rendering' stamp: 'lr 12/29/2008 23:18'! renderHeaderOn: html! ! !PBBuilderView methodsFor: 'rendering-body' stamp: 'lr 12/18/2008 16:14'! renderIntroOn: html html paragraph: [ self distributions size = 1 ifTrue: [ html text: 'You are downloading '; text: self model titleAndVersion; text: '.' ] ifFalse: [ html form: [ html text: 'Select the distribution of your choice: '. html select selected: self model; onChange: 'submit()'; list: self distributions; labels: [ :value | value titleAndVersion ]; callback: [ :value | self model: value ] ] ] ]! ! !PBBuilderView methodsFor: 'rendering-body' stamp: 'lr 12/12/2008 15:28'! renderPackage: aPackage on: html html tableData class: 'checkbox'; with: [ html checkbox id: aPackage id; value: (self isChecked: aPackage); disabled: (self isDisabled: aPackage); onChange: (html jQuery getScript script: [ :s | self toggle: aPackage; updateCheckboxesOn: s ]) ]. html tableData class: 'title'; with: [ html label for: aPackage id; with: aPackage title ]. html tableData class: 'description'; with: aPackage comment! ! !PBBuilderView methodsFor: 'accessing-dynamic' stamp: 'lr 10/18/2008 15:08'! selected ^ selected! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 10/22/2008 21:51'! selected: aCollection selected := Set withAll: aCollection. self refresh! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 12/18/2008 16:31'! toggle: aPackage (self isChecked: aPackage) ifTrue: [ selected remove: aPackage ifAbsent: [ ] ] ifFalse: [ selected add: aPackage ]. self refresh! ! !PBBuilderView methodsFor: 'actions' stamp: 'lr 12/18/2008 16:54'! toggleAll: aCollection | count | count := aCollection count: [ :each | selected includes: each ]. count = aCollection size ifFalse: [ selected addAll: aCollection ] ifTrue: [ aCollection do: [ :each | selected remove: each ifAbsent: [ ] ] ]. self refresh! ! !PBBuilderView methodsFor: 'scripts' stamp: 'lr 12/12/2008 15:29'! updateCheckboxesOn: aScript self model groupsDo: [ :group :packages | packages do: [ :package | aScript << (aScript jQuery id: package id) attributeAt: 'checked' put: (self isChecked: package); attributeAt: 'disabled' put: (self isDisabled: package) ] ]! ! !PBBuilderView methodsFor: 'updating' stamp: 'lr 2/10/2009 18:50'! updateRoot: aHtmlRoot super updateRoot: aHtmlRoot. aHtmlRoot title: 'The Seaside Builder'. aHtmlRoot stylesheet resourceUrl: 'styles/baseline.css'. aHtmlRoot stylesheet resourceUrl: 'styles/builder.css'. aHtmlRoot script beJavascript; with: 'var gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");document.write(unescape("%3Cscript src=''"+gaJsHost+"google-analytics.com/ga.js'' type=''text/javascript''%3E%3C/script%3E"));'. aHtmlRoot script beJavascript; with: 'try{var pageTracker=_gat._getTracker("UA-2075184-5");pageTracker._trackPageview();}catch(err){}' ! ! !PBBuilderView methodsFor: 'accessing-dynamic' stamp: 'lr 12/30/2008 18:23'! url url := url withoutParameters. url addParameter: 'distribution' value: self model titleAndVersion. url addParameter: 'packages' value: (String streamContents: [ :stream | self selected do: [ :each | stream nextPutAll: each title ] separatedBy: [ stream nextPut: $, ] ]). ^ url! ! !PackageInfo methodsFor: '*package-builder' stamp: 'lr 12/18/2008 21:37'! addToSource: aSource ^ (WAPackage packages detect: [ :each | self packageName = each name ] ifNone: [ WAPackage new name: self packageName ]) addToSource: aSource! ! PBBuilderView initialize!