Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit 9850c7d

Browse files
authored
Merge pull request #110 from boxen/high-sierra
Don't manage `/usr/local`
2 parents ea3f0ca + f49554f commit 9850c7d

File tree

8 files changed

+38
-58
lines changed

8 files changed

+38
-58
lines changed

files/brew-boxen-install.rb

Lines changed: 0 additions & 4 deletions
This file was deleted.

files/brew-boxen-latest.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/puppet/provider/package/homebrew.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def install
8080
if install_options.any?
8181
execute [ "brew", "install", @resource[:name], *install_options ].flatten, command_opts
8282
else
83-
execute [ "brew", "boxen-install", @resource[:name] ], command_opts
83+
execute [ "brew", "install", @resource[:name] ].flatten, command_opts
8484
end
8585
end
8686
end
@@ -106,7 +106,7 @@ def install_options
106106
end
107107

108108
def latest
109-
execute([ "brew", "boxen-latest", @resource[:name] ], command_opts).strip
109+
execute([ "brew", "ls", "--versions", @resource[:name] ], command_opts.merge({ :failonfail => false })).split.last
110110
end
111111

112112
def query

manifests/config.pp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
class homebrew::config {
88
include boxen::config
99

10-
$cachedir = "${boxen::config::cachedir}/homebrew"
11-
$installdir = $::homebrew_root
12-
$libdir = "${installdir}/lib"
10+
$cachedir = "${boxen::config::cachedir}/homebrew"
11+
$installdir = $::homebrew_root
12+
$repositorydir = "${installdir}/Homebrew"
13+
$libdir = "${installdir}/lib"
1314

14-
$cmddir = "${installdir}/Library/Homebrew/cmd"
15-
$tapsdir = "${installdir}/Library/Taps"
15+
$cmddir = "${repositorydir}/Library/Homebrew/cmd"
16+
$tapsdir = "${repositorydir}/Library/Taps"
1617

17-
$brewsdir = "${tapsdir}/boxen/homebrew-brews"
18+
$brewsdir = "${tapsdir}/boxen/homebrew-brews"
1819

19-
$min_revision = 'd5b6ecfc5078041ddf5f61b259c57f81d5c50fcc'
20+
$min_revision = 'd5b6ecfc5078041ddf5f61b259c57f81d5c50fcc'
2021
}

manifests/init.pp

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
# include homebrew
66

