Sha256: c06e86d487ab00cf53aeb6a001cd73c1e1603e4271b6d40159e227fd3fa192b0

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

module Capistrano
  module Cookbook
    class SetupConfigValues
      def symlinks
        fetch(:symlinks) || symlinks_defaults
      end

      def executable_config_files
        fetch(:executable_config_files) || executable_config_files_defaults
      end

      def config_files
        fetch(:config_files) || config_files_defaults
      end

      private

      def symlinks_defaults
        base = [
          {
            source: "log_rotation",
            link: "/etc/logrotate.d/{{full_app_name}}"
          }
        ]
        return base unless sidekiq_enabled?

        base + [
          {
            source: "sidekiq.service.capistrano",
            link: "/etc/systemd/system/#{fetch(:sidekiq_service_unit_name)}.service"
          },
          {
            source: "sidekiq_monit",
            link: "/etc/monit/conf.d/#{fetch(:full_app_name)}_sidekiq.conf"
          }
        ]
      end

      def executable_config_files_defaults
        %w(
        )
      end

      def config_files_defaults
        base = %w(
          database.example.yml
          log_rotation
        )
        return base unless sidekiq_enabled?

        base + %w(
          sidekiq.service.capistrano
          sidekiq_monit
        )
      end

      def sidekiq_enabled?
        defined?(Capistrano::Sidekiq) == 'constant' && Capistrano::Sidekiq.class == Class
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-cookbook-5.0.0 lib/capistrano/cookbook/helpers/setup_config_values.rb