Class: AlpacaBuildTool::Wrapper

Inherits:
Tool
  • Object
show all
Defined in:
lib/alpacabuildtool/tools/wrapper.rb

Overview

Wrapper represents console tools that execute other console tools inside their own process (like OpenCover, Ssh…)

Direct Known Subclasses

OpenCover

Instance Attribute Summary

Attributes included from Log

#log

Instance Method Summary collapse

Constructor Details

#initialize(configuration, tool) ⇒ Wrapper

Creates an instance Overrides Tool initialization by adding tool that should be executed later

configuration

wrapper tool configuration

tool

tool to be used inside wrapper tool



14
15
16
17
18
# File 'lib/alpacabuildtool/tools/wrapper.rb', line 14

def initialize(configuration, tool)
  super(configuration)
  @tool = tool.dup
  wrap_tool
end

Instance Method Details

#call(args) {|@tool| ... } ⇒ Object

Execute wrapper tool with arguments

args

wrapper tool arguments

requires &block to be executed against inner tool

wrapper.call([debug: true]) do |tool|
   tool.call(['file.cs', {c: true, type: 'test'}])
end
# >> wrapper.exe /target:'tool.exe' /targetargs:'file.cs /c /type:test'
# /debug

Yields:

  • (@tool)


31
32
33
34
35
36
# File 'lib/alpacabuildtool/tools/wrapper.rb', line 31

def call(args)
  yield @tool
  @target = encapsulate(@tool.exe)
  @target_args = encapsulate(@tool.arguments)
  super(args)
end