Files

Class/Module Index [+]

Quicksearch

Chef::Provider::Package::Freebsd::PortsHelper

Public Instance Methods

makefile_variable_value(variable, dir = nil) click to toggle source
# File lib/chef/provider/package/freebsd/base.rb, line 59
def makefile_variable_value(variable, dir = nil)
  options = dir ? { :cwd => dir } : {}
  make_v = shell_out!("make -V #{variable}", options.merge!(:env => nil, :returns => [0,1]))
  make_v.exitstatus.zero? ? make_v.stdout.strip.split($\).first : nil   # $\ is the line separator, i.e. newline.
end
port_dir(port) click to toggle source
# File lib/chef/provider/package/freebsd/base.rb, line 37
def port_dir(port)
  case port

  # When the package name starts with a '/' treat it as the full path to the ports directory.
  when /^\//
    port

  # Otherwise if the package name contains a '/' not at the start (like 'www/wordpress') treat
  # as a relative path from /usr/ports.
  when /\//
    "/usr/ports/#{port}"

  # Otherwise look up the path to the ports directory using 'whereis'
  else
    whereis = shell_out!("whereis -s #{port}", :env => nil)
    unless _path = whereis.stdout[/^#{Regexp.escape(port)}:\s+(.+)$/, 1]
      raise Chef::Exceptions::Package, "Could not find port with the name #{port}"
    end
    _path
  end
end
supports_ports?() click to toggle source
# File lib/chef/provider/package/freebsd/base.rb, line 33
def supports_ports?
  ::File.exist?("/usr/ports/Makefile")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.