Sha256: f068cca1ebe36fa9879b5828d4172f694ca1582d48cabc41a037385e2d80d1d3
Contents?: true
Size: 954 Bytes
Versions: 3
Compression:
Stored size: 954 Bytes
Contents
# frozen_string_literal: true module ConvenientService module Examples module Rails module Gemfile module Services class RunShell include RailsService::Config attribute :command, :string attribute :debug, :boolean, default: false validates :command, presence: true def result Services::PrintShellCommand.result(text: command) if debug ## # NOTE: When the command exit code is 0, `system` return true, and false otherwise. # - https://ruby-doc.org/core-3.1.2/Kernel.html#method-i-system # - https://stackoverflow.com/a/37329716/12201472 # if system(command) success else error(message: "#{command} returned non-zero exit code") end end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems