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



48
49
50
# File 'lib/travis/tools/system.rb', line 48

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

#full_osObject



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

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



34
35
36
37
38
39
40
41
# File 'lib/travis/tools/system.rb', line 34

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



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

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

#ruby_versionObject



30
31
32
# File 'lib/travis/tools/system.rb', line 30

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

#rubygemsObject



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

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