Sha256: bd46eeb1df43ac3a19ea9283ea73647123840efc472bd57a8efdf29f43ea09e1

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

# base module that has the statis methods that this gem is using
module CapistranoMulticonfigParallel
  ENV_KEY_JOB_ID = 'multi_cap_job_id'
  GITFLOW_TAG_STAGING_TASK = 'gitflow:tag_staging'
  GITFLOW_CALCULATE_TAG_TASK = 'gitflow:calculate_tag'
  GITFLOW_VERIFY_UPTODATE_TASK = 'gitflow:verify_up_to_date'

  class << self
    attr_accessor :logger, :original_args, :config, :config_keys
    include CapistranoMulticonfigParallel::Configuration
    include CapistranoMulticonfigParallel::GemHelper

    def configuration
      @config ||= fetch_configuration
      @config
    end

    def enable_logging
      enable_file_logging
      set_celluloid_exception_handling
    end

    def capistrano_version
      find_loaded_gem_property('capistrano', 'version')
    end

    def capistrano_version_2?
      verify_gem_version('capistrano', '3.0', operator: '<')
    end

  private

    def set_celluloid_exception_handling
      Celluloid.logger = logger
      Celluloid.task_class = Celluloid::TaskThread
      Celluloid.exception_handler do |ex|
        unless ex.is_a?(Interrupt)
          rescue_error(ex, 'stderr')
        end
      end
    end

    def enable_file_logging
      if configuration.multi_debug.to_s.downcase == 'true'
        enable_main_log_file
        self.logger = ::Logger.new(main_log_file)
      else
        self.logger ||= ::Logger.new(DevNull.new)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capistrano_multiconfig_parallel-1.0.3 lib/capistrano_multiconfig_parallel/base.rb
capistrano_multiconfig_parallel-1.0.2 lib/capistrano_multiconfig_parallel/base.rb
capistrano_multiconfig_parallel-1.0.1 lib/capistrano_multiconfig_parallel/base.rb
capistrano_multiconfig_parallel-1.0.0 lib/capistrano_multiconfig_parallel/base.rb