Awesome Open Source
Awesome Open Source

Rock

With Rock you can easily manage your Project, metadata and Swift CLI dependencies. Additionally you can install Swift CLIs globally. The index of all supported libraries can be found on the RockSpecs repository, but you can declare your own at your Rockfile.

Overview

Dependencies are called Rockets (aka πŸš€). If they can be build with the Swift Package Manager, they should already be compatible out of the box. Each πŸš€ has a RocketSpec which defines the Git url and how it has to be installed.

Project

You can create a project by simply running:

$ rock init

This will create you an empty Rockfile which declares all your dependencies and metadata.

name: YourProject
dependencies:
  - empty # Just an empty dependency that installs fast
  # Insert your dependencies here
  # - [email protected]
  # - name: owncli
  #   url: https://github.com/your/owncli

Additionally you may create any additional tags. Each value will be interpreted as a Stencil template, that will be executed in a context of all previously declared values. The tags constants, version, license, name and url will have precedence.

After you have set up your metadata and dependencies, you can install those by running:

$ rock install

Now you can work with all your CLIs. If you want to create your own custom scripts, you can add the script tag:

name: YourProject
dependencies: [] # your dependencies
author:
  name: Valentin Knabel
  email: [email protected]
scripts:
  hello: echo Hello {{ author.name }}
  xcodeproj:
    - swift package generate-xcodeproj
    - open {{ name }}.xcodeproj

Thereafter you are able to run all your scripts with ease:

$ rock run hello
Hello Valentin Knabel

Additionally there are convenience commands with default scripts made for the Swift Package Manager:

$ rock build
πŸƒ swift build
$ rock test
πŸƒ swift test
$ rock archive
πŸƒ swift build -c release

Global

Installing dependencies globally is currently only supported for Rockets that can be found in the RockSpecs repository. You may install them by simply running:

# With a fixed version/tag/branch
$ rock install [email protected] [email protected]
# Or using the default (e.g. master)
$ rock install swiftgen

If you want to uninstall specific Rockets, just run:

$ rock uninstall sourcery swiftlint swiftgen

Installation

First add the rock-bin to your $PATH variable to your .bashrc, .bash_profile or .zshrc.

export ROCK_PATH="$HOME/.rock" # default
export PATH="$PATH:./.rock/bin:$ROCK_PATH/bin"

Thereafter start 🎸ing your πŸš€s by simply cloning the repository, building the swift module and installing rock itself.

$ git clone https://github.com/vknabel/rock $ROCK_PATH/sources/rock
$ cd $ROCK_PATH/sources/rock
$ swift build
$ mkdir $ROCK_PATH/bin
$ cp $ROCK_PATH/sources/rock/.build/debug/rock $ROCK_PATH/bin

Alternatively you may try out our Swift Installer (you still need to set up your $PATH and ROCK_PATH):

$ curl -sL https://raw.githubusercontent.com/vknabel/Rock/master/Scripts/Install.generated.swift | swift -

Updates

Rock can be updated by simply running installing itself with a version specified.

$ rock install [email protected]

Limitations

  • Rock downloads and compiles all of your dependencies isolated and therefore installations may take a while.
  • Currently there is no version handling. Instead only the master branch will be checked out by default.

Author

Valentin Knabel, @vknabel, [email protected]

License

Rock is available under the MIT license.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
swift (6,644)Β 
linux (1,811)Β 
swift-package-manager (83)Β 
swift-3 (82)Β 
install (39)Β 
swiftpm (15)Β 

Find Open Source By Browsing 7,000 Topics Across 59 Categories