Module: Capistrano::UnicornNginx::Helpers

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

Instance Method Summary collapse

Instance Method Details

#bundle_unicorn(*args) ⇒ Object



7
8
9
# File 'lib/capistrano/unicorn_nginx/helpers.rb', line 7

def bundle_unicorn(*args)
  SSHKit::Command.new(:bundle, :exec, :unicorn, args).to_command
end

#deploy_userObject



25
26
27
# File 'lib/capistrano/unicorn_nginx/helpers.rb', line 25

def deploy_user
  capture :id, '-un'
end

#file_exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/capistrano/unicorn_nginx/helpers.rb', line 21

def file_exists?(path)
  test "[ -e #{path} ]"
end

#template(template_name, target) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/capistrano/unicorn_nginx/helpers.rb', line 11

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/unicorn_nginx/templates/#{template_name}")
  end
  config_stream = StringIO.new(ERB.new(File.read(config_file)).result(binding))
  upload! config_stream, target
end