[Glass] Short introduction with tODE, Git, packages and so on ...

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Fri May 20 20:52:51 PDT 2016



On 5/20/16 10:14 AM, Marten Feldtmann via Glass wrote:
>
> Hey,
>
> I try to work with tODE again and again and find it very different. 
> Ok, but now again another attempt and here are some questions:
>
>
> -> is there any short introduction to start developing with tODE and 
> git - concerning with Gemstone/S
>
> -> how to start a project
>
`project new` is the command that will create a new project and git repo 
for you. To see the man page:

   man project new

Create a project named FooBar:

   project new FooBar

This command creates a BaselineOfFooBar Metacello baseline, creates a 
git repository at `$GS_HOME/shared/repos/FooBar`, creates a package 
named FooBar-Core, saves the baseline and package to the git repository 
and performs a git commit.

The `project list` command brings up project browser where you can see 
the details of the new FooBar project and all other projects loaded into 
your repository:

   project list

The FooBar project should show up at the top of the `project list` and 
look like the following:

   |FooBar|              d3ac5a1 [master] 
filetree://$GS_HOME/shared/repos/FooBar/repository

The vertical bars means the project is locked (for more info on the 
Metacello lock command see [1]). `d3ac5a1` is the SHA of the commit that 
is loaded into your repository. `[master]` indicates that you are on the 
master branch  of the 
`filetree://$GS_HOME/shared/repos/FooBar/repository` repository.

`man project browse` describes the  browsing commands for viewing 
different aspects of the project: categories, packages, repositories and 
tests.

`project browse --packages FooBar` opens a package list on the packages 
associated with the project:

   BaselineOfFooBar (BaselineOfFooBar-dkh.1)
   FooBar-Core (FooBar-Core-dkh.1)

`project browse --categories FooBar` opens a browse on the list of class 
categories associated with the project. Clicking on a category opens a 
list of classes in the category and clicking on a class opens a "class 
browser" on the class.

`browse project FooBar` opens a browse on the list of classes defined in 
the project. `man browse` gives you a list of the various kinds of 
browsers that you can use.

There are a number of menu items on the `project list` that correspond 
to the `project browse` commands and in general every menu item should 
have a corresponding tODE command and a Smalltalk API to make it easy to 
write your own scripts.

To create your first class in the FooBar project you can use `cls create 
FooBar Object FooBar-Core` and the class will be created in the 
FooBar-Core package. The 'Class > add class' and 'Class > add subclass' 
menu items can be used to create classes. Also you can edit the class 
definition window (`cls definition FooBar`) to add instance variables or 
create new classes or move a class to a different package/category as 
well. `cls comment Foobar` can be used to view and define the class comment.

To add methods you first add method protocol. `cls protocol --add=FooBar 
accessing private` adds the accessing and private instance side 
protocols. 'cls protocol --class --add=FooBar `instance creation`' adds 
class-side protocol. `browse class FooBar` to bring up the "class 
browser", select a protocol and use the 'new method' menu item to bring 
up a method template in a source pane.

At this point you may be ready to save the changes you've made to the 
git repository for the project. Refresh the `project list` by using the 
'Window > refresh window' menu item and you should see something like 
the following for the FooBar project:

   |* FooBar|            d3ac5a1 [master] 
filetree://$GS_HOME/shared/repos/FooBar/repository

The `*` indicates that you've made modifications to the project. Use the 
'changes' menu item or the `project diff FooBar` command to see the 
changes that you've made. Use the 'save' menu item or the 'project 
commit --git --message=`My first commit` FooBar' to save the changed 
packages and do a git commit. The project list should look something 
like the following:

   |FooBar|              6337993 [master] 
filetree://$GS_HOME/shared/repos/FooBar/repository

With no `*` and a new commit SHA.

Now would also be a good time to make a backup of your repository using 
the `bu backup back.dbf`. `bu list` provides a list of the backups 
you've made and should look like the following:

Last Restore: nil
Last Backup:  20/05/2016 20:07:00 -- back.dbf.gz
Backups:
23/04/2016 06:16:55 -- tode.dbf.gz
20/05/2016 20:07:00 -- back.dbf.gz
Snapshots:
23/04/2016 06:17:02 -- extent0.tode.dbf

Note that a `.gz` is tacked onto the backup file name and indicates that 
the backup was gzipped (default). To restore from a backup use `bu 
restore back.dbf.gz`. Look at `man bu snapshot` to see how to create a 
snapshot and look at the $GS_HOME/bin/newExtent script for restoring 
snapshots.

[1] 
https://github.com/dalehenrich/metacello-work/blob/master/docs/LockCommandReference.md#lock-command-reference
>
> -> how can I add already defined packages into projects
>
The exact instructions depend upon you are using a ConfigurationOf or 
BaselineOf for a project, I'll assume that you are using a BaselineOf 
like BaselineOfFooBar.

For completeness the following commands create a test package in the 
Foobar repository, add a TestCase class to the test package:

   mc create FooBar-Tests
   mr add filetree://$GS_HOME/shared/repos/FooBar/repository FooBar-Tests
   cls create FooBarTests TestCase FooBar-Tests

To add the FooBar-Tests package to the FooBar project, you edit the 
BaselineOfFooBar>>baseline: method to match the following:

   baseline: spec
     <baseline>
     spec
       for: #'common'
       do: [
         spec
           package: 'FooBar-Core';
           package: 'FooBar-Tests' with: [ spec requires: 'FooBar-Core' ];
           yourself ]

... and the following saves the new package and the modified baseline:

   project commit --git --message=`add tests` FooBar
>
> -> how do I define my own git server in tODE
>
Not sure what you mean by "git server" ... perhaps I've already answered 
your question? If not give me a bit more info...
>
> -> how to do a commit, a revert and SIMPLE usage of GIT, like one 
> works with svn etc.
>
I think that the "How to Contribute" doc[7] contains a number of good 
examples of using git for a number of things ... Most of the things you 
want to do can also be done from the project list menu:


 From the bash command line, many of the basic git commands are very 
similar to the svn commands ... it's worth skimming the following links 
for getting basic information about using git plus some good docs on 
getting started with git ...

[7] 
https://github.com/GsDevKit/GsDevKit_home/blob/master/docs/howToContribute.md
[6] http://nvie.com/posts/a-successful-git-branching-model/
[2] https://help.github.com/articles/what-is-a-good-git-workflow
[3] http://git-scm.com/book
[4] http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository
[5] http://git-scm.com/book/en/Git-Branching

> -> how can I get a browser feeling in tODE
>
I think this should be covered earlier
>
> You see - only very simple questions :-)))
>
>
Haha, keep the simple questions coming and let me know if something 
doesn't work as expected ... It's a good idea to use the latest version 
of tODE. At a minimum:

   updateGsDevKit -gsi
   todeLoad <stone-name>

Dale

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20160520/3158c818/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fmmdmlgcohocmfhi.png
Type: image/png
Size: 85453 bytes
Desc: not available
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20160520/3158c818/attachment-0001.png>


More information about the Glass mailing list