diff --git a/attributes/github_for_mac.rb b/attributes/github_for_mac.rb index 2f5ee3aa..fbd7a668 100644 --- a/attributes/github_for_mac.rb +++ b/attributes/github_for_mac.rb @@ -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" diff --git a/recipes/github_for_mac.rb b/recipes/github_for_mac.rb index b25ee3fc..ebd96940 100644 --- a/recipes/github_for_mac.rb +++ b/recipes/github_for_mac.rb @@ -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