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.9.travis.358.4 lib/travis/tools/system.rb
travis-1.5.8 lib/travis/tools/system.rb
travis-1.5.8.travis.356.4 lib/travis/tools/system.rb
travis-1.5.7 lib/travis/tools/system.rb
travis-1.5.7.travis.345.4 lib/travis/tools/system.rb
travis-1.5.7.travis.341.4 lib/travis/tools/system.rb
travis-1.5.7.travis.338.4 lib/travis/tools/system.rb
travis-1.5.6 lib/travis/tools/system.rb
travis-1.5.6.travis.337.4 lib/travis/tools/system.rb
travis-1.5.6.travis.336.4 lib/travis/tools/system.rb
travis-1.5.6.travis.333.4 lib/travis/tools/system.rb
travis-1.5.6.travis.332.4 lib/travis/tools/system.rb
travis-1.5.6.travis.330.4 lib/travis/tools/system.rb
travis-1.5.6.travis.329.4 lib/travis/tools/system.rb
travis-1.5.6.travis.326.4 lib/travis/tools/system.rb
travis-1.5.6.travis.324.4 lib/travis/tools/system.rb
travis-1.5.6.travis.323.4 lib/travis/tools/system.rb
travis-1.5.6.travis.320.4 lib/travis/tools/system.rb
travis-1.5.6.travis.319.4 lib/travis/tools/system.rb
travis-1.5.6.travis.317.4 lib/travis/tools/system.rb