Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prerequisites

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prerequisites

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Prerequisites Gem

A ruby gem to make it easy to test that a set of prerequisite conditions are in place.

This can be useful when using ruby as 'glue' code for sysadmin or other tasks.

Installation

gem install prerequisites

Or add to your Gemfile:

gem "prerequisites"

Usage

This example checks that:

  • Environment variables "FOO" and "BAR" are set
  • Environment variable "BAZ" is set to the value "whatever"
  • Executables "grep", "git", and "kubectl" are in your $PATH
  • The shell commands execute successfully

NB: You should ensure that any commands you list in the shell_commands section have no side-effects. These are supposed to be pre-flight checks.

config = {
  environment_variables: [
    "FOO",
    "BAR",
    { "BAZ" => "whatever" }
  ],
  executables_in_path: [
    "grep",
    "git",
    "kubectl"
  ],
  shell_commands: [
    "echo whatever | grep what",
    "kubectl config current-context | grep myk8scluster"
  ]
}

Prerequisites.new(config).check

If any of these conditions are not met, the code will raise an error of class:

  • Prerequisites::EnvironmentVariableError
  • Prerequisites::ExecutableError
  • Prerequisites::ShellCommandError

...depending on the problem.

FAQs

Package last updated on 31 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc