Sha256: 38c7a3f9e19fbcde0560835784fa9bc826fdf2c55faa7c878c4b1cd52eca29dc
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
# frozen_string_literal: true ## # Usage example: # # ConvenientService::Examples::Rails::Gemfile::Services::PrintShellCommand.result(text: "ls -a") # module ConvenientService module Examples module Rails class Gemfile module Services class PrintShellCommand include RailsService::Config attribute :command, :string attribute :skip, :boolean, default: false attribute :out, default: $stdout validates :command, presence: true if ConvenientService::Dependencies.support_has_j_send_result_params_validations_using_active_model_validations? def result return error("Printing of shell command `#{command}` is skipped") if skip out.puts out.puts ::Paint["$ #{command}", :blue, :bold] success end def fallback_result success end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
convenient_service-0.13.0 | lib/convenient_service/examples/rails/gemfile/services/print_shell_command.rb |