Skip to content

Commit

Permalink
#39 - Implement attribute to control auto-update
Browse files Browse the repository at this point in the history
Signed-off-by: Sean OMeara <[email protected]>
  • Loading branch information
jtimberman authored and Sean OMeara committed Jun 26, 2014
1 parent 2b58087 commit 23d9e14
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The only platform supported by Homebrew itself at the time of this writing is Ma
Attributes
----------
- `node['homebrew']['owner']` - The user that will own the Homebrew installation and packages. Setting this will override the default behavior which is to use the non-privileged user that has invoked the Chef run (or the `SUDO_USER` if invoked with sudo). The default is `nil`.

- `node['homebrew']['auto-update']` - Whether the default recipe should automatically update homebrew each run or not. The default is `true` to maintain compatibility. Set to false or nil to disable. Note that disabling this feature may cause formula to not work.

Resources and Providers
-----------------------
Expand Down
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
#

default['homebrew']['owner'] = nil
default['homebrew']['auto-update'] = true
14 changes: 8 additions & 6 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@
not_if { ::File.exist? '/usr/local/bin/brew' }
end

package 'git' do
not_if 'which git'
end
if node['homebrew']['auto-update']
package 'git' do
not_if 'which git'
end

execute 'update homebrew from github' do
user owner
command '/usr/local/bin/brew update || true'
execute 'update homebrew from github' do
user owner
command '/usr/local/bin/brew update || true'
end
end

0 comments on commit 23d9e14

Please sign in to comment.