reqs

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2018 License: GPL-3.0 Imports: 11 Imported by: 0

README

reqs

Reqs is a cross-platform Linux and MacOSX systems package management tool. It wraps apt, homebrew, dnf and is able to automatically determine the right tool to use based on the system. It checks requirements files and/or reqs.yml files.

The main focus of reqs is system package management abstraction with pip and possibly gem support added as an after thought to ease some project deployments. Because pip and ruby reqs generally don't differ from system-to-system abstracting those tools is not so important to reqs.

Best way to use reqs is with a reqs.yml file in you repositories.

reqs.yml

common:
  - curl
  - git
apt:
  - golang-go
brew:
  - go
dnf:
  - golang

Then run reqs in your repos and it'll install your system-level dependencies for you.

Can use separate requirements files, like how pip requirements.txt work with package names each on a new line and it tries to install the packages listed in it using either apt-requirements.txt, dnf-requirements.txt, brew-requirements.txt, or common-requirements.txt.

It can gather these requirements for multiple directories and/or recursively and combine them into a single installation call.

reqs automatically determines the tool to used based on the system and what is available.

Installation

Fast

bash -c "$(curl -sL https://raw.githubusercontent.com/iepathos/reqs/master/download.sh)"

Or download the latest release for your system from https://github.com/iepathos/reqs/releases

Or install with go if you're gopher inclined

go get -u github.com/iepathos/reqs/cmd/reqs

Usage

Automaticaly finds apt-requirements.txt, brew-requirements.txt, dnf-requirements.txt, common-requirements.txt, and reqs.yml files. common-requirements.txt are accepted for cross-platform shared same-name system dependencies.

For an example reqs.yml see https://github.com/iepathos/reqs/blob/master/examples/reqs.yml

Example dev setup https://github.com/iepathos/reup

view reqs args and their descriptions

reqs -h

install all of the example projects with system pip and system npm

reqs -r -d examples -spip -snpm

install requirements in the current directory

reqs

recurse down directories to find requirements files

reqs -r

get requirements from a specific directory, automaticaly detect appropriate -requirements.txt to use

reqs -d /some/path/

get requirements from a specific file

reqs -f tool-requirements.txt

get requirements from stdin

reqs -i < tool-requirements.txt

generate apt requirements from the currently installed apt packages

reqs -o > apt-requirements.txt

generate apt requirements with the versions info locked installed

reqs -ov > apt-requirements.txt

generate brew requirements from the currently install brew packages

reqs -o > brew-requirements.txt

update packages before installing requirements

reqs -u

update and upgrade packages before installing requirements

reqs -up

quiet mode squelch everything but errors

reqs -q

force reinstall of packages

reqs -force

Releasing

Must have Go installed. Recent version is better. Relies on go-dep and go-releaser. release.sh will attempt to install/update both go packages and whatever other deps reqs has using dep. git tag the current commit you wish to release with the next appropriate version tag and run

./release.sh

Must export GITHUB_TOKEN with permission to push to origin master for the git repo. If you just fork off github.com/iepathos/reqs and then use a personal access github token with repo permission you should be groovy.

Testing

Cross-platform tests are executed using Vagrant https://www.vagrantup.com/ to define and manage Ubuntu, Fedora, and OSX virtual machines and execute reqs on example projects on those systems.

Todo

  • refactor reqs code until it's beautiful
  • add gem, npm, and bower comprehension or just stick to system packages?

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendNewLinesOnly added in v0.2.7

func AppendNewLinesOnly(text, newText string) (returnText string)

func AptListInstalled added in v0.4.0

func AptListInstalled(withVersion bool) (reqs string)

func BrewListInstalled added in v0.4.0

func BrewListInstalled() string

func DnfListInstalled added in v0.4.0

func DnfListInstalled(withVersion bool) (reqs string)

func FatalCheck

func FatalCheck(err error)

func FindNpmPackageDirs added in v0.4.0

func FindNpmPackageDirs(dir string, recurse bool) (packageDirs []string)

func GetAptSources added in v0.4.0

func GetAptSources() (out string)

