rancher/trash

Name: trash

Owner: Rancher

Description: Minimalistic Go vendored code manager

Created: 2015-12-16 12:02:32.0

Updated: 2018-05-24 07:20:01.0

Pushed: 2018-01-30 18:27:45.0

Homepage:

Size: 1130

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Trash - Go ./vendor manager

Keeping the trash in your ./vendor dir to a minimum.

How to use

Make sure you're using go1.6 or later version.

  1. Download and extract latest release to your PATH. Alternatively, install or update current development version with go get -u github.com/rancher/trash.
  2. Copy vendor.conf file to your project and edit to your needs.
  3. Run trash.

vendor.conf (in your project root dir) specifies the revisions (git tags or commits, or branches - if you're drunk) of the libraries to be fetched, checked out and copied to ./vendor dir. For example:

ub.com/rancher/trash

ub.com/Sirupsen/logrus                      v0.8.7    https://github.com/imikushin/logrus.git
ub.com/codegangsta/cli                      b5232bb
ub.com/cloudfoundry-incubator/candiedyaml   5a459c2

Or, in YML format:

rt:
ckage: github.com/Sirupsen/logrus               # package name
rsion: v0.8.7                                   # tag or commit
po:    https://github.com/imikushin/logrus.git  # (optional) git URL

ckage: github.com/codegangsta/cli
rsion: b5232bb2934f606f9f27a1305f1eea224e8e8b88

ckage: github.com/cloudfoundry-incubator/candiedyaml
rsion: 55a459c2d9da2b078f0725e5fb324823b2c71702

Run trash to populate ./vendor directory and remove unnecessary files. Run trash --keep to keep all checked out files in ./vendor dir.

Inspiration

I really liked glide, it's like a real package manager: specify what you need, run glide up and enjoy your updated libraries. But it didn't help with a couple problems I had:

I'd been slightly reluctant to the idea of writing it, but apparently the world needed another package manager: “Come on, it's just going to be 300 (okay, it's ~600) lines of Go!” Thanks to @ibuildthecloud for the idea.

Help

For the world's convenience, trash can detect glide.yaml (and glide.yml, as well as trash.yaml) and use that instead of vendor.conf (and you can Force it to use any other file). Just in case, here's the program help:

ash -h
:
rash - Vendor imported packages and throw away the trash!

E:
rash [global options] command [command options] [arguments...]

ION:
0.2.5

OR(S):
imikushin, @ibuildthecloud

ANDS:
 help, h  Shows a list of commands or help for one command

AL OPTIONS:
-file value, -f value       Vendored packages list (default: "vendor.conf")
-directory value, -C value  The directory in which to run, --file is relative to this (default: ".")
-keep, -k                   Keep all downloaded vendor code (preserving .git dirs)
-update, -u                 Update vendored packages, add missing ones
-debug, -d                  Debug logging
-cache value                Cache directory (default: "/Users/ivan/.trash-cache") [$TRASH_CACHE]
-help, -h                   show help
-version, -v                print the version

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.