~charmers/charms/precise/rails/trunk

« back to all changes in this revision

Viewing changes to hooks/chef/cookbooks/nginx/definitions/nginx_site.rb

  • Committer: Pavel Pachkovskij
  • Date: 2013-08-21 10:46:29 UTC
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: pavel.pachkovskij@gmail.com-20130821104629-zgrf6efx90tkf0ps
add rvm-installer, move cookbooks to CHARM_DIR

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
define :nginx_site, :action => :enable do
2
 
  site_available_path = "/etc/nginx/sites-available/#{params[:name]}"
3
 
  site_enabled_path = "/etc/nginx/sites-enabled/#{params[:name]}"
4
 
 
5
 
  if params[:action] == :enable
6
 
    link site_enabled_path do
7
 
      to site_available_path
8
 
      not_if { File.exists?(site_enabled_path) }
9
 
      only_if { File.exists?(site_available_path) }
10
 
      action :create
11
 
    end
12
 
  elsif params[:action] == :disable
13
 
    file site_enabled_path do
14
 
      only_if { File.exists?(site_enabled_path) }
15
 
      action :delete
16
 
    end
17
 
  end
18
 
end
 
 
b'\\ No newline at end of file'