Skip to content

Instantly share code, notes, and snippets.

@fujin
Created February 27, 2012 22:07
Show Gist options
  • Save fujin/1927438 to your computer and use it in GitHub Desktop.
Save fujin/1927438 to your computer and use it in GitHub Desktop.
bash 'install science app' do
installed_version_file = "#{app[:base_dir]}/.#{app[:version]}-installed"
cwd Chef::Config[:file_cache_path]
code <<-BASH
tar zxf #{app[:tarball]} -C #{app[:deploy_to]}
cp #{app[:tarball]} #{app[:deploy_to]}
touch #{installed_version_file}
BASH
not_if { ::File.exist?(installed_version_file) }
end
ruby_block "get digest" do
block do
requirements = File.open(app[:requirements_file],"rb")
digest = Digest::MD5.hexdigest(requirements.read)
virtual_env_tarball = "virtual_env-#{digest}.tgz"
end
action :create
end
remote_file "#{Chef::Config[:file_cache_path]}/#{virtual_env_tarball}" do
source "#{node[:virtual_env][:base_url]}/#{digest}/#{virtual_env_tarball}"
mode 0644
action :create_if_missing
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment