Sha256: d5cdcbe87876b95000646a2cbe4d45a3750136f94d4b38c2fd1215c7707eb171

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

Stored size: 687 Bytes

Contents

module Tap
  module Declarations
    class Context
      include Declarations
      include Tap::Utils
      
      attr_reader :app
      
      def initialize(app, ns=nil)
        @app = app
        initialize_declare
        namespace(ns)
      end
      
      # Runs the command with system and raises an error if the command
      # fails.
      def sh(*cmd)
        app.log :sh, cmd.join(' ')
        system(*cmd) or raise "Command failed with status (#{$?.exitstatus}): [#{cmd.join(' ')}]"
      end
      
      def node(num)
        app.get(num.to_s)
      end
      
      def method_missing(sym, *args, &block)
        app.send(sym, *args, &block)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tap-1.4.0 lib/tap/declarations/context.rb
tap-1.3.0 lib/tap/declarations/context.rb