Sidenote: Creating Monticello Package from Existing Code
Last updated at 6:35 am UTC on 20 December 2008
Back to Development Tools Overview (Monticello, SqueakSource, SqueakMap)
1.1 Manage pre-Existing Squeak Code under Monticello
Let's say you have Squeak code which you manage by some means, possibly as Changesets. If you decide to manage your code under Monticello, this article may provide some hints fow to put code under Monticello management.
1.2 Where to start
First decide how to organize existing Classes into Monticello Packages. Squeak provides a way to organize code through making class belong to a system category and methods to a method category. A System Category is what you see on the left pane of most browsers, or alternatively, in the class definition, for example:
Object subclass: #Wrapper
instanceVariableNames: 'someVariables'
classVariableNames: ''
poolDictionaries: ''
category: 'MorphicWrappers'
The above class would naturally make sense to be added to Monticello package named MorphicWrappers. However, because the tradition of "monkey patching", there are methods which defined on, for example, class P1A which belongs to category P1, but those methods exist for the benefit of class P2B which belongs to a different (foreign) category P2. This is supported by Monticello.
1.2 How to organize existing code?
This note will use MorphicWrappers as an example name for the Monticello Package name. In your code, just substitute MorphicWrappers for any name you choose.
Ensure your classes and methods will be managed as Monticello Package named MorphicWrappers. This is achieved by putting your classes and methods in system categories and method categories recognized using a set of Monticello naming conventions.
1.3 Monticello naming Conventions
Are naming conventions that define naming rules by which Classes belong to Monticelly package and allow methods to be maintained on foreign packages.
Monticello uses naming conventions to define classes and functions to be members of a particular project. So any class and method that you want to be part of your package, must adhere to such naming conventions, listed below. The naming conventions below are re-worded from the original http://www.wiresong.ca/Monticello/UserManual/PackageInfo/:
A Monticello Package named "MorphicWrappers" contains Classes and Methods based on the following Rules:
- CLASS RULE 1, based on system category name:
- Monticello project contains all classes C where
- C belong to system category named "MorphicWrappers", OR
- C belong to system category name starting with "MorphicWrappers-".
- METHOD RULE 1, based on method category name and method name):
- Monticello project contains all method definitions M where
- M belong to method category name "*morphicWrappers" OR
- M belong to method category name starting with "*morphicWrappers-".
- METHOD RULE 2, based on system category name:
- Monticello project contains all method definitions M where
- M belong to a class in the system category "MorphicWrappers", OR
- M belong to a class in system category with name starting with "MorphicWrappers-"
- MINUS methods which method category starts with "*" (then the method must belong to other module).
1.4 Name all classes and methods which will be part of the "MorphicWrappers Package" following the above rule.
1.5 Convert the MorphicWrappers System Category into Monticello Package named MorphicWrappers.
This step will also create the Monticello Repository that stores code for the package.
First, a short introduction of this step. It will create what is called the "Monticello Repository". Monticello repository is a storage of the code. It can be stored as "Directory", "HTTP", "FTP", "Squeakmap Release" and others. We will have an option to select one of them a bit later, but as a general comment, each of these "storage typess" is capable of storing and managing our package. Each package will have an extension ".mcz", so in our case, we will have MorphicWrappers.mcz.
First create a "directory" type repository on your local machine.
- Red-click (Left-click) on the Squeak desktop (world), a menu appears, click "Open"
- In the "Open" menu, click on "Monticello Browser". The "Monticello Browser" window appears. On the left, you should see line with your System Category name, MorphicWrappers. Click on this line.
- In the Monticello Browser, click on the "+Package". This will create, in the left pane, a line named "MorphicWrappers()". Essentially, this has created, but not saved yet, our new package (unless it exists).
- On prompt, name the Package MorphicWrappers.
Continue in Development Tools Overview (Monticello, SqueakSource, SqueakMap)