func GetBrewTaps added in v0.4.0

func GetBrewTaps() string

func GetNpmRequirements added in v0.4.0

func GetNpmRequirements(dir string, recurse bool) (text string)

func GetNpmRequirementsMultipleDirs added in v0.4.0

func GetNpmRequirementsMultipleDirs(dirPaths []string, recurse bool) (reqs string)

func GetPip3Requirements added in v0.4.0

func GetPip3Requirements(dirPath string, recurse bool) (text string)

func GetPip3RequirementsMultipleDirs added in v0.4.0

func GetPip3RequirementsMultipleDirs(dirPaths []string, recurse bool) (reqs string)

func GetPipRequirements added in v0.4.0

func GetPipRequirements(dirPath string, recurse bool) (text string)

func GetPipRequirementsMultipleDirs added in v0.4.0

func GetPipRequirementsMultipleDirs(dirPaths []string, recurse bool) (reqs string)

func GetRequirementFilenames added in v0.4.0

func GetRequirementFilenames(dirPath string, recurse bool) (fileNames []string)

func InstallHomebrew added in v0.4.0

func InstallHomebrew()

func IsCommandAvailable added in v0.2.7

func IsCommandAvailable(name string) bool

func NewLineIfNotEmpty added in v0.2.7

func NewLineIfNotEmpty(text, newText string) string

func NpmInstall added in v0.2.9

func NpmInstall(requirements, dir string, sudo, global, quiet bool)

func PipInstall added in v0.2.7

func PipInstall(requirements, pipPath string, sudo, upgrade, quiet bool)

pip install given requirements, optionally --upgrade as well

func StdoutReqsYml added in v0.2.9

func StdoutReqsYml(yml map[string][]string)

func StringContainedInSlice added in v0.2.7

func StringContainedInSlice(s string, arr []string) bool

func StringInSlice added in v0.2.7

func StringInSlice(a string, list []string) bool

Types

type PackageConfig

type PackageConfig struct {
	Tool          string
	Sudo, AutoYes string
	Reqs          string
	Quiet, Force  bool
}

func (PackageConfig) Install

func (pc PackageConfig) Install(upgrade bool)

func (PackageConfig) Update

func (pc PackageConfig) Update()

func (PackageConfig) Upgrade

func (pc PackageConfig) Upgrade()

type RequirementsParser

type RequirementsParser struct {
	Dir, File           string
	UseStdout, UseStdin bool
	WithVersion         bool
	Recurse             bool
	Sources             bool
}

func (RequirementsParser) FindNpmPackageDirs added in v0.3.1

func (rp RequirementsParser) FindNpmPackageDirs() (packageDirs []string)

func (RequirementsParser) GenerateReqsYml added in v0.2.9

func (rp RequirementsParser) GenerateReqsYml() map[string][]string

TODO: check the exist reqs.yml in current directory if one exists and merge the results together, removing duplicate entries check the currently installed packages for system and/or pip deps and return the string for a reqs.yml

func (RequirementsParser) ListInstalled added in v0.2.1

func (rp RequirementsParser) ListInstalled(packageTool string) (requirements string)

func (RequirementsParser) Parse

func (rp RequirementsParser) Parse() (sudo, packageTool, autoYes, reqs string)

determine package tool and args on this system

func (RequirementsParser) ParseNpm added in v0.3.1

func (rp RequirementsParser) ParseNpm() (reqs string)

func (RequirementsParser) ParsePip added in v0.2.7

func (rp RequirementsParser) ParsePip() (reqs string)

func (RequirementsParser) ParsePip3 added in v0.4.0

func (rp RequirementsParser) ParsePip3() (reqs string)

type VagrantSystem added in v0.4.0

type VagrantSystem struct {
	Arch, Status string
}

func (VagrantSystem) Down added in v0.4.0

func (vm VagrantSystem) Down()

func (VagrantSystem) Run added in v0.4.0

func (vm VagrantSystem) Run(cmdStr string) error

func (VagrantSystem) Up added in v0.4.0

func (vm VagrantSystem) Up()

Directories

Path Synopsis
cmd
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL