Sha256: 72f6c1e37ebd5a1aa604035f3dbc6dc1325be7fac12d0d344ab98504b27de4ee

Contents?: true

Size: 819 Bytes

Versions: 214

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/object/blank'
require 'shellwords'

module EacRubyUtils
  module Envs
    class Command
      module ExtraOptions
        def chdir(dir)
          duplicate_by_extra_options(chdir: dir)
        end

        def status_result(status_code, result)
          duplicate_by_extra_options(status_results: status_results.merge(status_code => result))
        end

        private

        attr_reader :extra_options

        def status_results
          extra_options[:status_results] ||= {}.with_indifferent_access
        end

        def append_chdir(command)
          extra_options[:chdir].present? ? "(cd '#{extra_options[:chdir]}' ; #{command} )" : command
        end
      end
    end
  end
end

Version data entries

214 entries across 214 versions & 4 rubygems

Version Path
eac_ruby_utils-0.108.0 lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.47.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.46.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.45.2 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.45.1 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.45.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_ruby_utils-0.107.1 lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.44.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.43.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_ruby_utils-0.107.0 lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.42.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.41.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.40.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.39.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_ruby_utils-0.106.1 lib/eac_ruby_utils/envs/command/extra_options.rb
eac_ruby_utils-0.106.0 lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.38.0 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.37.2 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
eac_ruby_utils-0.105.0 lib/eac_ruby_utils/envs/command/extra_options.rb
eac_tools-0.37.1 sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb