How to set up a new GitHub repo

TL;DR

We see with an example how to set up a fresh github repo as an Iceberg project that you can load with a Metacello script.

Steps

Create a new github repo. Eg gt-comment-analysis.

Clone the repo using the git ssh credentials, eg git@github.com:onierstrasz/gt-comment-analysis.git.

Create a src folder in the repo.

(FileLocator localDirectory / 'iceberg' / 'onierstrasz' / 'gt-comment-analysis' / 'src') ensureCreateDirectory 
  

Select the project in the Git tool, add the src folder, select it, and click Repair to add project metadata to the new src folder.

Add a first class and package, eg CommentAnalyzer in package GtCommentAnalysis.

From the Git tool, add the package. (Go to the Packages tab and select the + button.)

Now add a Metacello baseline, for example, add a subclass of BaselineOf calledBaselineOfGtCommentAnalysis in a package of the same name, and add it to the repo.

NB: Don't forget to make the new baseline class a subclass of BaselineOf ConfigurationOf subclass: #BaselineOf instanceVariableNames: '' classVariableNames: '' package: 'Metacello-Base' , and not of Object.

Add the baseline: method specifying the dependencies:

        
baseline: spec
	<baseline>
	spec for: #common do: [ spec package: 'GtCommentAnalysis' ]
        
      

Commit and push. Verify on github that the commit succeeded. Both packages GtCommentAnalysis and BaselineOfGtCommentAnalysis and their classes should appear in the src folder.

Add (and adapt) the following snippet to the README of your project:

        
Metacello new
	baseline: 'GtCommentAnalysis';
	repository: 'github://onierstrasz/gt-comment-analysis:main/src';
	load.
        
      

NB: Git is currently changing the name of the default branch from master to main, which can mess things up. You can either explicitly refer to the branch to use in the script (as we see above), or you can change the default in your git configuration, i.e., edit the file .gitconfig, typically in your home directory, to include:

        
[init]
	defaultBranch = main
        
      

To test, select the repo in the Git tool and remove it (- button). Then load it with the script above.

Metacello new
	baseline: 'GtCommentAnalysis';
	repository: 'github://onierstrasz/gt-comment-analysis:main/src';
	load.
  

See also

To learn all about specifying more complex dependencies, see How to deal with Baselines in the Pharo wiki.