Sha256: 02b6c76771a9821f2ec351e422f4fe4bacf9d539142d8d594d8765e64e2f9ea5

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

module Bunto
  module Utils
    module Platforms
      extend self

      # Provides jruby? and mri? which respectively detect these two types of
      # tested Engines we support, in the future we might probably support the
      # other one that everyone used to talk about.

      { :jruby? => "jruby", :mri? => "ruby" }.each do |k, v|
        define_method k do
          ::RUBY_ENGINE == v
        end
      end

      # Provides windows?, linux?, osx?, unix? so that we can detect
      # platforms. This is mostly useful for `bunto doctor` and for testing
      # where we kick off certain tests based on the platform.

      { :windows? => /mswin|mingw|cygwin/, :linux? => /linux/, \
          :osx? => /darwin|mac os/, :unix? => /solaris|bsd/ }.each do |k, v|
        define_method k do
          !!(
            RbConfig::CONFIG["host_os"] =~ v
          )
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bunto-3.0.0 lib/bunto/utils/platforms.rb
bunto-2.0.0.pre lib/bunto/utils/platforms.rb
bunto-1.0.0 lib/bunto/utils/platforms.rb