Sha256: 8b48c7324a491e3f2290807b3d7114a9bfb2c175e8e81a640ac156b32fd9ccc0

Contents?: true

Size: 829 Bytes

Versions: 8

Compression:

Stored size: 829 Bytes

Contents

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

  def validates_not_empty(attribute, message=nil)
    raise 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

8 entries across 8 versions & 1 rubygems

Version Path
depengine-3.0.20 lib/depengine/helper/validations.rb
depengine-3.0.19 lib/depengine/helper/validations.rb
depengine-3.0.18 lib/depengine/helper/validations.rb
depengine-3.0.17 lib/depengine/helper/validations.rb
depengine-3.0.16 lib/depengine/helper/validations.rb
depengine-3.0.15 lib/depengine/helper/validations.rb
depengine-3.0.14 lib/depengine/helper/validations.rb
depengine-3.0.13 lib/depengine/helper/validations.rb