Module: Travis::Tools::System
Instance Method Summary collapse
- #description(*args) ⇒ Object
- #linux? ⇒ Boolean
- #mac? ⇒ Boolean
- #os ⇒ Object
- #ruby ⇒ Object
- #ruby_engine ⇒ Object
- #ruby_version ⇒ Object
- #rubygems ⇒ Object
- #windows? ⇒ Boolean
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
14 15 16 |
# File 'lib/travis/tools/system.rb', line 14 def linux? RUBY_PLATFORM =~ /linux/i end |
#mac? ⇒ Boolean
10 11 12 |
# File 'lib/travis/tools/system.rb', line 10 def mac? RUBY_PLATFORM =~ /darwin/i end |
#os ⇒ Object
18 19 20 |
# File 'lib/travis/tools/system.rb', line 18 def os @os ||= windows? ? "Windows" : `uname`.chomp end |
#ruby ⇒ Object
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_engine ⇒ Object
22 23 24 |
# File 'lib/travis/tools/system.rb', line 22 def ruby_engine defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' end |
#ruby_version ⇒ Object
26 27 28 |
# File 'lib/travis/tools/system.rb', line 26 def ruby_version "%s-p%s" % [RUBY_VERSION, RUBY_PATCHLEVEL] end |
#rubygems ⇒ Object
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
6 7 8 |
# File 'lib/travis/tools/system.rb', line 6 def windows? File::ALT_SEPARATOR == "\\" end |