Sha256: 1c34e700e15cfa85f413dba6b3051f71dcc7d615bc449d5a50eaa23926578d91

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require "ms_deploy/render"

Capistrano::Configuration.instance.load do

  namespace :deploy do
    namespace :nginx do
      desc <<-DESC
        Starts the nginx web-server.
      DESC
      task :start do
        #run "sudo god start nginx"
        run "sudo /etc/init.d/nginx start"
      end

      desc <<-DESC
        #Stops the nginx web-server.
      DESC
      task :stop do
        #run "sudo god stop nginx"
        run "sudo /etc/init.d/nginx stop"
      end

      desc <<-DESC
        Restarts the nginx web-server.
      DESC
      task :restart do
        #run "sudo god restart nginx"
        run "sudo /etc/init.d/nginx restart"
      end

      task :install  do
        template_path = File.expand_path('../../templates/vhost.erb', __FILE__)
        vars = {'application'=> application, 'project_root' => deploy_to + '/current', 'server_name' => server_name}
        config_path = "#{shared_path}/config/#{application}_vhost.conf"

        put(render_erb_template(template_path, vars), config_path)
        sudo "rm -f /etc/nginx/sites-enabled/#{application}.conf"
        sudo "ln -s #{config_path} /etc/nginx/sites-enabled/#{application}.conf"
      end

      task :uninstall  do
        sudo "rm -f /etc/nginx/sites-enabled/#{application}.conf"
      end
    end
  end

  after :"deploy:setup", :"deploy:nginx:install";

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ms_deploy-0.0.2 lib/ms_deploy/recipes/deploy/nginx.rb
ms_deploy-0.0.1 lib/ms_deploy/recipes/deploy/nginx.rb