Sha256: 92f12c6b5893f78c9760649c731c1d5350f89fd0bcad4d2f4a9ced768ddd51f5

Contents?: true

Size: 1.07 KB

Versions: 33

Compression:

Stored size: 1.07 KB

Contents

module Travis
  module Tools
    module System
      extend self

      def windows?
        File::ALT_SEPARATOR == "\\"
      end

      def mac?
        RUBY_PLATFORM =~ /darwin/i
      end

      def linux?
        RUBY_PLATFORM =~ /linux/i
      end

      def os
        @os ||= windows? ? "Windows" : `uname`.chomp
      end

      def ruby_engine
        defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
      end

      def ruby_version
        "%s-p%s" % [RUBY_VERSION, RUBY_PATCHLEVEL]
      end

      def ruby
        case ruby_engine
        when 'ruby'  then "Ruby #{ruby_version}"
        when 'jruby' then "JRuby #{JRUBY_VERSION} like Ruby #{ruby_version}"
        when 'rbx'   then "Rubinius #{Rubinius.version[/\d\S+/]} like Ruby #{ruby_version}"
        else              "#{ruby_engine} like Ruby #{ruby_version}"
        end
      end

      def rubygems
        return "no RubyGems" unless defined? Gem
        "RubyGems #{Gem::VERSION}"
      end

      def description(*args)
        [ os, ruby, rubygems, *args.flatten].compact.uniq.join("; ")
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
travis-1.5.6.travis.315.4 lib/travis/tools/system.rb
travis-1.5.6.travis.314.4 lib/travis/tools/system.rb
travis-1.5.6.travis.312.4 lib/travis/tools/system.rb
travis-1.5.6.travis.307.4 lib/travis/tools/system.rb
travis-1.5.6.travis.306.4 lib/travis/tools/system.rb
travis-1.5.6.travis.304.4 lib/travis/tools/system.rb
travis-1.5.6.travis.303.4 lib/travis/tools/system.rb
travis-1.5.6.travis.301.4 lib/travis/tools/system.rb
travis-1.5.6.travis.299.4 lib/travis/tools/system.rb
travis-1.5.6.travis.297.4 lib/travis/tools/system.rb
travis-1.5.6.travis.296.4 lib/travis/tools/system.rb
travis-1.5.5 lib/travis/tools/system.rb
travis-1.5.4 lib/travis/tools/system.rb