Sha256: d45f232d64162be452d61f806aa38128f6e5807dff83acb0f8170853ca0d8a0f

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

# This trick lets us access the Capistrano::Systemd::MultiService plugin within `on` blocks
svc = self

namespace :systemd do
  namespace svc.nsp do
    {
      setup:                "Setup %{app} systemd unit file",
      remove:               "Remove %{app} systemd unit file",
      validate:             "Validate %{app} systemd unit file",
      "daemon-reload":      "Run systemctl daemon-reload",
      start:                "Run systemctl %{task_name} for %{app}",
      stop:                 "Run systemctl %{task_name} for %{app}",
      reload:               "Run systemctl %{task_name} for %{app}",
      restart:              "Run systemctl %{task_name} for %{app}",
      "reload-or-restart":  "Run systemctl %{task_name} for %{app}",
      enable:               "Run systemctl %{task_name} for %{app}",
      disable:              "Run systemctl %{task_name} for %{app}",
    }.each do |task_name, desc_template|
      desc(desc_template % { app: svc.app, task_name: task_name})
      task task_name do
        on roles(fetch(:"#{svc.prefix}_role")) do
          svc.__send__ task_name.to_s.tr('-', '_')
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
capistrano-systemd-ng-0.1.4 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-ng-0.1.3 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta13 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-ng-0.1.2 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-ng-0.1.1 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta12 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta11 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta10 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta9 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta8 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta7 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta6 lib/capistrano/tasks/systemd/multiservice/system_service.rake
capistrano-systemd-multiservice-0.1.0.beta5 lib/capistrano/tasks/systemd/multiservice.rake
capistrano-systemd-multiservice-0.1.0.beta4 lib/capistrano/tasks/systemd/multiservice.rake
capistrano-systemd-multiservice-0.1.0.beta3 lib/capistrano/tasks/systemd/multiservice.rake
capistrano-systemd-multiservice-0.1.0.beta2 lib/capistrano/tasks/systemd/multiservice.rake
capistrano-systemd-multiservice-0.1.0.beta1 lib/capistrano/tasks/systemd/multiservice.rake