Sha256: ff9a4202824c9c0b9189c99f398998a0185b9e1fa8b55040edad8f4df9a9bed1

Contents?: true

Size: 1.54 KB

Versions: 3

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|
        @role = 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
        elsif test '[ -f /etc/lsb-release ]'
          #Debian flavor OS
          git_plugin.debian_install
        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

3 entries across 3 versions & 1 rubygems

Version Path
capistrano3-puma-3.0.2 lib/capistrano/tasks/jungle.rake
capistrano3-puma-3.0.1 lib/capistrano/tasks/jungle.rake
capistrano3-puma-3.0.0 lib/capistrano/tasks/jungle.rake