Module: Sambot::Runtime
- Defined in:
- lib/sambot/runtime.rb
Class Method Summary collapse
Class Method Details
.ensure_latest ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/sambot/runtime.rb', line 13 def self.ensure_latest latest_version = Gems.new.versions('sambot')[0]["number"] UI.debug("Current version is #{Sambot::VERSION}") UI.debug("Latest version is #{latest_version}") if is_obsolete UI.info('A newer version of this gem exists - please update the gem before continuing') end end |
.is_obsolete ⇒ Object
8 9 10 11 |
# File 'lib/sambot/runtime.rb', line 8 def self.is_obsolete latest_version = Gems.new.versions('sambot')[0]["number"] Gem::Version.new(Sambot::VERSION) < Gem::Version.new(latest_version) end |
.sudo(command) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/sambot/runtime.rb', line 22 def self.sudo(command) Open4::popen4("sudo -S #{command}") do |pid, stdin, stdout, stderr| stdin.puts ENV['SAMBOT_SUDO_PASSWORD'] stdin.close stdout.read end end |