Top Level Namespace

Defined Under Namespace

Modules: Capistrano, Edploy, Edployify

Constant Summary collapse

TEMPLATES =
{}
RAILS_ROOT =
Dir.getwd
GEM_DIR =
File.expand_path('../../../', __FILE__)
MY_HOSTNAME =
`hostname`.strip
MY_HOSTNAME_WITHOUT_INDEX =
`hostname | sed 's/[0-9]$//'`.strip
PROJECT_PATH =
ENV['PROJECT_PATH'] || File.expand_path('../../../../', __FILE__)
DEPLOY_USER =
(ENV['DEPLOY_USER'].nil? || ENV['DEPLOY_USER'].empty?) ? `id -un`.strip : ENV['DEPLOY_USER']
DEPLOY_GROUP =
(ENV['DEPLOY_GROUP'].nil? || ENV['DEPLOY_GROUP'].empty?) ? `id -gn`.strip : ENV['DEPLOY_GROUP']
RAILS_ENV =
'development'
STAGE =
nil
SHARED_PATH =
File.expand_path('../../../../shared', __FILE__)
CURRENT_PATH =
PROJECT_PATH
GLUSTERFS_PATH =
File.expand_path('../../../../glusterfs', __FILE__)

Instance Method Summary collapse

Instance Method Details

#render_template(local_template) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/edploy/recipes/templates.rb', line 3

def render_template(local_template)
	template_name = File.basename(local_template)
	file_name = File.basename(template_name, '.erb')
	app = File.basename(File.dirname(local_template))
	path = File.join(deploy_to, app, file_name)
	
  template = ERB.new(IO.read(local_template))
  rendered_template = template.result(binding)
  
  tmp_path = File.join('/tmp/', "#{File.basename(path)}-$CAPISTRANO:HOST$") 
  put(rendered_template, tmp_path, :mode => 0644)
  send run_method, <<-CMD
    sh -c "install -m#{sprintf("%3o",0644)} #{tmp_path} #{path} &&
    rm -f #{tmp_path}"
  CMD
end