Sha256: 5aaa33a9125974fca191850ea94a8e0df222f3ac683789dde3c872cfb7a8c983
Contents?: true
Size: 851 Bytes
Versions: 5
Compression:
Stored size: 851 Bytes
Contents
# frozen_string_literal: true module Jive class Shell COMMAND_MAP = { cd: "/usr/bin/cd", echo: "/usr/bin/echo", git: "/usr/bin/git", mkdir: "/bin/mkdir" }.freeze def run_each(tasks) tasks.each do |task| break unless execute(task) end end def execute(command, env: {}) system(env, expand(command)) end def after_run(tasks) finalizer_fd = 42 pipe = IO.new(finalizer_fd) pipe.puts(tasks.map { |x| x.join(":") }.join("\n")) rescue Errno::EBADF => e puts e exit 1 end def expand(command) Array(command) .flatten .map { |x| COMMAND_MAP.fetch(x, x).to_s } .join(" ") end def run_safely yield rescue StandardError => e puts e after_run([%w[noop noop]]) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
jive-0.7.0 | lib/jive/shell.rb |
jive-0.6.0 | lib/jive/shell.rb |
jive-0.5.0 | lib/jive/shell.rb |
jive-0.4.4 | lib/jive/shell.rb |
jive-0.4.3 | lib/jive/shell.rb |