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

Commit

Permalink
Merge pull request #72 from boxen/homebrew-approved-installation
Browse files Browse the repository at this point in the history
Stepwise homebrew installation
  • Loading branch information
dgoodlad committed Dec 11, 2014
2 parents fb0d535 + c77bec5 commit 504759e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
2 changes: 1 addition & 1 deletion files/boxen-bottle-hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.file(formula)
def self.url(formula)
os = MacOS.version
file = self.file(formula)
path = "/#{os}/#{file}"
path = "#{Base64.strict_encode64(HOMEBREW_CELLAR)}/#{os}/#{file}"

if ENV['BOXEN_HOMEBREW_BOTTLE_URL']
ENV['BOXEN_HOMEBREW_BOTTLE_URL'] + path
Expand Down
51 changes: 46 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,60 @@
$tapsdir = $homebrew::config::tapsdir,
$brewsdir = $homebrew::config::brewsdir,
$min_revision = $homebrew::config::min_revision,
$repo = 'Homebrew/homebrew',
$set_cflags = true,
$set_ldflags = true,
) inherits homebrew::config {
include boxen::config
include homebrew::repo

repository { $installdir:
source => 'Homebrew/homebrew',
user => $::boxen_user
file { [$installdir,
"${installdir}/bin",
"${installdir}/etc",
"${installdir}/include",
"${installdir}/lib",
"${installdir}/lib/pkgconfig",
"${installdir}/Library",
"${installdir}/sbin",
"${installdir}/share",
"${installdir}/share/locale",
"${installdir}/share/man",
"${installdir}/share/man/man1",
"${installdir}/share/man/man2",
"${installdir}/share/man/man3",
"${installdir}/share/man/man4",
"${installdir}/share/man/man5",
"${installdir}/share/man/man6",
"${installdir}/share/man/man7",
"${installdir}/share/man/man8",
"${installdir}/share/info",
"${installdir}/share/doc",
"${installdir}/share/aclocal",
"${installdir}/var",
"${installdir}/var/log",
]:
ensure => 'directory',
owner => $::boxen_user,
group => 'admin',
mode => '0755',
require => undef,
before => Exec["install homebrew to ${installdir}"],
}

exec { "install homebrew to ${installdir}":
command => "git init -q &&
git config remote.origin.url https://github.com/${repo} &&
git config remote.origin.fetch master:refs/remotes/origin/master &&
git fetch origin master:refs/remotes/origin/master -n &&
git reset --hard origin/master",
cwd => $installdir,
user => $::boxen_user,
creates => "${installdir}/.git",
require => File[$installdir],
}

File {
require => Repository[$installdir]
require => Exec["install homebrew to ${installdir}"],
}

# Remove the old monkey patches, from pre #39
Expand All @@ -34,7 +75,7 @@
}

file {
[$cachedir, $tapsdir, $cmddir, $libdir]:
[$cachedir, $tapsdir, $cmddir]:
ensure => 'directory' ;

# shim for bottle hooks
Expand Down
7 changes: 4 additions & 3 deletions spec/classes/homebrew_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
let(:cmddir) { "#{dir}/Library/Homebrew/cmd" }

it do
should contain_repository(dir).with({
:source => "Homebrew/homebrew",
:user => "testuser"
should contain_exec("install homebrew to #{dir}").with({
:cwd => dir,
:user => 'testuser',
:creates => "#{dir}/.git"
})

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

0 comments on commit 504759e

Please sign in to comment.