Skip to content

Commit

Permalink
Clean up Github for Mac recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
ohrite committed Dec 23, 2012
1 parent b3ea6a1 commit cb1e6f8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
5 changes: 2 additions & 3 deletions attributes/github_for_mac.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# node.default["github_for_mac_download_uri"]="https://central.github.com/mac/latest"
# too bad latest is redirect to url with spaces in the name :(
node.default["github_for_mac_download_uri"]="https://github-central.s3.amazonaws.com/mac%2FGitHub%20for%20Mac%2087.zip"
node.default["github_for_mac_download_uri"]="https://github-central.s3.amazonaws.com/mac%2FGitHub%20for%20Mac%2096.zip"
node.default["github_for_mac_sha"]="0411b4e57b795fb4e12b8d14751a95ec49db4c5bc1d67f0f842875059350d710"
node.default["github_for_mac_app_path"]="/Applications/GitHub.app"
41 changes: 20 additions & 21 deletions recipes/github_for_mac.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
unless File.exists?(node["github_for_mac_app_path"])

remote_file "#{Chef::Config[:file_cache_path]}/github_for_mac.zip" do
source node["github_for_mac_download_uri"]
owner WS_USER
checksum "b21158e5d76583097a8d7f6d2f6f5cea0ff78852711390ec6c05f94625ec0248"
end
remote_file "#{Chef::Config[:file_cache_path]}/github_for_mac.zip" do
source node["github_for_mac_download_uri"]
owner WS_USER
checksum node["github_for_mac_sha"]
not_if { File.exists?("#{Chef::Config[:file_cache_path]}/github_for_mac.zip") }
end

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

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

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

end

0 comments on commit cb1e6f8

Please sign in to comment.