Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cookbooks for build-tools, curl, dmg, firefox, chrome, homebrew, libx…

…ml2, mysql, openssl, readline, rvm, skype and zlib
  • Loading branch information...
commit 1e978eb059c3fe7d84a52f57b0ff6e59beb66dc5 1 parent 6bf4362
@sickill sickill authored
Showing with 700 additions and 0 deletions.
  1. +1 −0  cookbooks/build-tools/metadata.rb
  2. +21 −0 cookbooks/build-tools/recipes/default.rb
  3. +1 −0  cookbooks/curl/metadata.rb
  4. +1 −0  cookbooks/curl/recipes/default.rb
  5. +120 −0 cookbooks/dmg/README.md
  6. +20 −0 cookbooks/dmg/attributes/default.rb
  7. +30 −0 cookbooks/dmg/metadata.json
  8. +7 −0 cookbooks/dmg/metadata.rb
  9. +61 −0 cookbooks/dmg/providers/package.rb
  10. +18 −0 cookbooks/dmg/recipes/default.rb
  11. +33 −0 cookbooks/dmg/resources/package.rb
  12. +10 −0 cookbooks/firefox/recipes/default.rb
  13. +28 −0 cookbooks/google-chrome/recipes/default.rb
  14. +60 −0 cookbooks/homebrew/README.rdoc
  15. +17 −0 cookbooks/homebrew/Rakefile
  16. +79 −0 cookbooks/homebrew/libraries/homebrew_package.rb
  17. +33 −0 cookbooks/homebrew/metadata.json
  18. +9 −0 cookbooks/homebrew/metadata.rb
  19. +11 −0 cookbooks/homebrew/recipes/default.rb
  20. +11 −0 cookbooks/libxml2/recipes/default.rb
  21. +1 −0  cookbooks/mysql/metadata.rb
  22. +16 −0 cookbooks/mysql/recipes/default.rb
  23. +8 −0 cookbooks/openssl/recipes/default.rb
  24. +12 −0 cookbooks/readline/recipes/default.rb
  25. +20 −0 cookbooks/rvm/recipes/default.rb
  26. +26 −0 cookbooks/rvm/recipes/ruby192.rb
  27. +38 −0 cookbooks/skype/recipes/default.rb
  28. +8 −0 cookbooks/zlib/recipes/default.rb
