Sha256: 0db68bdf437c6d68ee234be525fa10939014c236a3c8d865d46be2c7b327eeb7

Contents?: true

Size: 831 Bytes

Versions: 3

Compression:

Stored size: 831 Bytes

Contents

module Helper
  def validates_presence_of(attribute, message = nil)
    fail ArgumentError, message || 'Missing parameter', caller \
       if attribute.nil?
  end
  module_function :validates_presence_of

  def validates_not_empty(attribute, message = nil)
    fail ArgumentError, message || 'Parameter is empty', caller \
       if attribute.nil?
  end
  module_function :validates_not_empty

  def path_in_deploy_home(path)
    absolute_path?(path) ? path : File.join($recipe_config[:deploy_home] || '', path)
  end
  module_function :path_in_deploy_home

  def path_in_recipe_base_dir(path)
    absolute_path?(path) ? path : File.join($recipe_config[:recipe_base_dir] || '', path)
  end
  module_function :path_in_recipe_base_dir

  def absolute_path?(path)
    path.start_with? '/'
  end
  module_function :absolute_path?
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
depengine-3.0.23 lib/depengine/helper/validations.rb
depengine-3.0.22 lib/depengine/helper/validations.rb
depengine-3.0.21 lib/depengine/helper/validations.rb