Skip to content
/ pi Public

Pharo Install - A CLI tool for installing Pharo Smalltalk packages

License

Notifications You must be signed in to change notification settings

hernanmd/pi

Repository files navigation

license-badge PRs Welcome Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Table of Contents

Description

Pharo Install - A command-line tool for installing Pharo Smalltalk packages.

PI is a MIT-pip-like application installer for Pharo Smalltalk. Copy & pasting Pharo install scripts found in forums or the web is an easy method, but it’s also time consuming because of the manual interaction, and hard to make the process reproducible.

PI turns copy & paste Metacello install scripts into shell one-liners which works on Unix/Linux, MacOS and Windows (MinGW64/MSYS).

PI automatically retrieves and parses Pharo GitHub repository information, and also downloads the latest stable Pharo image and virtual machine if none is found in the current directory. It also supports installing multiple packages at once.

Demo

pi-session

Requirements

  • bash or zsh
  • curl or wget
  • unzip
  • jq (a command line JSON processor)
    • Install for MSYS users: pacman -Suy jq
    • Install for Linux users: apt install jq or yum install jq or dnf install jq etc.
    • Install for macOS users: brew install jq
  • gsed
    • Install for MSYS users: ln /usr/bin/sed.exe /usr/local/bin/gsed
    • Install for Linux users: ln /usr/bin/sed /usr/local/bin/gsed
    • Install for macOS users: brew install gsed

Installation

Common steps

The first step is to download the package from a command line terminal:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/hernanmd/pi/master/install.sh)"

The next step is to configure your PATH variable to find the pi command. To find which shell you are using now, type:

echo $0

bash users

To persist usage between multiple shell sessions:

echo "export PATH=$HOME/.pi/pi/bin:$PATH" >> ~/.bash_profile 
source ~/.bash_profile

zsh users

To persist usage between multiple shell sessions:

echo -n 'export PATH=$HOME/.pi/pi/bin:$PATH' >> ~/.zshrc
source ~/.zshrc

Features

  • PI can install and list packages from GitHub repositories.
  • If the Github repository has "pharo" as topic, it will be listed.
  • It works with curl or wget.
  • Supports case-insensitive searching for package names or developer user name.
  • The "image" option download the current Pharo "stable" version to the current working directory.

Usage examples

Installable packages must contain:

  • A Github README.md file
  • "pharo" specified as topic.
  • A Metacello installation script delimited with smalltalk backticks and ending with a dot ".".

If the current directory already contains a Pharo image, PI will use that image, otherwise it will download a new stable image.

Installing

Installing a stable Pharo image in the current directory:

pi image

Install and run the latest Pharo image in a new timestamped directory:

pi nlrun

Installing NeoCSV package:

pi install NeoCSV

Installing multiple packages:

pi install Diacritics ISO3166 StringExtensions

Listing

List packages from GitHub

pi list

Searching

Search in GitHub repositories:

pi search microdown

Output may contain multiple repositories

pi search magritte
GitHub: peteruhnak/xml-magritte-generator
GitHub: philippeback/Magritte3Doc
GitHub: grype/Magritte-Swift
GitHub: hernanmd/Seaside-Magritte-Voyage
GitHub: hernanmd/Seaside-Bootstrap-Magritte-Voyage
GitHub: udoschneider/BootstrapMagritte

in that case, disambiguate specifying /<repository_name>, ex:

pi install grype/Magritte-Swift

Troubleshooting

If you experiment problems with pi, please run the collect environment script:

./runPiCollectEnv

And open an issue with the output in the Issue Tracker).

You can obtain the pi version with:

pi version

Contribute

Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub

If you have discovered a bug or have a feature suggestion, feel free to create an issue on Github.

If you'd like to make some changes yourself, see the following:

  • Fork this repository to your own GitHub account and then clone it to your local device
  • Edit the pi file with your favorite text editor.
  • Test PI.
  • Add to add yourself as author below.
  • Finally, submit a pull request with your changes!
  • This project follows the all-contributors specification. Contributions of any kind are welcome!

Develop

To add tests

  • Have a look at bats.
  • Check the .bats files in the tests directory

To deploy a new release

  • Install release-it
  • Copy or setup a GitHub token
  • Evaluate export GITHUB_TOKEN=... with the coped token as value. Alternatively, log-in to your GitHub account with your web browser and release-it will authenticate.
  • Ensure NVM is installed and accessible running: source ~/.nvm/nvm.sh
  • To interactively deploy run ./deploy.sh