What is the best best way to write the currently deployed commit hash to a version.txt file using Chef, similar to how Etsy does it? This is what I came up with.
execute "update_version" do
command git log -1 --format="%H" > public/version.txt
creates "#{app_config['deploy_dir']}/current/public/version.txt"
owner app_user
group app_group
action:run
end
Might not work in an execute resource
http://wiki.opscode.com/display/chef/Resources#Resources-Execute
I might do something like
alternatively you could create a template with content like like
and use a template resource something like