Module: Travis::Tools::System

Extended by:
System
Included in:
System
Defined in:
lib/travis/tools/system.rb

Instance Method Summary collapse

Instance Method Details

#description(*args) ⇒ Object



44
45
46
# File 'lib/travis/tools/system.rb', line 44

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

#linux?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/travis/tools/system.rb', line 14

def linux?
  RUBY_PLATFORM =~ /linux/i
end

#mac?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/travis/tools/system.rb', line 10

def mac?
  RUBY_PLATFORM =~ /darwin/i
end

#osObject



18
19
20
# File 'lib/travis/tools/system.rb', line 18

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

#rubyObject



30
31
32
33
34
35
36
37
# File 'lib/travis/tools/system.rb', line 30

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

#ruby_engineObject



22
23
24
# File 'lib/travis/tools/system.rb', line 22

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

#ruby_versionObject



26
27
28
# File 'lib/travis/tools/system.rb', line 26

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

#rubygemsObject



39
40
41
42
# File 'lib/travis/tools/system.rb', line 39

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

#windows?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/travis/tools/system.rb', line 6

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