Skip to content
This repository has been archived by the owner on May 22, 2018. It is now read-only.

Commit

Permalink
Merge pull request #855 from boxen/nuke-etc-boxen
Browse files Browse the repository at this point in the history
Support moving all Homebrew configurations to `$HOMEBREW_ROOT/etc/boxen`
  • Loading branch information
jacobbednarz committed Oct 16, 2017
2 parents d2accf9 + 1c04307 commit 6ab8bb3
Show file tree
Hide file tree
Showing 41 changed files with 165 additions and 55 deletions.
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
os:
- osx
script:
- rm -rf /usr/local/Homebrew
- travis_wait 60 rvm implode --force
- travis_wait 60 ./script/boxen --no-fde --no-pull --profile --login $BOXEN_GITHUB_LOGIN --token $BOXEN_GITHUB_TOKEN || test $? -eq 2
- ./script/boxen --no-fde --stealth --no-pull --debug --profile --login $BOXEN_GITHUB_LOGIN --token $BOXEN_GITHUB_TOKEN || test $? -eq 2
- source /opt/boxen/env.sh
- rake spec
- bundle exec rspec spec
before_install:
- sudo gem install bundler -v '~> 1.13'
env:
global:
secure: HoCPuAgujmw+tdH7qq9bSymtpE8o4gpp1uYRyFin2TB3px2JdOPCPCb754vddmE12zhhKKSy1j0Uj/qeW6tjy9hIhlAjLAGFuT+mNTURqu4nmojCgKO2ApcRWc3yv319XR2vjUDW1qmEyKm7il4q1c/dOFmGbVYeDixjUUfWVII=
- HOMEBREW_NO_AUTO_UPDATE=1
- HOMEBREW_VERBOSE=1
- secure: HoCPuAgujmw+tdH7qq9bSymtpE8o4gpp1uYRyFin2TB3px2JdOPCPCb754vddmE12zhhKKSy1j0Uj/qeW6tjy9hIhlAjLAGFuT+mNTURqu4nmojCgKO2ApcRWc3yv319XR2vjUDW1qmEyKm7il4q1c/dOFmGbVYeDixjUUfWVII=
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ source "https://rubygems.org"

gem "boxen", "~> 2.9.0"
gem "hiera", "~> 1.3.3"
gem "librarian-puppet", "~> 1.0.9"
gem "librarian-puppet"
gem "puppet", "3.7.1"
gem "librarianp",
git: "https://github.com/voxpupuli/librarian.git",
branch: "librarianp"
gem "puppet-lint", "0.3.2"
gem "puppetlabs_spec_helper", "0.4.1"
gem "open4", "~> 1.3.4"
Expand Down
15 changes: 12 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
GIT
remote: https://github.com/voxpupuli/librarian.git
revision: 4d78d88be2d7673a136e78760085fbf9664ff27d
branch: librarianp
specs:
librarianp (0.6.3)
thor (~> 0.15)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -28,7 +36,7 @@ GEM
highline (1.6.21)
jmespath (1.0.2)
multi_json (~> 1.0)
json (1.8.3)
json (2.1.0)
json_pure (1.8.2)
librarian (0.1.2)
highline
Expand Down Expand Up @@ -91,7 +99,7 @@ GEM
net-ssh (>= 2.7, < 4.0)
net-telnet
sfl
thor (0.19.1)
thor (0.20.0)

PLATFORMS
ruby
Expand All @@ -101,7 +109,8 @@ DEPENDENCIES
boxen (~> 2.9.0)
deep_merge (~> 1.0)
hiera (~> 1.3.3)
librarian-puppet (~> 1.0.9)
librarian-puppet
librarianp!
net-ssh
open4 (~> 1.3.4)
puppet (= 3.7.1)
Expand Down
12 changes: 6 additions & 6 deletions Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ end
# Includes many of our custom types and providers, as well as global
# config. Required.

github "boxen", "3.12.0"
github "boxen", "3.13.0"

# Support for default hiera data in modules

Expand All @@ -39,21 +39,21 @@ github "module_data", "0.0.4", :repo => "ripienaar/puppet-module-data"
# some/most of these if you want, but it's not recommended.

github "brewcask", "0.0.10"
github "dnsmasq", "2.0.3"
github "dnsmasq", "2.0.4"
github "foreman", "1.2.0"
github "gcc", "3.0.2"
# mod "gcc", "0.0.1", :git => "https://github.com/boxen/puppet-gcc.git", :ref => "abc7639"
github "git", "2.13.0"
github "go", "2.1.0"
github "homebrew", "2.1.0"
github "hub", "1.4.4"
github "hub", "1.4.5"
github "inifile", "1.4.1", :repo => "puppetlabs/puppetlabs-inifile"
github "nginx", "1.7.0"
github "nginx", "1.9.0"
github "nodejs", "5.0.9"
github "openssl", "1.0.0"
github "phantomjs", "3.0.0"
github "pkgconfig", "1.0.0"
github "repository", "2.4.1"
github "ruby", "8.5.4"
github "ruby", "8.6.0"
github "stdlib", "4.7.0", :repo => "puppetlabs/puppetlabs-stdlib"
github "sudo", "1.0.0"
github "xquartz", "1.2.1"
Expand Down
26 changes: 10 additions & 16 deletions Puppetfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GITHUBTARBALL
remote: boxen/puppet-boxen
specs:
boxen (3.12.0)
boxen (3.13.0)

