Reworked to use Ruby since its needed for Puppet

This commit is contained in:
Gene Liverman 2017-05-07 09:01:12 -07:00
parent bff34cde83
commit 4f0169d4fc
21 changed files with 73 additions and 38 deletions

23
bin/dots.rb Executable file
View file

@ -0,0 +1,23 @@
require 'open3'
require 'os'
if OS.mac?
stdout, _stderr, _status = Open3.capture3('sw_vers -productVersion')
if Integer(stdout.strip.split('.')[0]) == 10
if Integer(stdout.strip.split('.')[1]) >= 12
puts "It seems you are on macOS #{stdout.strip}"
else
puts "It seems you are on OX X #{stdout.strip}"
end
elsif Integer(stdout.strip.split('.')[0]) < 10
puts "Wow... you're sure running an old os (#{stdout.strip} to be exact)"
else
abort("It seems you are on a Mac but I don't know what to do on v#{stdout.strip}")
end
elsif OS.liux?
puts 'It seems you are on Linux'
elsif OS.windows?
puts 'It seems you are on Windows'
else
abort("I'm not sure what to do with this OS...")
end