Sha256: 609b2547c3b094bdc3f2c7509a2ed01055634ffb854ddf974c9bc1f66814e54c

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

require 'docker-sync/preconditions/preconditions_osx'
require 'docker-sync/preconditions/preconditions_linux'

require 'singleton'
require 'os'

module DockerSync
  module Preconditions
    class Strategy
      include Singleton

      attr_accessor :strategy

      def initialize
        if DockerSync::Preconditions::Strategy.is_osx
          @strategy = DockerSync::Preconditions::Osx.new
        elsif DockerSync::Preconditions::Strategy.is_linux
          @strategy = DockerSync::Preconditions::Linux.new
        end
      end

      def self.is_osx
        return OS.mac?
      end

      def self.is_linux
        return OS.linux?
      end

      def check_all_preconditions(config)
        strategy.check_all_preconditions(config)
      end

      def docker_available
        strategy.docker_available
      end

      def docker_running
        strategy.docker_running
      end

      def rsync_available
        strategy.rsync_available
      end


      def fswatch_available
        strategy.fswatch_available
      end

      def unison_available
        strategy.unison_available
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
docker-sync-0.3.5 lib/docker-sync/preconditions/strategy.rb
docker-sync-0.3.4 lib/docker-sync/preconditions/strategy.rb
docker-sync-0.3.3 lib/docker-sync/preconditions/strategy.rb
docker-sync-0.3.2 lib/docker-sync/preconditions/strategy.rb
docker-sync-0.3.1 lib/docker-sync/preconditions/strategy.rb
docker-sync-0.3.0 lib/docker-sync/preconditions/strategy.rb