Manage Your Code With Iceberg: Stéphane Ducasse and Guillermo Polito
Manage Your Code With Iceberg: Stéphane Ducasse and Guillermo Polito
Attribution. You must attribute the work in the manner specified by the author or
licensor (but not in any way that suggests that they endorse you or your use of
the work).
Share Alike. If you alter, transform, or build upon this work, you may distribute the
resulting work only under the same, similar or a compatible license.
For any reuse or distribution, you must make clear to others the license terms of this
work. The best way to do this is with a link to this web page:
http://creativecommons.org/licenses/by-sa/3.0/
Any of the above conditions can be waived if you get permission from the copyright
holder. Nothing in this license impairs or restricts the author’s moral rights.
Your fair dealing and other rights are in no way affected by the above. This is a human-
readable summary of the Legal Code (the full license):
http://creativecommons.org/licenses/by-sa/3.0/legalcode
Layout and typography based on the sbabook LATEX class by Damien Pollet.
Contents
Illustrations ii
4 Iceberg Glossary 23
4.1 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 Iceberg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
i
Illustrations
ii
Part I
The authors want to thank Sean de Nigris and Stefan Eggermont for the re-
views and copy-edit for the early version.
3
CHAPTER 1
Publishing your first project
In this chapter we explain how you can publish your project on github us-
ing Iceberg. We do not explain concepts like commit, push/pull, merging, or
cloning. We thank Peter Uhnak for his first blog on publishing Pharo code on
Github.
As git is distributed versioning system, you need a local clone of the repos-
itory. This is to this local repository that your changes will be commited to
before being pushed to remote repositories. In general you commit to your
local clone, and from there you push to remote repositories like github or
gitlab, or that of your company. Iceberg will do all the operations and more
for you.
5
Publishing your first project
For both OSX and linux you can add such lines to your .bash_profile (or
the one corresponding to your shell installation such as .zshrc) so they are
automatically executed on each new shell session.
6
1.3 Create a new project on github
Note Pro Tip: this can be used too in case you have a non-default key
file. You just need to replace id_rsa with your file name.
7
Publishing your first project
8
1.5 [Optional but strongly suggested] Adding a src directory
9
Publishing your first project
Copy”), you should ask Iceberg to fix it using the Repair command.
Iceberg cannot solve all situations automatically, but it will propose and ex-
plain possible repair actions. The actions are ranked from most to least prob-
able. Each action will explain the situation and the consequence of the pro-
posed action. It is always a good idea to read them.
Figure 1-6 shows the ”Create project metadata” action and its explanation.
10
Figure 1-7 Showing where the metadata will be saved and the format encodings.
Figure 1-9 The package is clean, metadata are saved, but it is not loaded.
Again, Iceberg shows that your package contains changes that are not com-
mitted using the green color and the * in front of the package name.
Now you are left with two actions:
• Commit the changes to your local repository using the Commit button.
Iceberg will reflect this change by removing the * and the changing the
color.
You can commit several times if needed.
• Publish your changes from your local directory to your remote reposi-
tory using the Push button.
When you push your changes, Iceberg will show you all the commits awaiting
publication and will push them to your remote repository as shown in Figure
1-11. The figure shows the commits we are about to make to add a baseline,
which will allow you to easily load your project in other images.
12
1.9 Defining a BaselineOf
Once you have defined your baseline, you should add it to your project as
shown in Figure 1-12. Now, commit it and push your changes to your remote
repository.
The online baseline documentation is available at: https://github.com/pharo-open-document
pharo-wiki/blob/master/General/Baselines.md.
13
Publishing your first project
For projects with metadata, like the one we just created, that’s it. However,
if you are loading a project without metadata, you must add the code sub-
folder to the end of the repository string i.e. ’github://Ducasse/MyCoolPro-
jectWithPharo/src’.
14
1.11 [Optional] Add a nice .gitignore file
pharo.version
meta-inf.ston
# Since Pharo 70, all local cache files for Monticello package
cache, playground, epicea... are under the pharo-local
/pharo-local
# Metacello-github cache
/github-cache
github-*.zip
15
CHAPTER 2
Empowering your projects
Now that you can save your code on github in a breeze, you can take advan-
tage of services to automate actions, for example using Travis.
.smalltalk.ston
SmalltalkCISpec {
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'MyCoolProjectWithPharo',
#directory : src',
#platforms : [ #pharo ]
}
]
17
Empowering your projects
If you’ve done everything right, Travis will pick up the changes and will start
testing and building it… and you’re done, congratulations!
2.2 On windows
If you want to make sure that your code runs on windows, you should use the
Appveyor service and add the appveyor.yml file.
environment:
CYG_ROOT: C:\cygwin
CYG_BASH: C:\cygwin\bin\bash
CYG_CACHE: C:\cygwin\var\cache\setup
CYG_EXE: C:\cygwin\setup-x86.exe
CYG_MIRROR: http://cygwin.mirror.constant.com
SCI_RUN: /cygdrive/c/smalltalkCI-master/run.sh
matrix:
- SMALLTALK: Pharo-6.1
- SMALLTALK: Pharo-7.0
platform:
- x86
install:
- '%CYG_EXE% -dgnqNO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l
"%CYG_CACHE%" -P unzip'
- ps: Start-FileDownload
"https://github.com/hpi-swa/smalltalkCI/archive/master.zip"
"C:\smalltalkCI.zip"
- 7z x C:\smalltalkCI.zip -oC:\ -y > NULL
build: false
test_script:
- '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0</dev/null;
$SCI_RUN"'
18
2.3 Adding badges
[]
(https://travis-ci.com/Ducasse/Containers-Stack)
[
[]()
[]
(https://pharo.org/download)
[]
(https://pharo.org/download)
## Installation
The following script installs Containers-Stack in Pharo.
```smalltalk
Metacello new
baseline: 'ContainersStack';
repository: 'github://Ducasse/Containers-Stack/src';
load.
```
To obtain the necessary link, click on the badge in your Travis project overview
and select one of the options. You can insert the markdown code directly
into your README.md.
19
CHAPTER 3
Understanding the architecture
21
Figure 3-1 Create a new project.
CHAPTER 4
Iceberg Glossary
Git is complicated. Git with (Pharo) images is even more complicated. This
page introduces the vocabulary used by Iceberg. Part of this vocabulary is
Git vocabulary, part of it is Github’s vocabulary, part of it is introduced by
Iceberg.
4.1 Git
23
Iceberg Glossary
When using iceberg, you normally do not need to think about the index, Ice-
berg will handle it for you. Still, you might need to be aware that the index
is part of the git repository, so if you have other tools working with the same
repository there might be conflicts between them.
Upstream (Git)
The upstream of a branch is a remote branch which is the default source
when you pull and the default target when you push. Most probably it is a
branch with the same name in your origin remote repository.
Commit-ish (Git)
A commit-ish is a reference that specifies a commit. Git command line tools
usually accept several ways of specifying a commit, such as a branch or tag
name, a SHA1 commit id, and several fatality-like combinations of symbols
such as HEAD^, @{u} or master~2.
The following table contains examples for each commit-ish expression. A
complete description of the ways to specify a commit (and other git objects)
can be found at https://mirrors.edge.kernel.org/pub/software/scm/git/docs/
gitrevisions.html#_specifying_revisions.
----------------------------------------------------------------------
| Format | Examples
----------------------------------------------------------------------
| 1. <sha1> |
dae86e1950b1277e545cee180551750029cfe735
| 2. <describeOutput> | v1.7.4.2-679-g3bee7fb
| 3. <refname> | master, heads/master, refs/heads/master
| 4. <refname>@{<date>} | master@{yesterday}, HEAD@{5 minutes
ago}
| 5. <refname>@{<n>} | master@{1}
| 6. @{<n>} | @{1}
| 7. @{-<n>} | @{-1}
| 8. <refname>@{upstream} | master@{upstream}, @{u}
| 9. <rev>^ | HEAD^, v1.5.1^0
| 10. <rev>~<n> | master~3
| 11. <rev>^{<type>} | v0.99.8^{commit}
24
4.2 Iceberg
4.2 Iceberg
25
Iceberg Glossary
26