Sha256: 857c650013eaf64b9ab0a06858ea71e4c4aa639b07ac48373cd6f93949a53d1f

Contents?: true

Size: 853 Bytes

Versions: 3

Compression:

Stored size: 853 Bytes

Contents

module Knapsack
  class Config
    class << self
      def report_path
        ENV['KNAPSACK_REPORT_PATH'] || 'knapsack_report.json'
      end

      def ci_node_total
        ENV['CI_NODE_TOTAL'] || ENV['CIRCLE_NODE_TOTAL'] || ENV['SEMAPHORE_THREAD_COUNT'] || 1
      end

      def ci_node_index
        ENV['CI_NODE_INDEX'] || ENV['CIRCLE_NODE_INDEX'] || semaphore_current_thread || 0
      end

      def spec_pattern
        ENV['KNAPSACK_SPEC_PATTERN'] || 'spec/**/*_spec.rb'
      end

      def enable_time_offset_warning
        true
      end

      def time_offset_in_seconds
        30
      end

      def generate_report
        ENV['KNAPSACK_GENERATE_REPORT'] || false
      end

      private

      def semaphore_current_thread
        index = ENV['SEMAPHORE_CURRENT_THREAD']
        index.to_i - 1 if index
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
knapsack-0.5.0 lib/knapsack/config.rb
knapsack-0.4.0 lib/knapsack/config.rb
knapsack-0.3.0 lib/knapsack/config.rb