class Chef::Resource::HomebrewUpdate

Constants

BREW_STAMP
BREW_STAMP_DIR

Public Instance Methods

brew_up_to_date?() click to toggle source

Determines whether we need to run `homebrew update`

@return [Boolean]

# File lib/chef/resource/homebrew_update.rb, line 67
def brew_up_to_date?
  ::File.exist?(BREW_STAMP) &&
    ::File.mtime(BREW_STAMP) > Time.now - new_resource.frequency
end
do_update() click to toggle source
# File lib/chef/resource/homebrew_update.rb, line 72
def do_update
  directory BREW_STAMP_DIR do
    recursive true
  end

  file BREW_STAMP do
    content "BREW::Update::Post-Invoke-Success\n"
    action :create_if_missing
  end

  execute "brew update" do
    command %w{brew update}
    default_env true
    user find_homebrew_uid
    notifies :touch, "file[#{BREW_STAMP}]", :immediately
  end
end