View
1  cookbooks/build-tools/metadata.rb
@@ -0,0 +1 @@
+description "Installs C compiler / build tools"
View
21 cookbooks/build-tools/recipes/default.rb
@@ -0,0 +1,21 @@
+if node[:platform] == 'mac_os_x'
+ bash "checking for gcc (Xcode)" do
+ code "gcc -v || { echo 'Please install Xcode' && exit 1; }"
+ end
+else
+ case node[:platform]
+ when "ubuntu"
+ %w{build-essential binutils-doc}.each do |pkg|
+ package pkg
+ end
+
+ when "fedora"
+ %w{gcc gcc-c++ kernel-devel make}.each do |pkg|
+ package pkg
+ end
+ end
+
+ package "autoconf"
+ package "flex"
+ package "bison"
+end
View
1  cookbooks/curl/metadata.rb
@@ -0,0 +1 @@
+description "Installs curl"
View
1  cookbooks/curl/recipes/default.rb
@@ -0,0 +1 @@
+package 'curl'
View
120 cookbooks/dmg/README.md
@@ -0,0 +1,120 @@
+Description
+===========
+
+Lightweight resource and provider to install OS X applications (.app) from dmg files.
+
+Changes
+=======
+
+## v0.6.0:
+
+- option to install software that is an .mpkg inside a .dmg
+- ignore failure on chmod in case mode is already set, or is root owned
+
+Requirements
+============
+
+## Platform:
+
+* Mac OS X
+
+Resources and Providers
+=======================
+
+dmg\_package
+------------
+
+This resource will install a DMG "Package". It will retrieve the DMG from a remote URL, mount it using OS X's `hdid`, copy the application (.app directory) to the specified destination (/Applications), and detach the image using `hdiutil`. The dmg file will be stored in the `Chef::Config[:file_cache_path]`. If you want to install an application that has already been downloaded (not using the `source` parameter), copy it to the appropriate location. You can find out what directory this is with the following command on the node to run chef:
+
+ knife exec -E 'p Chef::Config[:file_cache_path]' -c /etc/chef/client.rb
+
+Optionally, the LWRP can install an "mpkg" package using installer(8).
+
+# Actions:
+
+* :install - Installs the application.
+
+# Parameter attributes:
+
+* `app` - This is the name of the application used by default for the /Volumes directory and the .app directory copied to /Applications.
+* `source` - remote URL for the dmg to download if specified. Default is nil.
+* `destination` - directory to copy the .app into. Default is /Applications.
+* `checksum` - sha256 checksum of the dmg to download. Default is nil.
+* `type` - type of package, "app" or "mpkg". Default is "app". When using "mpkg", the destination must be /Applications.
+* `volumes_dir` - Directory under /Volumes where the dmg is mounted. Not all dmgs are mounted into a /Volumes location matching the name of the dmg. If not specified, this will use the name attribute.
+* `dmg_name` - Specify the name of the dmg if it is not the same as `app`, or if the name has spaces.
+
+Usage Examples
+==============
+
+Install `/Applications/Tunnelblick.app` from the primary download site.
+
+ dmg_package "Tunnelblick" do
+ source "http://tunnelblick.googlecode.com/files/Tunnelblick_3.1.2.dmg"
+ checksum "a3fae60b6833175f32df20c90cd3a3603a"
+ action :install
+ end
+
+Install Google Chrome. Uses the `dmg_name` because the application name has spaces. Installs in `/Applications/Google Chrome.app`.
+
+ dmg_package "Google Chrome" do
+ dmg_name "googlechrome"
+ source "https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg"
+ checksum "7daa2dc5c46d9bfb14f1d7ff4b33884325e5e63e694810adc58f14795165c91a"
+ action :install
+ end
+
+Install Dropbox. Uses `volumes_dir` because the mounted directory is different than the name of the application directory. Installs in `/Applications/Dropbox.app`.
+
+ dmg_package "Dropbox" do
+ volumes_dir "Dropbox Installer"
+ source "http://www.dropbox.com/download?plat=mac"
+ checksum "b4ea620ca22b0517b75753283ceb82326aca8bc3c86212fbf725de6446a96a13"
+ action :install
+ end
+
+Install MacIrssi to `~/Applications` from the local file downloaded to the cache path into an Applications directory in the current user's home directory. Chef should run as a non-root user for this.
+
+ directory "#{ENV['HOME']}/Applications"
+
+ dmg_package "MacIrssi" do
+ destination "#{ENV['HOME']}/Applications"
+ action :install
+ end
+
+Install Virtualbox to `/Applications` from the .mpkg:
+
+ dmg_package "Virtualbox" do
+ source "http://dlc.sun.com.edgesuite.net/virtualbox/4.0.8/VirtualBox-4.0.8-71778-OSX.dmg"
+ type "mpkg"
+ end
+
+To do
+=====
+
+A few things remain outstanding to make this cookbook "1.0" quality.
+
+* support downloading a .dmg.zip and unzipping it
+* specify a local .dmg already downloaded in another location (like ~/Downloads)
+
+Some things that would be nice to have at some point.
+
+* use hdiutil to mount/attach the disk image
+* automatically detect the `volumes_dir` where the image is attached
+* be able to automatically accept license agreements
+
+License and Author
+==================
+
+* Copyright 2011, Joshua Timberman <cookbooks@housepub.org>
+
+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
View
20 cookbooks/dmg/attributes/default.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: dmg
+# Attributes:: default
+#
+# Copyright 2011, Joshua Timberman
+#
+# 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.
+#
+default[:dmg][:base_dir] = "/Applications"
+default[:dmg][:cache_dir] = Chef::Config[:file_cache_path]
View
30 cookbooks/dmg/metadata.json
@@ -0,0 +1,30 @@
+{
+ "name": "dmg",
+ "description": "LWRP to install OS X applications from dmgs",
+ "long_description": "Description\n===========\n\nLightweight resource and provider to install OS X applications (.app) from dmg files.\n\nChanges\n=======\n\n## v0.6.0:\n\n- option to install software that is an .mpkg inside a .dmg\n- ignore failure on chmod in case mode is already set, or is root owned\n\nRequirements\n============\n\n## Platform:\n\n* Mac OS X\n\nResources and Providers\n=======================\n\ndmg\\_package\n------------\n\nThis resource will install a DMG \"Package\". It will retrieve the DMG from a remote URL, mount it using OS X's `hdid`, copy the application (.app directory) to the specified destination (/Applications), and detach the image using `hdiutil`. The dmg file will be stored in the `Chef::Config[:file_cache_path]`. If you want to install an application that has already been downloaded (not using the `source` parameter), copy it to the appropriate location. You can find out what directory this is with the following command on the node to run chef:\n\n knife exec -E 'p Chef::Config[:file_cache_path]' -c /etc/chef/client.rb\n\nOptionally, the LWRP can install an \"mpkg\" package using installer(8).\n\n# Actions:\n\n* :install - Installs the application.\n\n# Parameter attributes:\n\n* `app` - This is the name of the application used by default for the /Volumes directory and the .app directory copied to /Applications.\n* `source` - remote URL for the dmg to download if specified. Default is nil.\n* `destination` - directory to copy the .app into. Default is /Applications.\n* `checksum` - sha256 checksum of the dmg to download. Default is nil.\n* `type` - type of package, \"app\" or \"mpkg\". Default is \"app\". When using \"mpkg\", the destination must be /Applications.\n* `volumes_dir` - Directory under /Volumes where the dmg is mounted. Not all dmgs are mounted into a /Volumes location matching the name of the dmg. If not specified, this will use the name attribute.\n* `dmg_name` - Specify the name of the dmg if it is not the same as `app`, or if the name has spaces.\n\nUsage Examples\n==============\n\nInstall `/Applications/Tunnelblick.app` from the primary download site.\n\n dmg_package \"Tunnelblick\" do\n source \"http://tunnelblick.googlecode.com/files/Tunnelblick_3.1.2.dmg\"\n checksum \"a3fae60b6833175f32df20c90cd3a3603a\"\n action :install\n end\n\nInstall Google Chrome. Uses the `dmg_name` because the application name has spaces. Installs in `/Applications/Google Chrome.app`.\n\n dmg_package \"Google Chrome\" do\n dmg_name \"googlechrome\"\n source \"https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg\"\n checksum \"7daa2dc5c46d9bfb14f1d7ff4b33884325e5e63e694810adc58f14795165c91a\"\n action :install\n end\n\nInstall Dropbox. Uses `volumes_dir` because the mounted directory is different than the name of the application directory. Installs in `/Applications/Dropbox.app`.\n\n dmg_package \"Dropbox\" do\n volumes_dir \"Dropbox Installer\"\n source \"http://www.dropbox.com/download?plat=mac\"\n checksum \"b4ea620ca22b0517b75753283ceb82326aca8bc3c86212fbf725de6446a96a13\"\n action :install\n end\n\nInstall MacIrssi to `~/Applications` from the local file downloaded to the cache path into an Applications directory in the current user's home directory. Chef should run as a non-root user for this.\n\n directory \"#{ENV['HOME']}/Applications\"\n\n dmg_package \"MacIrssi\" do\n destination \"#{ENV['HOME']}/Applications\"\n action :install\n end\n\nInstall Virtualbox to `/Applications` from the .mpkg:\n\n dmg_package \"Virtualbox\" do\n source \"http://dlc.sun.com.edgesuite.net/virtualbox/4.0.8/VirtualBox-4.0.8-71778-OSX.dmg\"\n type \"mpkg\"\n end\n\nTo do\n=====\n\nA few things remain outstanding to make this cookbook \"1.0\" quality.\n\n* support downloading a .dmg.zip and unzipping it\n* specify a local .dmg already downloaded in another location (like ~/Downloads)\n\nSome things that would be nice to have at some point.\n\n* use hdiutil to mount/attach the disk image\n* automatically detect the `volumes_dir` where the image is attached\n* be able to automatically accept license agreements\n\nLicense and Author\n==================\n\n* Copyright 2011, Joshua Timberman <cookbooks@housepub.org>\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\n",
+ "maintainer": "Joshua Timberman",
+ "maintainer_email": "cookbooks@housepub.org",
+ "license": "Apache 2.0",
+ "platforms": {
+ "mac_os_x": ">= 0.0.0"
+ },
+ "dependencies": {
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ },
+ "groupings": {
+ },
+ "recipes": {
+ },
+ "version": "0.6.0"
+}
View
7 cookbooks/dmg/metadata.rb
@@ -0,0 +1,7 @@
+maintainer "Joshua Timberman"
+maintainer_email "cookbooks@housepub.org"
+license "Apache 2.0"
+description "LWRP to install OS X applications from dmgs"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.6.0"
+supports "mac_os_x"
View
61 cookbooks/dmg/providers/package.rb
@@ -0,0 +1,61 @@
+#
+# Cookbook Name:: dmg
+# Provider:: package
+#
+# Copyright 2011, Joshua Timberman
+#
+# 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.
+#
+
+def load_current_resource
+ @dmgpkg = Chef::Resource::DmgPackage.new(new_resource.name)
+ @dmgpkg.app(new_resource.app)
+ Chef::Log.debug("Checking for application #{new_resource.app}")
+ installed = ::File.directory?("#{new_resource.destination}/#{new_resource.app}.app")
+ @dmgpkg.installed(installed)
+end
+
+action :install do
+ unless @dmgpkg.installed
+
+ volumes_dir = new_resource.volumes_dir ? new_resource.volumes_dir : new_resource.app
+ dmg_name = new_resource.dmg_name ? new_resource.dmg_name : new_resource.app
+ dmg_file = "#{Chef::Config[:file_cache_path]}/#{dmg_name}.dmg"
+
+ if new_resource.source
+ remote_file dmg_file do
+ source new_resource.source
+ checksum new_resource.checksum if new_resource.checksum
+ end
+ end
+
+ execute "hdid #{dmg_file}" do
+ not_if "hdiutil info | grep -q 'image-path.*#{dmg_file}'"
+ end
+
+ case new_resource.type
+ when "app"
+ execute "cp -r '/Volumes/#{volumes_dir}/#{new_resource.app}.app' '#{new_resource.destination}'"
+ when "mpkg"
+ execute "sudo installer -pkg /Volumes/#{volumes_dir}/#{new_resource.app}.mpkg -target /"
+ end
+
+ execute "hdiutil detach '/Volumes/#{volumes_dir}'"
+
+ file "#{new_resource.destination}/#{new_resource.app}.app/Contents/MacOS/#{new_resource.app}" do
+ mode 0755
+ ignore_failure true
+ end
+
+ end
+end
View
18 cookbooks/dmg/recipes/default.rb
@@ -0,0 +1,18 @@
+#
+# Cookbook Name:: dmg
+# Recipe:: default
+#
+# Copyright 2011, Joshua Timberman
+#
+# 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.
+#
View
33 cookbooks/dmg/resources/package.rb
@@ -0,0 +1,33 @@
+#
+# Cookbook Name:: dmg
+# Resource:: package
+#
+# Copyright 2011, Joshua Timberman
+#
+# 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.
+#
+actions :install
+
+attribute :app, :kind_of => String, :name_attribute => true
+attribute :source, :kind_of => String, :default => nil
+attribute :destination, :kind_of => String, :default => "/Applications"
+attribute :checksum, :kind_of => String, :default => nil
+attribute :volumes_dir, :kind_of => String, :default => nil
+attribute :dmg_name, :kind_of => String, :default => nil
+attribute :type, :kind_of => String, :default => "app"
+attribute :installed, :kind_of => [TrueClass, FalseClass], :default => false
+
+def initialize(name, run_context=nil)
+ super
+ @action = :install
+end
View
10 cookbooks/firefox/recipes/default.rb
@@ -0,0 +1,10 @@
+case node[:platform]
+when 'mac_os_x'
+ dmg_package "Firefox" do
+ source 'http://mozilla.snt.utwente.nl/firefox/releases/5.0/mac/en-US/Firefox%205.0.dmg'
+ action :install
+ end
+
+else
+ package 'firefox'
+end
View
28 cookbooks/google-chrome/recipes/default.rb
@@ -0,0 +1,28 @@
+base_url = "https://dl-ssl.google.com/linux/direct/"
+
+case node[:platform]
+when 'fedora', 'ubuntu'
+ if node[:platform] == 'fedora'
+ filename = "google-chrome-stable_current_i386.rpm"
+ else
+ filename = "google-chrome-stable_current_i386.deb"
+ end
+
+ bash "downloading package #{filename}" do
+ cwd "/tmp"
+ code "curl -kLsO #{base_url}#{filename}"
+ not_if { File.exist? "/tmp/#{filename}" }
+ end
+
+ package 'google-chrome-stable' do
+ source "/tmp/#{filename}"
+ action :install
+ end
+
+when 'mac_os_x'
+ dmg_package "Google Chrome" do
+ dmg_name "googlechrome"
+ source "https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg"
+ action :install
+ end
+end
View
60 cookbooks/homebrew/README.rdoc
@@ -0,0 +1,60 @@
+= 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.
View
17 cookbooks/homebrew/Rakefile
@@ -0,0 +1,17 @@
+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
View
79 cookbooks/homebrew/libraries/homebrew_package.rb
@@ -0,0 +1,79 @@
+# 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
View
33 cookbooks/homebrew/metadata.json
@@ -0,0 +1,33 @@
+{
+ "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": {
+ }
+}
View
9 cookbooks/homebrew/metadata.rb
@@ -0,0 +1,9 @@
+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"
View
11 cookbooks/homebrew/recipes/default.rb
@@ -0,0 +1,11 @@
+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
View
11 cookbooks/libxml2/recipes/default.rb
@@ -0,0 +1,11 @@
+case node[:platform]
+when 'ubuntu'
+ package 'libxml2-dev'
+ package 'libxslt-dev'
+
+when 'fedora'
+ package 'libxml2-devel'
+
+when 'mac_os_x'
+ package 'libxml2'
+end
View
1  cookbooks/mysql/metadata.rb
@@ -0,0 +1 @@
+description "Installs and configures mysql client and server"
View
16 cookbooks/mysql/recipes/default.rb
@@ -0,0 +1,16 @@
+case node[:platform]
+when 'ubuntu'
+ package "mysql-server"
+ package 'mysql-client'
+ package 'libmysqlclient-dev'
+ package 'libmysql-ruby'
+
+when 'fedora'
+ package "mysql-server"
+ package 'mysql'
+ package 'mysql-devel'
+ package 'ruby-mysql'
+
+when 'mac_os_x'
+ package 'mysql'
+end
View
8 cookbooks/openssl/recipes/default.rb
@@ -0,0 +1,8 @@
+package 'openssl'
+
+case node[:platform]
+when 'ubuntu'
+ package 'libssl-dev'
+when 'fedora'
+ package 'openssl-devel'
+end
View
12 cookbooks/readline/recipes/default.rb
@@ -0,0 +1,12 @@
+case node[:platform]
+when 'ubuntu'
+ package 'libreadline6'
+ package 'libreadline6-dev'
+
+when 'fedora'
+ package 'readline'
+ package 'readline-devel'
+
+when 'mac_os_x'
+ package 'readline'
+end
View
20 cookbooks/rvm/recipes/default.rb
@@ -0,0 +1,20 @@
+include_recipe 'curl'
+include_recipe 'git'
+
+$SUDO_USER = ENV['SUDO_USER']
+
+bash "installing single-user RVM for user #{$SUDO_USER}" do
+ code "su #{$SUDO_USER} -c 'bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)'"
+ not_if "su #{$SUDO_USER} -c 'which rvm'"
+
+ # user $SUDO_USER
+ # code "bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)"
+ # not_if "which rvm"
+end
+
+# bash "adjusting .bash_profile for rvm" do
+# user $SUDO_USER
+# code "echo '[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && . \"$HOME/.rvm/scripts/rvm\" # Load RVM function' >> ~/.bash_profile"
+# # code "su #{$SUDO_USER} -c 'echo \'[[ -s \"\$HOME/.rvm/scripts/rvm\" ]] && . \"\$HOME/.rvm/scripts/rvm\" # Load RVM function\' >> ~/.bash_profile'"
+# not_if "grep 'scripts/rvm' ~/.bash_profile"
+# end
View
26 cookbooks/rvm/recipes/ruby192.rb
@@ -0,0 +1,26 @@
+include_recipe 'build-tools'
+include_recipe 'libxml2'
+include_recipe 'openssl'
+include_recipe 'readline'
+include_recipe 'zlib'
+
+include_recipe "rvm::default"
+
+case node[:platform]
+when 'ubuntu'
+ %w(libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libc6-dev ncurses-dev).each do |pkg|
+ package pkg
+ end
+when 'fedora'
+ %w(patch libyaml-devel libffi-devel bzip2).each do |pkg|
+ package pkg
+ end
+end
+
+ruby_version = '1.9.2'
+
+bash "installing ruby #{ruby_version}" do
+ user $SUDO_USER
+ code "echo installing #{ruby_version}"
+ # not_if "rvm list | grep #{ruby_version}"
+end
View
38 cookbooks/skype/recipes/default.rb
@@ -0,0 +1,38 @@
+base_url = "http://download.skype.com/linux/"
+skype_version = "2.2.0.35"
+
+case node[:platform]
+when 'fedora'
+ filename = "skype-#{skype_version}-fedora.i586.rpm"
+
+ bash "downloading package #{filename}" do
+ cwd "/tmp"
+ code "curl -kLsO #{base_url}#{filename}"
+ not_if { File.exist? "/tmp/#{filename}" }
+ end
+
+ package 'skype' do
+ source "/tmp/#{filename}"
+ action :install
+ end
+
+when 'ubuntu'
+ filename = "skype-ubuntu_#{skype_version}-1_i386.deb"
+
+ bash "downloading package #{filename}" do
+ cwd "/tmp"
+ code "curl -kLsO #{base_url}#{filename}"
+ not_if { File.exist? "/tmp/#{filename}" }
+ end
+
+ package 'skype' do
+ source "/tmp/#{filename}"
+ action :install
+ end
+
+when 'mac_os_x'
+ dmg_package "Skype" do
+ source "http://www.skype.com/go/getskype-macosx.dmg"
+ action :install
+ end
+end
View
8 cookbooks/zlib/recipes/default.rb
@@ -0,0 +1,8 @@
+case node[:platform]
+when 'ubuntu'
+ package 'zlib1g'
+ package 'zlib1g-dev'
+when 'fedora'
+ package 'zlib'
+ package 'zlib-devel'
+end
Please sign in to comment.
Something went wrong with that request. Please try again.