GITHUBTARBALL
remote: boxen/puppet-brewcask
Expand All @@ -11,18 +11,13 @@ GITHUBTARBALL
GITHUBTARBALL
remote: boxen/puppet-dnsmasq
specs:
dnsmasq (2.0.3)
dnsmasq (2.0.4)

GITHUBTARBALL
remote: boxen/puppet-foreman
specs:
foreman (1.2.0)

GITHUBTARBALL
remote: boxen/puppet-gcc
specs:
gcc (3.0.2)

GITHUBTARBALL
remote: boxen/puppet-git
specs:
Expand All @@ -41,12 +36,12 @@ GITHUBTARBALL
GITHUBTARBALL
remote: boxen/puppet-hub
specs:
hub (1.4.4)
hub (1.4.5)

GITHUBTARBALL
remote: boxen/puppet-nginx
specs:
nginx (1.7.0)
nginx (1.9.0)

GITHUBTARBALL
remote: boxen/puppet-nodejs
Expand Down Expand Up @@ -76,7 +71,7 @@ GITHUBTARBALL
GITHUBTARBALL
remote: boxen/puppet-ruby
specs:
ruby (8.5.4)
ruby (8.6.0)

GITHUBTARBALL
remote: boxen/puppet-sudo
Expand Down Expand Up @@ -104,24 +99,23 @@ GITHUBTARBALL
module_data (0.0.4)

DEPENDENCIES
boxen (= 3.12.0)
boxen (= 3.13.0)
brewcask (= 0.0.10)
dnsmasq (= 2.0.3)
dnsmasq (= 2.0.4)
foreman (= 1.2.0)
gcc (= 3.0.2)
git (= 2.13.0)
go (= 2.1.0)
homebrew (= 2.1.0)
hub (= 1.4.4)
hub (= 1.4.5)
inifile (= 1.4.1)
module_data (= 0.0.4)
nginx (= 1.7.0)
nginx (= 1.9.0)
nodejs (= 5.0.9)
openssl (= 1.0.0)
phantomjs (= 3.0.0)
pkgconfig (= 1.0.0)
repository (= 2.4.1)
ruby (= 8.5.4)
ruby (= 8.6.0)
stdlib (= 4.7.0)
sudo (= 1.0.0)
xquartz (= 1.2.1)
Expand Down
7 changes: 2 additions & 5 deletions manifests/site.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require boxen::environment
require homebrew
require gcc
/* require gcc */

Exec {
group => 'staff',
Expand Down Expand Up @@ -69,10 +69,7 @@
nodejs::version { '0.12': }

# default ruby versions
ruby::version { '1.9.3': }
ruby::version { '2.0.0': }
ruby::version { '2.1.8': }
ruby::version { '2.2.4': }
ruby::version { '2.4.1': }

# common, useful packages
package {
Expand Down
41 changes: 26 additions & 15 deletions script/nuke
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@ unless ENV["USER"] == "root"
exec "sudo", $0, *ARGV
end

all = false
force = false
opt = false
services = false
receipts = false
gitconfig = false
all = false
force = false
opt = false
services = false
receipts = false
gitconfig = false
homebrew_config = false

OptionParser.new do |o|
o.banner = "Remove most traces of Boxen from your machine."
o.banner = "Remove traces of Boxen from your machine."

o.on("--all", "Remove everything possible.") { all = true }
o.on("--force", "Actually do it.") { force = true }
o.on("--help", "Show this help.") { abort o.to_s }
o.on("--opt", "Remove /opt/boxen.") { opt = true }
o.on("--services", "Remove and unload services.") { services = true }
o.on("--receipts", "Remove package receipts used by Puppet.") { receipts = true }
o.on("--gitconfig", "Remove Boxen-provided git credential helper config.") { gitconfig = true }
o.on("--all", "Remove everything possible.") { all = true }
o.on("--force", "Actually do it.") { force = true }
o.on("--help", "Show this help.") { abort o.to_s }
o.on("--opt", "Remove /opt/boxen.") { opt = true }
o.on("--services", "Remove and unload services.") { services = true }
o.on("--receipts", "Remove package receipts used by Puppet.") { receipts = true }
o.on("--gitconfig", "Remove Boxen-provided git credential helper config.") { gitconfig = true }
o.on("--homebrew-config", "Remove Boxen managed Homebrew package configuration files.") { homebrew_config = true }

o.parse!

abort o.to_s unless all || opt || services || receipts || gitconfig
abort o.to_s unless all || opt || services || receipts || gitconfig || homebrew_config
end

unless force
Expand Down Expand Up @@ -64,3 +66,12 @@ if all || gitconfig
warn "-> Removing git credential helper config."
system "/usr/bin/git", "config", "--global", "--unset", "credential.helper"
end

if all || homebrew_config
%w(/opt/boxen/config /usr/local/etc/boxen).each do |homebrew_path|
if File.exist? homebrew_path
warn "-> Removing Boxen managed Homebrew package configuration files from #{homebrew_path}"
system "rm", "-rf", homebrew_path if force
end
end
end
25 changes: 25 additions & 0 deletions spec/localhost/cli_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'spec_helper'

# describe 'script/nuke' do
# describe command('/opt/boxen/repo/script/nuke --help') do
# its(:stdout) { should include '--all' }
# its(:stdout) { should include '--force' }
# its(:stdout) { should include '--opt' }
# its(:stdout) { should include '--services' }
# its(:stdout) { should include '--receipts' }
# its(:stdout) { should include '--gitconfig' }
# its(:stdout) { should include '--homebrew-config' }
# end

# describe '--homebrew-config' do
# it "cleans out $HOMEBREW_ROOT" do
# creation_command_exit_status = command('touch $HOMEBREW_ROOT/etc/boxen/service.config').exit_status
# cleanup_command_exit_status = command('/opt/boxen/repo/script/nuke --force --homebrew-config').exit_status
# file_count_stdout = command('find $HOMEBREW_ROOT/etc/boxen -type f | wc -l').stdout.strip

# expect(creation_command_exit_status).to eq(0)
# expect(cleanup_command_exit_status).to eq(0)
# expect(file_count_stdout).to eq("0")
# end
# end
# end
11 changes: 11 additions & 0 deletions spec/localhost/directories_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe file('/opt/boxen/repo') do
it { should be_directory }
end

describe 'Boxen managed configuration files' do
describe file('/usr/local/etc/boxen') do
it { should be_directory }
end
end
5 changes: 5 additions & 0 deletions spec/localhost/git_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'spec_helper'

describe package('git') do
it { should be_installed }
end
5 changes: 5 additions & 0 deletions spec/localhost/hub_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'spec_helper'

describe package('hub') do
it { should be_installed }
end
7 changes: 7 additions & 0 deletions spec/localhost/packages_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

%w(ack findutils gnu-tar).each do |package_name|
describe package(package_name) do
it { should be_installed }
end
end
5 changes: 0 additions & 5 deletions spec/localhost/sample_spec.rb

This file was deleted.

19 changes: 19 additions & 0 deletions spec/localhost/services/dnsmasq_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'

describe 'dnsmasq' do
describe file('/usr/local/etc/boxen/dnsmasq') do
it { should be_directory }
end

describe file('/usr/local/etc/boxen/dnsmasq/dnsmasq.conf') do
it { should be_file }
end

describe file('/opt/boxen/data/dnsmasq') do
it { should be_directory }
end

describe file('/opt/boxen/log/dnsmasq') do
it { should be_directory }
end
end
27 changes: 27 additions & 0 deletions spec/localhost/services/nginx_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'spec_helper'

describe 'nginx' do
describe file('/usr/local/etc/boxen/nginx') do
it { should be_directory }
end

describe file('/usr/local/etc/boxen/nginx/sites') do
it { should be_directory }
end

describe file('/usr/local/etc/boxen/nginx/public') do
it { should be_directory }
end

describe file('/usr/local/etc/boxen/nginx/nginx.conf') do
it { should be_file }
end

describe file('/opt/boxen/log/nginx') do
it { should be_directory }
end

describe file('/opt/boxen/data/nginx') do
it { should be_directory }
end
end
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'serverspec'

set :backend, :exec

Binary file removed vendor/cache/json-1.8.3.gem
Binary file not shown.
Binary file added vendor/cache/json-2.1.0.gem
Binary file not shown.
Binary file removed vendor/cache/thor-0.19.1.gem
Binary file not shown.
Binary file added vendor/cache/thor-0.20.0.gem
Binary file not shown.
Binary file removed vendor/puppet/cache/boxen-puppet-boxen-3.12.0.tar.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed vendor/puppet/cache/boxen-puppet-hub-1.4.4.tar.gz
Binary file not shown.
Binary file added vendor/puppet/cache/boxen-puppet-hub-1.4.5.tar.gz
Binary file not shown.
Binary file removed vendor/puppet/cache/boxen-puppet-nginx-1.7.0.tar.gz
Binary file not shown.
Binary file not shown.
Binary file removed vendor/puppet/cache/boxen-puppet-ruby-8.5.4.tar.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 6ab8bb3

Please sign in to comment.