77
class homebrew(
8-
$cachedir = $homebrew::config::cachedir,
9-
$installdir = $homebrew::config::installdir,
10-
$libdir = $homebrew::config::libdir,
11-
$cmddir = $homebrew::config::cmddir,
12-
$tapsdir = $homebrew::config::tapsdir,
13-
$brewsdir = $homebrew::config::brewsdir,
14-
$min_revision = $homebrew::config::min_revision,
15-
$repo = 'Homebrew/brew',
16-
$set_cflags = true,
17-
$set_ldflags = true,
8+
$cachedir = $homebrew::config::cachedir,
9+
$installdir = $homebrew::config::installdir,
10+
$repositorydir = $homebrew::config::repositorydir,
11+
$libdir = $homebrew::config::libdir,
12+
$cmddir = $homebrew::config::cmddir,
13+
$tapsdir = $homebrew::config::tapsdir,
14+
$brewsdir = $homebrew::config::brewsdir,
15+
$min_revision = $homebrew::config::min_revision,
16+
$repo = 'Homebrew/brew',
17+
$set_cflags = true,
18+
$set_ldflags = true,
1819
) inherits homebrew::config {
1920
include boxen::config
2021
include homebrew::repo
2122

22-
file { [$installdir,
23-
"${installdir}/bin",
23+
file { ["${installdir}/bin",
2424
"${installdir}/etc",
2525
"${installdir}/include",
2626
"${installdir}/lib",
@@ -43,29 +43,29 @@
4343
"${installdir}/share/aclocal",
4444
"${installdir}/var",
4545
"${installdir}/var/log",
46+
$repositorydir,
4647
]:
4748
ensure => 'directory',
4849
owner => $::boxen_user,
4950
group => 'staff',
5051
mode => '0755',
5152
require => undef,
52-
before => Exec["install homebrew to ${installdir}"],
53+
before => Exec["install homebrew to ${repositorydir}"],
5354
}
5455

55-
exec { "install homebrew to ${installdir}":
56+
exec { "install homebrew to ${repositorydir}":
5657
command => "git init -q &&
5758
git config remote.origin.url https://github.com/${repo} &&
5859
git config remote.origin.fetch master:refs/remotes/origin/master &&
5960
git fetch origin master:refs/remotes/origin/master -n &&
6061
git reset --hard origin/master",
61-
cwd => $installdir,
62+
cwd => $repositorydir,
6263
user => $::boxen_user,
63-
creates => "${installdir}/.git",
64-
require => File[$installdir],
64+
creates => "${repositorydir}/.git",
6565
}
6666

6767
File {
68-
require => Exec["install homebrew to ${installdir}"],
68+
require => Exec["install homebrew to ${repositorydir}"],
6969
}
7070

7171
# Remove the old monkey patches, from pre #39
@@ -94,12 +94,7 @@
9494
$brewsdir,
9595
"${brewsdir}/cmd"
9696
]:
97-
ensure => 'directory' ;
98-
99-
"${brewsdir}/cmd/brew-boxen-latest.rb":
100-
source => 'puppet:///modules/homebrew/brew-boxen-latest.rb' ;
101-
"${brewsdir}/cmd/brew-boxen-install.rb":
102-
source => 'puppet:///modules/homebrew/brew-boxen-install.rb' ;
97+
ensure => 'directory';
10398
}
10499

105100
->

manifests/repo.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
#
55
# include homebrew::repo
66
class homebrew::repo (
7-
$installdir = $homebrew::config::installdir,
8-
$min_revision = $homebrew::config::min_revision,
7+
$repositorydir = $homebrew::config::repositorydir,
8+
$min_revision = $homebrew::config::min_revision,
99
) {
1010
require homebrew
1111

1212
if $::osfamily == 'Darwin' {
13-
homebrew_repo { $installdir:
13+
homebrew_repo { $repositorydir:
1414
min_revision => $min_revision,
1515
} -> Package <| |>
1616
}

spec/classes/homebrew_spec.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
let(:facts) { default_test_facts }
55

66
let(:dir) { facts[:homebrew_root] }
7-
let(:cmddir) { "#{dir}/Library/Taps/boxen/homebrew-brews/cmd" }
7+
let(:cmddir) { "#{dir}/Homebrew/Library/Taps/boxen/homebrew-brews/cmd" }
88

99
it do
10-
should contain_exec("install homebrew to #{dir}").with({
11-
:cwd => dir,
10+
should contain_exec("install homebrew to #{dir}/Homebrew").with({
11+
:cwd => "#{dir}/Homebrew",
1212
:user => 'testuser',
13-
:creates => "#{dir}/.git"
13+
:creates => "#{dir}/Homebrew/.git"
1414
})
1515

1616
["ldflags.sh", "cflags.sh", "homebrew.sh"].each do |f|
@@ -20,14 +20,9 @@
2020

2121
should contain_boxen__env_script("homebrew")
2222

23-
["latest", "install"].each do |cmd|
24-
should contain_file("#{cmddir}/brew-boxen-#{cmd}.rb").
25-
with_source("puppet:///modules/homebrew/brew-boxen-#{cmd}.rb")
26-
end
27-
2823
should contain_file("#{dir}/lib").with_ensure("directory")
2924
should contain_file(cmddir).with_ensure("directory")
30-
should contain_file("#{dir}/Library/Taps").with_ensure("directory")
25+
should contain_file("#{dir}/Homebrew/Library/Taps").with_ensure("directory")
3126
should contain_file("/test/boxen/cache/homebrew").with_ensure("directory")
3227
end
3328
end

spec/defines/homebrew__formula_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
let(:facts) { default_test_facts }
55
let(:title) { "clojure" }
66

7-
let(:tapdir) { "#{facts[:homebrew_root]}/Library/Taps/boxen/homebrew-brews" }
7+
let(:tapdir) { "#{facts[:homebrew_root]}/Homebrew/Library/Taps/boxen/homebrew-brews" }
88

99
context "with source provided" do
1010
let(:params) do

0 commit comments

Comments
 (0)