Sha256: 44c3833c19b4b9f2416dee67c0d280c9d0df3615b1ee1742ff7f1120c705dea7

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require "ms_deploy/render"

Capistrano::Configuration.instance.load do

  namespace :service 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', 'domain' => domain}
        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", :"service:nginx:install";

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ms_deploy-0.0.6 lib/ms_deploy/recipes/nginx.rb
ms_deploy-0.0.5 lib/ms_deploy/recipes/nginx.rb
ms_deploy-0.0.4 lib/ms_deploy/recipes/nginx.rb
ms_deploy-0.0.3 lib/ms_deploy/recipes/nginx.rb