Sha256: 5b8fbf100b93413fc5208033098793ecffcc3b73d710bd2f86a940a2e3e7dcda

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 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 full_os
        @full_os ||= mac? ? "#{`sw_vers -productName`.chomp} #{`sw_vers -productVersion`.chomp}" : os
      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

9 entries across 9 versions & 1 rubygems

Version Path
travis-1.6.2.travis.366.4 lib/travis/tools/system.rb
travis-1.6.2.travis.365.4 lib/travis/tools/system.rb
travis-1.6.2.travis.364.4 lib/travis/tools/system.rb
travis-1.6.1 lib/travis/tools/system.rb
travis-1.6.1.travis.363.4 lib/travis/tools/system.rb
travis-1.6.0 lib/travis/tools/system.rb
travis-1.5.9.travis.362.4 lib/travis/tools/system.rb
travis-1.5.9.travis.361.4 lib/travis/tools/system.rb
travis-1.5.9.travis.360.4 lib/travis/tools/system.rb