Sha256: 0e03666afab260cc5cdf679c4bf6d4ca7e2ec5539fdefb25bf8fd90248892b2f

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

require 'lerna/strategy'

module Lerna
  module Strategies
    class DualExternal < Strategy
      def applicable?
        wanted_displays.length == 2
      end

      def configuration
        [].tap { |conf|
          disconnected = displays - wanted_displays
          disconnected.each do |d|
            conf << '--output' << d.name << '--off'
          end
          conf << '--output' << wanted_displays[0].name << '--auto'
          conf << '--output' << wanted_displays[1].name << '--auto' <<
            '--right-of' << wanted_displays[0].name
        }
      end

    private

      def wanted_displays
        displays.
          select(&:connected?).
          select { |d| d.external? && d.digital? }.
          sort_by(&:name)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lerna-0.1.0 lib/lerna/strategies/dual_external.rb