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

Commit 504759e

Browse files
committed
Merge pull request #72 from boxen/homebrew-approved-installation
Stepwise homebrew installation
2 parents fb0d535 + c77bec5 commit 504759e

File tree

3 files changed

+51
-9
lines changed

3 files changed

+51
-9
lines changed

files/boxen-bottle-hooks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def self.file(formula)
1515
def self.url(formula)
1616
os = MacOS.version
1717
file = self.file(formula)
18-
path = "/#{os}/#{file}"
18+
path = "#{Base64.strict_encode64(HOMEBREW_CELLAR)}/#{os}/#{file}"
1919

2020
if ENV['BOXEN_HOMEBREW_BOTTLE_URL']
2121
ENV['BOXEN_HOMEBREW_BOTTLE_URL'] + path

manifests/init.pp

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,60 @@
1212
$tapsdir = $homebrew::config::tapsdir,
1313
$brewsdir = $homebrew::config::brewsdir,
1414
$min_revision = $homebrew::config::min_revision,
15+
$repo = 'Homebrew/homebrew',
1516
$set_cflags = true,
1617
$set_ldflags = true,
1718
) inherits homebrew::config {
1819
include boxen::config
1920
include homebrew::repo
2021

21-
repository { $installdir:
22-
source => 'Homebrew/homebrew',
23-
user => $::boxen_user
22+
file { [$installdir,
23+
"${installdir}/bin",
24+
"${installdir}/etc",
25+
"${installdir}/include",
26+
"${installdir}/lib",
27+
"${installdir}/lib/pkgconfig",
28+
"${installdir}/Library",
29+
"${installdir}/sbin",
30+
"${installdir}/share",
31+
"${installdir}/share/locale",
32+
"${installdir}/share/man",
33+
"${installdir}/share/man/man1",
34+
"${installdir}/share/man/man2",
35+
"${installdir}/share/man/man3",
36+
"${installdir}/share/man/man4",
37+
"${installdir}/share/man/man5",
38+
"${installdir}/share/man/man6",
39+
"${installdir}/share/man/man7",
40+
"${installdir}/share/man/man8",
41+
"${installdir}/share/info",
42+
"${installdir}/share/doc",
43+
"${installdir}/share/aclocal",
44+
"${installdir}/var",
45+
"${installdir}/var/log",
46+
]:
47+
ensure => 'directory',
48+
owner => $::boxen_user,
49+
group => 'admin',
50+
mode => '0755',
51+
require => undef,
52+
before => Exec["install homebrew to ${installdir}"],
53+
}
54+
55+
exec { "install homebrew to ${installdir}":
56+
command => "git init -q &&
57+
git config remote.origin.url https://github.com/${repo} &&
58+
git config remote.origin.fetch master:refs/remotes/origin/master &&
59+
git fetch origin master:refs/remotes/origin/master -n &&
60+
git reset --hard origin/master",
61+
cwd => $installdir,
62+
user => $::boxen_user,
63+
creates => "${installdir}/.git",
64+
require => File[$installdir],
2465
}
2566

2667
File {
27-
require => Repository[$installdir]
68+
require => Exec["install homebrew to ${installdir}"],
2869
}
2970

3071
# Remove the old monkey patches, from pre #39
@@ -34,7 +75,7 @@
3475
}
3576

3677
file {
37-
[$cachedir, $tapsdir, $cmddir, $libdir]:
78+
[$cachedir, $tapsdir, $cmddir]:
3879
ensure => 'directory' ;
3980

4081
# shim for bottle hooks

spec/classes/homebrew_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
let(:cmddir) { "#{dir}/Library/Homebrew/cmd" }
88

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

1516
["ldflags.sh", "cflags.sh", "homebrew.sh"].each do |f|

0 commit comments

Comments
 (0)