Sha256: 67f0524806c61b2d75a2242e41ffb2302b2c628f7d5c82c918e26bdf1e871247

Contents?: true

Size: 671 Bytes

Versions: 11

Compression:

Stored size: 671 Bytes

Contents

require "capistrano/systemd/multiservice/version"
require "capistrano/systemd/multiservice/system_service"
require "capistrano/systemd/multiservice/user_service"

module Capistrano
  module Systemd
    module MultiService
      SERVICE_TYPES = %w[system user].freeze

      class ServiceTypeError < RuntimeError; end

      def self.new_service(app, service_type: 'system')
        service_type = service_type.to_s
        unless SERVICE_TYPES.include?(service_type)
          raise ServiceTypeError,
                "Service type has to be one of #{SERVICE_TYPES}"
        end

        const_get("#{service_type.capitalize}Service").new(app)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
capistrano-systemd-ng-0.1.4 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-ng-0.1.3 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-multiservice-0.1.0.beta13 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-ng-0.1.2 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-ng-0.1.1 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-multiservice-0.1.0.beta12 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-multiservice-0.1.0.beta11 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-multiservice-0.1.0.beta10 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-multiservice-0.1.0.beta9 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-multiservice-0.1.0.beta8 lib/capistrano/systemd/multiservice.rb
capistrano-systemd-multiservice-0.1.0.beta7 lib/capistrano/systemd/multiservice.rb