Module: FailFast::IsOnPath

Defined in:
lib/fail_fast/extensions/is_on_path.rb

Instance Method Summary collapse

Instance Method Details

#is_on_path(app, options = {}) ⇒ Object

Ensure the application is on the path

Usage

is_on_path 'jruby'
is_on_path 'jruby', :message => 'custom message'


10
11
12
13
14
15
16
# File 'lib/fail_fast/extensions/is_on_path.rb', line 10

def is_on_path(app, options = {})
  success = found_on_the_path(app)
  unless success
    add_error ErrorDetails.new(nil, :not_on_path, app, options[:message])
  end
  success
end

#is_on_path_for(key, options = {}) ⇒ Object

Ensure the key value can be found on the path

Usage

is_on_path_for 'file_compressor'
is_on_path_for 'file_compressor', :message => 'custom message'


24
25
26
27
28
29
30
31
32
33
# File 'lib/fail_fast/extensions/is_on_path.rb', line 24

def is_on_path_for(key, options = {})
  return false unless has_value_for key, :message =>  options[:message]
  app   = value_for_deep_key(key)

  success = found_on_the_path(app)
  unless success
    add_error ErrorDetails.new(key, :not_on_path, app, options[:message])
  end
  success
end