Skip to content
Browse files

refactoring pg_admin, svn, virtualbox and github for mac. Adding the …

…ability to accept license agreements to the dmg provider
  • Loading branch information...
1 parent c645018 commit d62df51970037748367104ed0bb0e352cb3202a8 Brian Cunnie & Matthew Kocher committed Sep 14, 2011
View
2 attributes/virtualbox.rb
@@ -1,2 +0,0 @@
-node.default["virtualbox_download_uri"]="http://download.virtualbox.org/virtualbox/4.1.2/VirtualBox-4.1.2-73507-OSX.dmg"
-node.default["virtualbox_app_path"]="/Applications/Virtualbox.app"
View
11 providers/package.rb
@@ -21,7 +21,7 @@ def load_current_resource
@dmgpkg = Chef::Resource::PivotalWorkstationPackage.new(new_resource.name)
@dmgpkg.app(new_resource.app)
Chef::Log.debug("Checking for application #{new_resource.app}")
- installed = (new_resource.type == "app")?(::File.directory?("#{new_resource.destination}/#{new_resource.app}.app")):system("pkgutil --pkgs=#{new_resource.pkg_id}")
+ installed = (new_resource.type == "app") ? (::File.directory?("#{new_resource.destination}/#{new_resource.app}.app")) : system("pkgutil --pkgs=#{new_resource.package_id}")
@dmgpkg.installed(installed)
end
@@ -51,8 +51,13 @@ def load_current_resource
mode 0644
end
end
-
- execute "hdiutil attach '#{dmg_file}'" do
+
+ ruby_block "attach #{dmg_file}" do
+ block do
+ software_license_agreement = system("hdiutil imageinfo #{dmg_file} | grep -q 'Software License Agreement: true'")
+ confirm_mount_cmd = software_license_agreement ? "echo Y |" : ""
+ system "#{confirm_mount_cmd} hdiutil attach '#{dmg_file}'"
+ end
not_if "hdiutil info | grep -q 'image-path.*#{dmg_file}'"
end
View
1 recipes/github_for_mac.rb
@@ -13,6 +13,7 @@
execute "copy github_for_mac to /Applications" do
command "mv /tmp/GitHub.app #{Regexp.escape(node["github_for_mac_app_path"])}"
user WS_USER
+ group "admin"
end
ruby_block "test to see if GitHub.app was installed" do
View
2 recipes/java.rb
@@ -3,6 +3,6 @@
volumes_dir "Java for Mac OS X 10.7"
action :install
type "mpkg"
- pkg_id "com.apple.pkg.JavaForMacOSX107"
+ package_id "com.apple.pkg.JavaForMacOSX107"
checksum "4c32d32cfeaaf4aab539a1385c4f55a97cf09c7d396f8b43257161616bba7070"
end
View
1 recipes/lion_basedev.rb
@@ -34,3 +34,4 @@
include_recipe "pivotal_workstation::pivotal_logos"
include_recipe "pivotal_workstation::mouse_locator"
include_recipe "pivotal_workstation::ccmenu"
+include_recipe "pivotal_workstation::github_for_mac"
View
32 recipes/pg_admin.rb
@@ -1,28 +1,4 @@
-unless File.exists?(node["pg_admin_app_path"])
-
- remote_file "/tmp/pg_admin3.dmg" do
- source node["pg_admin_download_uri"]
- mode "0644"
- end
-
- execute "mount pgAdmin3 dmg" do
- command "echo 'Y' | hdid /tmp/pg_admin3.dmg"
- user WS_USER
- end
-
- execute "copy pgAdmin3 to /Applications" do
- command "cp -rf /Volumes/pgAdmin3/pgAdmin3.app #{Regexp.escape(node["pg_admin_app_path"])}"
- user WS_USER
- end
-
- execute "unmount dmg" do
- command "hdiutil detach /Volumes/pgAdmin3"
- user WS_USER
- end
-
- ruby_block "test to see if pgAdmin3 was installed" do
- block do
- raise "pgAdmin3 install failed" unless File.exists?(node["pg_admin_app_path"])
- end
- end
-end
+pivotal_workstation_package "pgAdmin3" do
+ source "http://wwwmaster.postgresql.org/redir/198/h/pgadmin3/release/v1.12.3/osx/pgadmin3-1.12.3.dmg"
+ checksum "9435f79d5b52d0febeddfad392adf82db9df159196f496c1ab139a6957242ce9"
+end
View
9 recipes/svn.rb
@@ -1,8 +1 @@
-unless system("svn --version | grep 'svn version' > /dev/null")
- include_recipe "pivotal_workstation::homebrew"
-
- execute "brew install svn" do
- user WS_USER
- command "brew install svn"
- end
-end
+brew_install "svn"
View
39 recipes/virtualbox.rb
@@ -1,32 +1,7 @@
-# found package name by mounting dmg and
-# cat /Volumes/VirtualBox/VirtualBox.mpkg/Contents/Packages/VirtualBox.pkg/Contents/Info.plist
-# note, there are 4 packages in the mpkg
-`pkgutil --pkgs=org.virtualbox.pkg.virtualbox`
-if $? != 0
-
- remote_file "/tmp/virtualbox.dmg" do
- source node["virtualbox_download_uri"]
- mode "0644"
- end
-
- execute "mount virtualbox dmg" do
- command "hdid /tmp/virtualbox.dmg"
- user WS_USER
- end
-
- execute "intall virtualbox" do
- command "installer -pkg /Volumes/VirtualBox/VirtualBox.mpkg -target /"
- end
-
- execute "unmount dmg" do
- command "hdiutil detach /Volumes/VirtualBox"
- user WS_USER
- end
-
- ruby_block "test to see if virtualbox was installed" do
- block do
- `pkgutil --pkgs=org.virtualbox.pkg.virtualbox`
- raise "VirtualBox install failed" if $? != 0
- end
- end
-end
+pivotal_workstation_package "VirtualBox" do
+ source "http://download.virtualbox.org/virtualbox/4.1.2/VirtualBox-4.1.2-73507-OSX.dmg"
+ checksum "6fd7b3ed2596cd76004e6d1a8d5ddbfb4193d6508132bfa447304c9cff5703d7"
+ action :install
+ type "mpkg"
+ package_id "org.virtualbox.pkg.virtualbox"
+end
View
2 resources/package.rb
@@ -25,7 +25,7 @@
attribute :volumes_dir, :kind_of => String, :default => nil
attribute :dmg_name, :kind_of => String, :default => nil
attribute :type, :kind_of => String, :default => "app"
-attribute :pkg_id, :kind_of => String, :default => nil
+attribute :package_id, :kind_of => String, :default => nil
attribute :installed, :kind_of => [TrueClass, FalseClass], :default => false
def initialize(name, run_context=nil)

0 comments on commit d62df51

Please sign in to comment.
Something went wrong with that request. Please try again.