Sha256: b630f15c5a6c6646e18ec7625babd80b5c5acdadc7728e25587ddb999f79aba4

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

git_plugin = self

namespace :puma do
  namespace :jungle do
    desc 'Install Puma jungle'
    task :install do
      on roles(fetch(:puma_role)) do |role|
        git_plugin.template_puma 'run-puma', "#{fetch(:tmp_dir)}/run-puma", role
        execute "chmod +x #{fetch(:tmp_dir)}/run-puma"
        sudo "mv #{fetch(:tmp_dir)}/run-puma #{fetch(:puma_run_path)}"
        if test '[ -f /etc/redhat-release ]'
          #RHEL flavor OS
          git_plugin.rhel_install(role)
        elsif test '[ -f /etc/lsb-release ]'
          #Debian flavor OS
          git_plugin.debian_install(role)
        else
          #Some other OS
          error 'This task is not supported for your OS'
        end
        sudo "touch #{fetch(:puma_jungle_conf)}"
      end
    end

    desc 'Setup Puma config and install jungle script'
    task :setup do
      invoke 'puma:config'
      invoke 'puma:jungle:install'
      invoke 'puma:jungle:add'
    end

    desc 'Add current project to the jungle'
    task :add do
      on roles(fetch(:puma_role)) do|role|
        sudo "/etc/init.d/puma add '#{current_path}' #{fetch(:puma_user, role.user)}"
      end
    end

    desc 'Remove current project from the jungle'
    task :remove do
      on roles(fetch(:puma_role)) do
        sudo "/etc/init.d/puma remove '#{current_path}'"
      end
    end

    %w[start stop restart status].each do |command|
      desc "#{command} puma"
      task command do
        on roles(fetch(:puma_role)) do
          sudo "service puma #{command} #{current_path}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano3-puma-3.1.0 lib/capistrano/tasks/jungle.rake
capistrano3-puma-3.0.3 lib/capistrano/tasks/jungle.rake