#!/bin/sh

export rvm_dir=<%= @options[:rvm_dir] %>
export RUBY_BIN=<%= @options[:ruby_bin] %>

cd <%= @options[:app_dir] %>
<%= @options[:extra_code] %>

export rvm_ignore_rvmrc=1
exec 2>&1
exec chpst -v -u <%= @options[:user] %>:<%= @options[:group] %> <%= @options[:chpst_arguments] %> <%= @options[:wrapper_dir] %>/bundle exec unicorn <%= @options[:unicorn_arguments] %>

#!/bin/sh

export rvm_dir=<%= @options[:rvm_dir] %>
export RUBY_BIN=<%= @options[:ruby_bin] %>
export RAILS_ENV=production  # by default

<%= @options[:env_vars].map { |name, value| "export #{name}=#{value}" }.join("\n") %>

# This assumes Capistrano or Chef has already created a release
cd <%= @options[:app_dir] %>/releases/current
<%= @options[:extra_code] %>

export rvm_ignore_rvmrc=1
exec 2>&1
exec chpst -v -u <%= @options[:user] %>:<%= @options[:group] %> <%= @options[:chpst_arguments] %> <%= @options[:wrapper_dir] %>/bundle exec unicorn <%= @options[:unicorn_arguments] %>

Use environment variables and correct Capistrano release dir, plus set RAILS_ENV by default.
Use environment variables and correct Capistrano release dir, plus set RAILS_ENV by default.
