Permalink
Browse files

remove homebrew in preparation for subtree

  • Loading branch information...
1 parent dced708 commit 08aa80c73c3dedd45f39d1183517916cfd6b77d2 @bleything committed Jul 28, 2012
@@ -1,60 +0,0 @@
-= Description
-
-Installs Homebrew and acts as the native package provider for Mac OS X using
-Homebrew to install packages. See:
-
-http://woss.name/2011/01/23/converging-your-home-directory-with-chef/
-
-for additional background.
-
-= Requirements
-
-== Platform
-
-This is only going to work on platforms that Homebrew supports which is, I
-think, just Mac OS X. This cookbook has been tested on Mac OS X 10.6.6 with the
-latest version of Homebrew (as of Mon 24 Jan 2011 at any rate!).
-
-== Cookbooks
-
-Shouldn't require any other cookbooks, though its operation may be greatly
-enhanced by another cookbook I'm brewing that manages launchd. ;-)
-
-= Resources and Providers
-
-This cookbook provides a package provider called +homebrew_package+ which will
-install/remove packages using Homebrew. This becomes the default provider for
-+package+ if your platform is Mac OS X.
-
-= Attributes
-
-None.
-
-= Usage
-
-Just make sure that this cookbook is selected before you start installing
-packages. You can add:
-
- include_recipe 'homebrew'
-
-to all your recipes that install packages, or you can just make sure it's on
-the run list somewhere early on. The bookbook itself ensures that Homebrew is
-installed and up to date.
-
-= License and Author
-
-Author:: Graeme Mathieson (<mathie@woss.name>)
-
-Copyright:: 2011, Graeme Mathieson
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
@@ -1,17 +0,0 @@
-require 'rubygems'
-require 'chef'
-require 'json'
-
-desc "Generate an updated JSON metadata file"
-task :metadata do
- cook_meta = Chef::Cookbook::Metadata.new
- cook_meta.from_file('metadata.rb')
- File.open('metadata.json', 'w') do |f|
- f.write(JSON.pretty_generate(cook_meta))
- end
-end
-
-desc "Create an archive for uploading to cookbooks.opscode.com"
-task :archive do
- sh %{git archive --format=tar --prefix=homebrew/ HEAD |gzip -9 > homebrew.tar.gz}
-end
@@ -1,79 +0,0 @@
-# Chef package provider for Homebrew
-
-require 'chef/provider/package'
-require 'chef/resource/package'
-require 'chef/platform'
-
-class Chef
- class Provider
- class Package
- class Homebrew < Package
- def load_current_resource
- @current_resource = Chef::Resource::Package.new(@new_resource.name)
- @current_resource.package_name(@new_resource.package_name)
- @current_resource.version(current_installed_version)
-
- @current_resource
- end
-
- def install_package(name, version)
- brew('install', name)
- end
-
- # Homebrew doesn't really have a notion of upgrading packages, just
- # install the latest version?
- def upgrade_package(name, version)
- install_package(name, version)
- end
-
- def remove_package(name, version)
- brew('uninstall', name)
- end
-
- # Homebrew doesn't really have a notion of purging, so just remove.
- def purge_package(name, version)
- remove_package(name, version)
- end
-
- protected
- def brew(*args)
- run_command_with_systems_locale(
- :command => "brew #{args.join(' ')}"
- )
- end
-
- def current_installed_version
- get_version_from_command("brew list --versions | awk '/^#{@new_resource.package_name} / { print $2 }'")
- end
-
- def candidate_version
- get_version_from_command("brew info #{@new_resource.package_name} | awk '/^#{@new_resource.package_name} / { print $2 }'")
- end
-
- def get_version_from_command(command)
- version = get_response_from_command(command).chomp
- version.empty? ? nil : version
- end
-
- # Nicked from lib/chef/package/provider/macports.rb and tweaked
- # slightly.
- def get_response_from_command(command)
- output = nil
- status = popen4(command) do |pid, stdin, stdout, stderr|
- begin
- output = stdout.read
- rescue Exception => e
- raise Chef::Exceptions::Package, "Could not read from STDOUT on command: #{command}\nException: #{e.inspect}"
- end
- end
- unless (0..1).include? status.exitstatus
- raise Chef::Exceptions::Package, "#{command} failed - #{status.inspect}"
- end
- output
- end
- end
- end
- end
-end
-
-Chef::Platform.set :platform => :mac_os_x, :resource => :package, :provider => Chef::Provider::Package::Homebrew
@@ -1,33 +0,0 @@
-{
- "suggestions": {
- },
- "conflicting": {
- },
- "long_description": "= Description\n\nInstalls Homebrew and acts as the native package provider for Mac OS X using\nHomebrew to install packages. See:\n\nhttp://woss.name/2011/01/23/converging-your-home-directory-with-chef/\n\nfor additional background.\n\n= Requirements\n\n== Platform\n\nThis is only going to work on platforms that Homebrew supports which is, I\nthink, just Mac OS X. This cookbook has been tested on Mac OS X 10.6.6 with the\nlatest version of Homebrew (as of Mon 24 Jan 2011 at any rate!).\n\n== Cookbooks\n\nShouldn't require any other cookbooks, though its operation may be greatly\nenhanced by another cookbook I'm brewing that manages launchd. ;-)\n\n= Resources and Providers\n\nThis cookbook provides a package provider called +homebrew_package+ which will\ninstall/remove packages using Homebrew. This becomes the default provider for\n+package+ if your platform is Mac OS X.\n\n= Attributes\n\nNone.\n\n= Usage\n\nJust make sure that this cookbook is selected before you start installing\npackages. You can add:\n\n include_recipe 'homebrew'\n\nto all your recipes that install packages, or you can just make sure it's on\nthe run list somewhere early on. The bookbook itself ensures that Homebrew is\ninstalled and up to date.\n\n= License and Author\n\nAuthor:: Graeme Mathieson (<mathie@woss.name>)\n\nCopyright:: 2011, Graeme Mathieson\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
- "providing": {
- },
- "platforms": {
- "mac_os_x": [
-
- ]
- },
- "license": "Apache 2.0",
- "maintainer": "Graeme Mathieson",
- "replacing": {
- },
- "maintainer_email": "mathie@woss.name",
- "name": "homebrew",
- "version": "1.0.0",
- "groupings": {
- },
- "dependencies": {
- },
- "description": "Install Homebrew and use it as your package provider in Mac OS X",
- "recipes": {
- "homebrew": "Install Homebrew"
- },
- "attributes": {
- },
- "recommendations": {
- }
-}
@@ -1,9 +0,0 @@
-name "homebrew"
-maintainer "Graeme Mathieson"
-maintainer_email "mathie@woss.name"
-license "Apache 2.0"
-description "Install Homebrew and use it as your package provider in Mac OS X"
-long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
-version "1.0.0"
-recipe "homebrew", "Install Homebrew"
-supports "mac_os_x"
@@ -1,27 +0,0 @@
-def load_current_resource
- @tap = Chef::Resource::HomebrewTap.new(new_resource.name)
- tap_dir = @tap.name.gsub('/', '-')
-
- Chef::Log.debug("Checking whether we've already tapped #{new_resource.name}")
- if ::File.directory?("/usr/local/Library/Taps/#{tap_dir}")
- @tap.tapped true
- else
- @tap.tapped false
- end
-end
-
-action :tap do
- unless @tap.tapped
- execute "tapping #{new_resource.name}" do
- command "/usr/local/bin/brew tap #{new_resource.name}"
- end
- end
-end
-
-action :untap do
- if @tap.tapped
- execute "untapping #{new_resource.name}" do
- command "/usr/local/bin/brew untap #{new_resource.name}"
- end
- end
-end
@@ -1,11 +0,0 @@
-execute "install homebrew" do
- command "curl -sfL https://github.com/mxcl/homebrew/tarball/master | tar zx -m --strip 1"
- cwd "/usr/local"
- not_if { File.exist? '/usr/local/bin/brew' }
-end
-
-package 'git'
-
-execute "update homebrew from github" do
- command "/usr/local/bin/brew update || true"
-end
@@ -1,14 +0,0 @@
-actions :tap, :untap
-attribute :name,
- :name_attribute => true,
- :kind_of => String,
- :regex => /\w+(?:\/\w+)+/
-
-attribute :tapped,
- :kind_of => [TrueClass, FalseClass]
-
-### hax for default action
-def initialize( *args )
- super
- @action = :tap
-end

0 comments on commit 08aa80c

Please sign in to comment.