🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

producer-core

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

producer-core

bundlerRubygems
Version
0.6.2
Version published
Maintainers
1
Created
Source

producer

producer-core is a software configuration management tool providing a DSL to describe infrastructure as code. It helps automating software deployment, configuration and management.

Getting started

Installation (requires ruby and rubygems)

gem install producer-core

Shell command execution on remote host

The sh action will execute a shell command on the targeted remote host. The remote host can be specified with the CLI option -t.

task :show_zsh_pkg do
  sh 'pkg info | grep zsh'
end
% producer -t localhost show_zsh_pkg.rb
zsh-5.0.7                      The Z shell

When execution fails, recipe processing is stopped and the action which triggered the failed execution is the last one to be applied.

task :sh_fail do
  sh 'false'
  echo 'end of recipe'
end
% producer -t localhost sh_fail.rb
RemoteCommandExecutionError: false
%

Only the first action is applied.

Task conditions

A task can be bound to a condition: when the condition fails actions are skipped, otherwise actions are applied as usual.

task :condition_pass do
  condition { true }
  echo 'will output'
end

task :condition_fail do
  condition { false }
  echo 'will NOT output'
end

Built-in tests

Specific test keywords are also available in the condition block context, producer-core ships with a few common tests, producer-stdlib provides more, and custom tests can be defined.

task :condition_sh_pass do
  condition { sh 'true' }
  echo 'will output'
end

task :condition_sh_fail do
  condition { sh 'false' }
  cho 'will NOT output'
end

Nested tasks

Complex tasks can be split into nested subtasks. Conditions have the same effect on tasks they have on actions, when the condition fails, subtasks of the current task are skipped.

task :main_task do
  condition { true }
  task(:foo_subtask) { echo 'do foo' }
  task(:bar_subtask) { echo 'do bar' }
  task(:baz_subtask) do
    condition { false }
    task(:baz_subtask_subtask) { echo 'do baz' }
  end
end
% producer nested_tasks.rb
do foo
do bar

Ruby DSL

  • https://github.com/sprinkle-tool/sprinkle
  • http://www.capistranorb.com/
  • http://babushka.me/ (with BDD features, no network support?)

Ruby DSL, shell script transpilation

Ruby-like DSL

Agents, daemons

SSH

BDD

FAQs

Package last updated on 06 Jul 2022

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