module WillowRun

Constants

AIRPORT

path to the airport command

VERSION

Public Class Methods

disassociate() click to toggle source

disassociate() allows a user to simply disassociate from any network, requiring root/sudo privilleges

# File lib/willow_run.rb, line 41
def self.disassociate
  unless Process.uid == 0
    o, s = Open3.capture2("#{AIRPORT} -z")
    unless o == "root required to disassociate\n"
      return true
    end
    raise WillowRunError.new(o)
    false  
  end
end
find_the_airport?() click to toggle source

find_the_airport?() will help determine if the airport Mach-O 64-bit executable is avaiable to us or not.

# File lib/willow_run.rb, line 21
def self.find_the_airport?
  File.exist?(AIRPORT) ? true : false
end
set_channel(channel) click to toggle source

set_channel() allows a user to set a arbitrary channel on the card.

# File lib/willow_run.rb, line 33
def self.set_channel(channel)
  o, s = Open3.capture2("#{AIRPORT} -c #{channel}")
  s.success? ? true : false
end
take_off?() click to toggle source

take_off?() can help determine if the airport command is accessible or not if we run it.

# File lib/willow_run.rb, line 27
def self.take_off?
  Open3.capture2(AIRPORT).last.success?
end