Module: Capistrano::NginxUnicorn::Helpers

Defined in:
lib/capistrano/nginx_unicorn/helpers.rb

Instance Method Summary collapse

Instance Method Details

#template(template_name, target) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/capistrano/nginx_unicorn/helpers.rb', line 7

def template(template_name, target)
  config_file = "#{fetch(:templates_path)}/#{template_name}"
  # if no customized file, proceed with default
  unless File.exists?(config_file)
    config_file = File.join(File.dirname(__FILE__), "../../generators/capistrano/nginx_unicorn/templates/#{template_name}")
  end
  config_stream = StringIO.new(ERB.new(File.read(config_file)).result(binding))
  upload! config_stream, target
end