Sha256: e2b620f75d11c8cf920a65cfdacd4b1a085afe4301cd9bebab166d7f4cf9d959

Contents?: true

Size: 1.48 KB

Versions: 14

Compression:

Stored size: 1.48 KB

Contents

module Methadone
  module ExecutionStrategy
    # Base for any ExecutionStrategy implementation.  Currently, this is nothing more than an interface
    # specification.
    class Base
      # Executes the command and returns the results back.  This
      # should do no logging or other logic other than to execute the
      # command and return the required results.  If command is an
      # array, use exec directly bypassing any tokenization, shell or
      # otherwise; otherwise use the normal shell interpretation of
      # the command string.
      #
      # command:: the command-line to run, as an Array or a String
      #
      # Returns an array of size 3:
      # <tt>[0]</tt>:: The standard output of the command as a String, never nil
      # <tt>[1]</tt>:: The standard error output of the command as a String, never nil
      # <tt>[2]</tt>:: A Process::Status-like objects that responds to <tt>exitstatus</tt> which returns
      #                the exit code of the command (e.g. 0 for success).
      def run_command(command)
        subclass_must_impelment!
      end

      # Returns the class that, if caught by calling #run_command, represents the underlying command
      # not existing.  For example, in MRI Ruby, if you try to execute a non-existent command,
      # you get a Errno::ENOENT.
      def exception_meaning_command_not_found
        subclass_must_impelment!
      end
    protected
      def subclass_must_impelment!; raise "subclass must implement"; end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
methadone-1.6.0 lib/methadone/execution_strategy/base.rb
methadone-1.5.1 lib/methadone/execution_strategy/base.rb
methadone-1.5.0 lib/methadone/execution_strategy/base.rb
methadone-1.4.0 lib/methadone/execution_strategy/base.rb
methadone-1.3.2 lib/methadone/execution_strategy/base.rb
methadone-1.3.1 lib/methadone/execution_strategy/base.rb
methadone-1.3.0 lib/methadone/execution_strategy/base.rb
methadone-1.2.6 lib/methadone/execution_strategy/base.rb
methadone-1.2.5 lib/methadone/execution_strategy/base.rb
methadone-1.2.4 lib/methadone/execution_strategy/base.rb
methadone-1.2.3 lib/methadone/execution_strategy/base.rb
methadone-1.2.2 lib/methadone/execution_strategy/base.rb
methadone-1.2.1 lib/methadone/execution_strategy/base.rb
methadone-1.2.0 lib/methadone/execution_strategy/base.rb