Skip to content

Instantly share code, notes, and snippets.

@grahamc
Last active December 18, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamc/0c4079e43b5f997a5bd6 to your computer and use it in GitHub Desktop.
Save grahamc/0c4079e43b5f997a5bd6 to your computer and use it in GitHub Desktop.
base_dir = "/opt/foobar/"
deployed_env = "dev"
deployed_user = "foobar"
deployed_group = "foobar"
# Create a bundle_wrapper.sh which sets the deployed RAILS_ENV,
# and puts our ruby first in the path, use it as if it were bundler
# itself:
# cd /opt/foobar/deployment/current
# /opt/foobar/bundle_wrapper.sh exec rake db:migrate
#
# etc.
file "#{base_dir}/bundle_wrapper.sh" do
user deployed_user
group deployed_group
mode "0750"
content <<-EOH
#!/bin/bash
export PATH="/usr/local/bin/:$PATH"
export RAILS_ENV="#{deployed_env}"
exec bundle $@
EOH
end
application "foobar" do
environment_name deployed_env
migrate true
rails do
bundler true
bundle_command "#{base_dir}/bundle_wrapper.sh"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment