[Glass] Moving from .mcz files to git - help

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Sat May 13 11:46:10 PDT 2017

On 5/12/17 1:21 PM, Reg Krock via Glass wrote:
> Hi,
> I was able to successfully load the .mcz files into the 3.3.3 server with your help.
> Now the issue is how to go forward since I do not have an already defined metacello for my project (ConfigurationOfMyProject).
Stef and Mariano have written a very good introduction to Metacello[1], 
then read the "Create Baseline" section[2] in the Getting Started with 
Github doc[3]. You need to use a BaselineOf with github projects. The 
BaselineOf describes package load order and project dependencies.
> 1) Can I have a local copy of git while still interacting with GitHub?
Yes. First you probably want to review the Github WorkFlow[4] which will 
give you an overview of working with local git clones and Github. If you 
are not familiar with git I recommend looking at this site[5] to get an 
overview and then google any git questions you have ... git-scm.com[6] 
has a good getting started section for git as well as complete 
> 2) What hints/directions do you have about setting up gitfiletree, and other needed pieces. I have watched your video on creating a project but there are still some pieces missing.
I assume that you are using GsDevKIt_home and tODE. GsDevKit_home 
provides a standard directory structure for stones and shared resources 
like shared git repositories for projects.

$GS_HOME/shared/repos is the directory where all shared git projects are 
found and you will locate your local project git repositories there as well.

If you didn't have any existing packages and were starting a project 
from scratch, the `project new` command would create your baseline, a 
package, a project entry and a git repository for your project[9].

You have a couple of existing mcz packages .... instead of giving you a 
list of tode commands to execute, I decided to write a tode script 
(attached... copy the attached newProject.ston file to 
$GS_HOME/sys/local/server/home) that you can run ... it performs all of 
the major steps done by the `project new` command but takes a list of 
existing/loaded packages and a project name:

-h                                                              # 
display script man page
   /home/newProject --packages=`Package-1 Package-2` Foo # create 
project Foo

At the end the script brings up a `project list` and you should see your 
project listed at the top of the list ...

I encourage you to look at the script (`edit /home/newProject`) to see 
what can be done in a tode shell script. Create your own with `touch sh 
<script-name>`) ... Scripts are very convenient for storing and sharing 
scripts between different stones ... By default scripts created in /home 
are local to the stone only, but you can move a script to 
/sys/local/server/home (`mv <script-name> /sys/local/server/home`) and 
it will be available to all stones ...

At this point, you have a project entry in a shared location 
($GS_HOME/sys/local/server/projects) so if you want to load your project 
into a new stone, you only need to do the following:

   project load Foo

or use 'load' menu item in `project list` or create a stone with the 
project loaded:

   createStone -f -l Foo foo_334 3.3.4

When you make modifications to the packages or baseline, you can review 
the changes you've made using the 'changes' menu item in the project 
list or commit your changes to the git repository using the 'save' menu 
item in the project list.

Finally, I suggest that you create a /home/go script (`touch tpz 
/home/go`) to setup your environment at login. Open browsers, class 
lists, tests, etc. At the moment the go file is not automatically 
executed. I've attached one of my own `go` files as an example. After 
opening the shell window, I run `./go` to set things up ... or if the 
windows get too cluttered, I do a `close` then `./go` to get back to a 
clean starting point.

Hope this helps,


