Permalink
Browse files

Removed pivotal_workstation_package resource in favour of dmg cookboo…

…k dep.
  • Loading branch information...
1 parent 991483b commit 55047eebb381723d3f0c3e608ee7d3ac0afc9937 @patcon patcon committed with Brian Cunnie, Doc Ritezel & Matthew Kocher Jul 28, 2012
View
@@ -5,3 +5,4 @@
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.0"
supports "mac_os_x"
+depends "dmg"
View
@@ -1,83 +0,0 @@
-#
-# 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::PivotalWorkstationPackage.new(new_resource.name)
- @dmgpkg.app(new_resource.app)
- Chef::Log.debug("Checking for application #{new_resource.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"
-
- remote_file "#{dmg_file} - #{@dmgpkg.name}" do
- path dmg_file
- source new_resource.source
- checksum new_resource.checksum if new_resource.checksum
- only_if { new_resource.source }
- end
-
- passphrase_cmd = new_resource.dmg_passphrase ? "-passphrase #{new_resource.dmg_passphrase}" : ""
- ruby_block "attach #{dmg_file}" do
- block do
- software_license_agreement = system("hdiutil imageinfo #{passphrase_cmd} '#{dmg_file}' | grep -q 'Software License Agreement: true'")
- raise "Requires EULA Acceptance; add 'accept_eula true' to package resource" if software_license_agreement && !new_resource.accept_eula
- accept_eula_cmd = new_resource.accept_eula ? "echo Y |" : ""
- system "#{accept_eula_cmd} hdiutil attach #{passphrase_cmd} '#{dmg_file}'"
- end
- not_if "hdiutil info #{passphrase_cmd} | 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}'" do
- command "cp -R '/Volumes/#{volumes_dir}/#{new_resource.app}.app' '#{new_resource.destination}'"
- user new_resource.owner if new_resource.owner
- end
- file "#{new_resource.destination}/#{new_resource.app}.app/Contents/MacOS/#{new_resource.app}" do
- mode 0755
- ignore_failure true
- end
- when "mpkg", "pkg"
- execute "sudo installer -pkg '/Volumes/#{volumes_dir}/#{new_resource.app}.#{new_resource.type}' -target /"
- end
-
- execute "hdiutil detach '/Volumes/#{volumes_dir}'"
- end
-end
-
-private
-
-def installed?
- installed = false
- if ( ::File.directory?("#{new_resource.destination}/#{new_resource.app}.app") )
- installed = true;
- log "Already installed; to upgrade, remove \"#{new_resource.destination}/#{new_resource.app}.app\""
- end
- if ( system("pkgutil --pkgs=#{new_resource.package_id}") )
- installed = true;
- log "Already installed; to upgrade, try \"sudo pkgutil --forget #{new_resource.package_id}\""
- end
- installed
-end
View
@@ -1,4 +1,4 @@
-pivotal_workstation_package "Alfred" do
+dmg_package "Alfred" do
volumes_dir "Alfred.app"
source "http://cachefly.alfredapp.com/alfred_1.3_249.dmg"
checksum "2f6924d537e35997075bd411199edcfdf19a21f607b613932c0c60df8a09e7c9"
@@ -1 +1 @@
-pivotal_workstation_bash_profile_include "git_completion"
+pivotal_workstation_bash_profile_include "git_completion"
@@ -1 +1 @@
-pivotal_workstation_bash_profile_include "lang_en"
+pivotal_workstation_bash_profile_include "lang_en"
View
@@ -2,16 +2,18 @@
app_path="/Applications/CCMenu.app"
-unless File.exists?(app_path)
- pivotal_workstation_package "CCMenu" do
- volumes_dir "CCMenu 1.3"
- source "http://surfnet.dl.sourceforge.net/project/ccmenu/CCMenu/1.3/ccmenu-1.3-b.dmg"
- checksum "9afef887022002b0f074eb7db25349da53aea5d5a64d8415b756c676db9ad1de"
- owner WS_USER
- action :install
- end
+dmg_package "CCMenu" do
+ volumes_dir "CCMenu 1.3"
+ source "http://surfnet.dl.sourceforge.net/project/ccmenu/CCMenu/1.3/ccmenu-1.3-b.dmg"
+ checksum "9afef887022002b0f074eb7db25349da53aea5d5a64d8415b756c676db9ad1de"
+ owner WS_USER
+ action :install
+end
+# TODO: default read com.apple.loginitems | grep ccmenu ""
+unless File.exists?(app_path)
execute "Start CCMenu on login" do
command "su #{WS_USER} -c \"addloginitem #{app_path}\""
+ not_if { File.exists?(app_path) }
end
-end
+end
View
@@ -1,4 +1,4 @@
-pivotal_workstation_package "Google Chrome" do
+dmg_package "Google Chrome" do
dmg_name "googlechrome"
source "https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg"
checksum "bd85e06643abc3af5b1a049d8031c29f339f456c2d25852a7a4a1e6578b49792"
View
@@ -1,4 +1,4 @@
-pivotal_workstation_package "Dropbox" do
+dmg_package "Dropbox" do
volumes_dir "Dropbox Installer"
source "http://dl-web.dropbox.com/u/17/b/Dropbox%201.4.12.dmg"
checksum "367f18673cc27ab9266d70765e5c33f9cfd59f91028d18bd1188de52c9422cf3"
View
@@ -1,4 +1,4 @@
-pivotal_workstation_package "Evernote" do
+dmg_package "Evernote" do
volumes_dir "Evernote"
source "http://evernote.com/download/get.php?file=EvernoteMac"
checksum "20bf4ac0ed5e0e3c80806a60b72c986f9407ccedcd5b763c88a0440ac11db9b6"
View
@@ -1,6 +1,6 @@
-pivotal_workstation_package "Firefox" do
+dmg_package "Firefox" do
source "http://download.mozilla.org/?product=firefox-16.0.1&os=osx&lang=en-US"
checksum "5911843c3b4c2a55105ceacba8a377bce897c984ee202bed963df34089fecae9"
owner WS_USER
action :install
-end
+end
@@ -16,4 +16,4 @@
not_if { ::File.exists?("#{WS_HOME}/#{node['workspace_directory']}/#{repo_name}") }
end
end
-end
+end
@@ -9,4 +9,4 @@
# ...and also change them for this session.
execute "sysctl -w kern.sysv.shmall=65536"
-execute "sysctl -w kern.sysv.shmmax=16777216"
+execute "sysctl -w kern.sysv.shmmax=16777216"
@@ -1,5 +1,5 @@
intellij_version = "10.5.2"
-pivotal_workstation_package "IntelliJ IDEA 10 CE" do
+dmg_package "IntelliJ IDEA 10 CE" do
source "http://download.jetbrains.com/idea/ideaIC-#{intellij_version}.dmg"
checksum "69d7a7b055fcccb00695257385f585c1cb6e46eb29500184e0530b700f4c4ed5"
owner WS_USER
@@ -1,5 +1,5 @@
intellij_version = "10.5.2"
-pivotal_workstation_package "IntelliJ IDEA 10" do
+dmg_package "IntelliJ IDEA 10" do
source "http://download.jetbrains.com/idea/ideaIU-#{intellij_version}.dmg"
checksum "667c7227cccc011666492150320601fb7517ed9e9f3b935dcee1cc337bdadae9"
owner WS_USER
View
@@ -1,4 +1,4 @@
-pivotal_workstation_package "JavaForOSX" do
+dmg_package "JavaForOSX" do
source "http://support.apple.com/downloads/DL1572/en_US/"
volumes_dir "Java for OS X 2012-006"
action :install
View
@@ -3,7 +3,7 @@
app_path="/Applications/KeyCastr.app"
unless File.exists?(app_path)
- pivotal_workstation_package "KeyCastr" do
+ dmg_package "KeyCastr" do
dmg_name "KeyCastr"
source "http://software-files-a.cnet.com/s/software/11/00/84/53/keycastr_0.8.0.dmg"
checksum "ecf59a2e46a8ca450c12f426a4d41000de1c3010a5c46fe12f23fdc647f3f1e7"
@@ -15,4 +15,4 @@
execute "Start KeyCastr #{app_path} on login" do
command "su #{WS_USER} -c \"addloginitem #{app_path}\""
end
-end
+end
@@ -1,4 +1,4 @@
-pivotal_workstation_package "LibreOffice" do
+dmg_package "LibreOffice" do
volumes_dir "LibreOffice"
source "http://download.documentfoundation.org/libreoffice/stable/3.6.3/mac/x86/LibO_3.6.3_MacOS_x86_install_en-US.dmg"
checksum "d8537892049c053f91aff569a72c67bfd7559be4340588484025cf2d73adff5a"
View
@@ -1,4 +1,4 @@
-pivotal_workstation_package "pgAdmin3" do
+dmg_package "pgAdmin3" do
source "http://ftp.postgresql.org/pub/pgadmin3/release/v1.14.3/osx/pgadmin3-1.14.3.dmg"
checksum "9435f79d5b52d0febeddfad392adf82db9df159196f496c1ab139a6957242ce9"
owner WS_USER
@@ -8,4 +8,4 @@
directory "/Applications/GarageBand.app" do
action :delete
recursive true
-end
+end
View
@@ -1,6 +1,6 @@
include_recipe "pivotal_workstation::java"
-pivotal_workstation_package "RubyMine" do
+dmg_package "RubyMine" do
source "http://download.jetbrains.com/ruby/RubyMine-4.5.4.dmg"
checksum "1983d4417c6b2817bd6534f8804c2366fbd074a17dbc5a98cd85161abe255714"
action :install
@@ -26,4 +26,4 @@
link "#{rubymine_preferences_dir}/#{file}" do
to "#{preferences_git_repo_location}/#{file}"
end
-end
+end
@@ -14,4 +14,4 @@
domain 'com.apple.finder'
key 'ShowRemovableMediaOnDesktop'
boolean true
-end
+end
View
@@ -1,4 +1,4 @@
-pivotal_workstation_package "Skype" do
+dmg_package "Skype" do
source "http://download.skype.com/macosx/Skype_6.0.0.2946.dmg"
checksum "98eb5f81f5f75c1d85e4ffee39ab36d58da5314d"
owner WS_USER
@@ -1,4 +1,4 @@
-pivotal_workstation_package "Sublime Text 2" do
+dmg_package "Sublime Text 2" do
dmg_name "Sublime%20Text%202.0.1"
source "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1.dmg"
checksum "b5f91ee4f62d36c0490c021d5fb134b9e7cb3936"
@@ -2,4 +2,4 @@
domain 'com.apple.Terminal'
key 'FocusFollowsMouse'
string 'yes'
-end
+end
View
@@ -1,6 +1,6 @@
include_recipe "pivotal_workstation::virtualbox"
-pivotal_workstation_package "Vagrant" do
+dmg_package "Vagrant" do
source "http://files.vagrantup.com/packages/be0bc66efc0c5919e92d8b79e973d9911f2a511f/Vagrant-1.0.5.dmg"
checksum "d9ccdd454389f5830a8218c066c8f54c15d9d32ca6060bc42677b495aad08003"
action :install
@@ -1,4 +1,4 @@
-pivotal_workstation_package "VirtualBox" do
+dmg_package "VirtualBox" do
source "http://download.virtualbox.org/virtualbox/4.2.0/VirtualBox-4.2.1-80871-OSX.dmg"
checksum "dda9cc85e4dfdc07b8c32e7286ac2963fcce2f2d42c24367992697aada1b6166"
action :install
@@ -2,4 +2,4 @@
domain 'org.x.X11'
key 'wm_ffm'
boolean true
-end
+end
View
@@ -1,4 +1,4 @@
-pivotal_workstation_package "XQuartz" do
+dmg_package "XQuartz" do
source "http://xquartz.macosforge.org/downloads/SL/XQuartz-2.7.4.dmg"
action :install
volumes_dir "XQuartz-2.7.4"
View
@@ -1,37 +0,0 @@
- #
-# 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 :owner, :kind_of => String, :default => nil
-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
-attribute :package_id, :kind_of => String, :default => nil
-attribute :dmg_passphrase, :kind_of => String, :default => nil
-attribute :accept_eula, :kind_of => [TrueClass, FalseClass], :default => false
-
-def initialize(name, run_context=nil)
- super
- @action = :install
-end

0 comments on commit 55047ee

Please sign in to comment.