Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Add caffeine recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheath committed Feb 4, 2013
1 parent a307386 commit f1f247d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions attributes/caffeine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node.default["caffeine_download_uri"]="http://download.lightheadsw.com/download.php?software=caffeine"
node.default["caffeine_sha"]="9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853"
node.default["caffeine_app_path"]="/Applications/Caffeine.app"
25 changes: 25 additions & 0 deletions recipes/caffeine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
remote_file "#{Chef::Config[:file_cache_path]}/caffeine.zip" do
source node["caffeine_download_uri"]
owner WS_USER
checksum node["caffeine_sha"]
not_if { File.exists?("#{Chef::Config[:file_cache_path]}/caffeine.zip") }
end

execute "unzip caffeine" do
command "unzip #{Chef::Config[:file_cache_path]}/caffeine.zip -d #{Chef::Config[:file_cache_path]}/"
user WS_USER
not_if { File.exists?("#{Chef::Config[:file_cache_path]}/Caffeine.app") }
end

execute "copy caffeine to /Applications" do
command "mv #{Chef::Config[:file_cache_path]}/Caffeine.app #{Regexp.escape(node["caffeine_app_path"])}"
user WS_USER
group "admin"
not_if { File.exists?(node["caffeine_app_path"]) }
end

ruby_block "test to see if Caffeine.app was installed" do
block do
raise "Caffeine.app was not installed" unless File.exists?(node["caffeine_app_path"])
end
end

0 comments on commit f1f247d

Please sign in to comment.