Seaside application generator

November 12, 2006

I have used the code I got from Ramon Leon for my seaside application generator. I have extracted a createWelcomeMessageOn method, in which I will put some simple “what to do next” instructions.
Next I want to automatically create a simple folder structure on the file system to hold the style sheets and implement the rest of the “convention over configuration” paradigm into the script.
I am still looking for the standard conventions in seaside though. Just like in rails I want to have unittest classes and a fixture setup automatically created with my models.


Object subclass: #Ocean
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'My-Utilities'

newSeasideApp: aName
  | appCategory configCategory prefix appClass sessionClass |
  appCategory := (aName , '-App') asSymbol.
  configCategory := (aName , '-Config') asSymbol.

  prefix := aName
        select: [:each | each isUppercase].

  SystemOrganization addCategory: appCategory;
     addCategory: configCategory.

  appClass := WAComponent
        subclass: (prefix , aName) asSymbol
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: appCategory.

  self createWelcomeMessageOn: appClass name: aName.

  sessionClass := WASession
        subclass: (prefix , aName , #Session) asSymbol
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: configCategory.

  (self confirm: 'Register this in Seaside Admin as an application?')
    ifTrue: [(appClass registerAsApplication: aName withFirstCharacterDownshifted)
                         preferenceAt: #sessionClass put: sessionClass;

        in: [:it | it libraries add: SULibrary]].
  Browser fullOnClass: appClass

createWelcomeMessageOn: appClass name: aName
  |welcomeMessage|
  welcomeMessage := 'Congratulations, you''''ve landed on Seaside: ', aName.
  appClass compile: 'renderContentOn: html' , String cr , String tab ,
                                                        'html heading: ''' , welcomeMessage , ''''.

No comments yet.

blog comments powered by Disqus

Get free blog up and running in minutes with Blogsome | Theme designs available here