[4] https://guides.github.com/introduction/flow/index.html
[5] https://rogerdudler.github.io/git-guide/
[6] https://git-scm.com/book/en/v2/Getting-Started-Git-Basics
[8] https://github.com/GsDevKit/GsDevKit_home/tree/gh-pages
-------------- next part --------------
TDScriptLeafNode{#name:'newProject',#contents:'[ :topez :objIn :tokens :command :commandNode | 
  | opts args |
  \"for help: ./newProject -h\"
      {#(\'help\' $h #\'none\').
      #(\'packages\' nil #\'required\')}
    optionsAndArguments: [ :options :operands | 
      opts := options.
      args := operands ].
    at: \'help\'
    ifAbsent: [ 
      | projectEntry packageNames projectName projectTool mcTool toolBox registration path dir gitRepoDir gitRepoPath gitTool baselinePackageName |
      projectTool := topez toolInstanceFor: \'project\'.
      mcTool := topez toolInstanceFor: \'mc\'.
      packageNames := #().
      projectName := args at: 1.
      projectEntry := TDProjectSpecEntryDefinition new.
      gitRepoPath := \'$GS_HOME/shared/repos/\' , projectName.
      path := \'$GS_HOME/shared/repos/\' , projectName , \'/repository\'.
      gitRepoDir := ServerFileDirectory on: gitRepoPath.
      gitRepoDir assureExistence.
      gitRepoDir createDirectory: \'repository\'.
      gitTool := topez toolInstanceFor: \'git\'.
      gitTool gitinitIn: gitRepoDir with: \'\'.\t\"Step 1. Create a git repository for the project in $GS_HOME/shared/repos\"
        baseline: projectName
          repository: \'filetree://\' , path
          loads: #(\'default\');
        status: #(#\'active\');
        locked: true.
        createProjectEntryInNode: \'/sys/local/server/projects\'
        topez: topez.\t\"Step 2. Create project entry for the project\"
        at: \'packages\'
        ifPresent: [ :arg | 
          packageNames := arg findTokens: \' \'.
            do: [ :packageName | 
              | matches |
              matches := mcTool findMatchingPackages: packageName topez: topez.
              matches isEmpty
                ifTrue: [ 
                  | wc |
                  wc := mcTool mccreate: packageName.
                  wc modified: true.
                  wc repositoryGroup addRepository: projectEntry repository ].
                do: [ :wc | 
                  wc packageName = packageName
                    ifTrue: [ 
                      \"Step 3. Add the new repository to each of the listed packages\"
                      wc modified: true.
                      wc repositoryGroup addRepository: projectEntry repository ] ] ] ].
      baselinePackageName := \'BaselineOf\' , projectName.
        projectNewCheckAndCreatePackage: baselinePackageName
        for: projectEntry
        mcTool: mcTool
        force: false.
      (toolBox := MetacelloToolBox baselineNamed: projectName)
        createBaselineOfMethod: \'baseline:\' inCategory: \'baseline\';
        addBaselineOfSection: #\'gemstone\'
          requiredProjects: #()
          packages: packageNames
          repositories: #()
          dependencies: #()
          groups: #()
          versionSpecsDo: [ :versionSpec |  ];
        commitBaselineOfMethod.\t\"Step 4. Create a BaselineOf for the project\"
      registration := projectTool
        resolveProjectRegistrationReference: projectName.
        projectCommit: registration
        configCommit: false
        gitCommit: true
        commitMessage: \'initial commit\'.\t\"Step 5. Commit the new baseline and packages to the new git repository\"
        registrationForProjectSpec: registration projectSpec
        ifAbsent: [ :new | self error: \'New project spec unexpectedly unregistered\' ]
        ifPresent: [ :existing :new | 
          \"register as a loaded project\"
            copyOnWrite: [ :existingCopy | 
              \"Step 6. Register the new project as loaded in the image\"
                loadedInImage: true;
                merge: new ] ].
      topez evaluateCommandString: \'project list\'\t\"Step 7. Open the `project list`\" ]
    ifPresent: [ :ignored | 
  newProject - newProject script utility template
  newProject [-h|--help] [--packages=<list of package names>] <project-name>
  Create a new project for a project that currently consistes of a couple of 
  mcz files that are already loaded in the image.

  Step 1. Create a git repository for the project in $GS_HOME/shared/repos 
  Step 2. Create project entry for the project
  Step 3. Add the new repository to each of the listed packages
  Step 4. Create a BaselineOf for the project
  Step 5. Commit the new baseline and packages to the new git repository
  Step 6. Register the new project as loaded in the image
  Step 7. Open the `project list`

  ./newProject --help
  ./newProject -h

  ./newProject --packages=`Foo-Core Foo-Tests` Foo
        topez: topez ] ]',#creationTime:DateAndTime['2017-05-13T07:27:43.1166250705719-07:00'],#modificationTime:DateAndTime['2017-05-13T09:57:39.8648419380188-07:00']}
-------------- next part --------------
# browse class --exact --hier AbstractIndexSpecification GsOptions GsIndexSpec
browse class --full EnumeratedPathTerm
browse class ^gs ^btree 
browse method --spec PathTerm>>addMappingsForObject:traverseUpTo:for:logging:
project list
edit /home/go
project browse --tests GLASS1
# test class BtreePlusEqualityTests
# limit format false
# project browse --classes GLASS1
eval `System configurationAt: #GemExceptionSignalCapturesStack put: true`

More information about the Glass mailing list