Module: Honeydew

Defined in:
lib/honeydew/dsl.rb,
lib/honeydew/device.rb,
lib/honeydew/version.rb,
lib/honeydew/honeydew.rb,
lib/honeydew/device_actions.rb,
lib/honeydew/device_commands.rb,
lib/honeydew/device_matchers.rb

Defined Under Namespace

Modules: DSL, DeviceActions, DeviceCommands, DeviceMatchers Classes: Configuration, Device

Constant Summary collapse

VERSION =
'0.14.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



26
27
28
# File 'lib/honeydew/honeydew.rb', line 26

def config
  @config
end

Class Method Details

.attached_devicesObject



39
40
41
42
43
# File 'lib/honeydew/honeydew.rb', line 39

def attached_devices
  @attached_devices ||= begin
    `adb devices`.split("\n").drop(1).collect {|line| line.split[0].chomp}
  end
end

.configure {|@config| ... } ⇒ Object

Yields:



34
35
36
37
# File 'lib/honeydew/honeydew.rb', line 34

def configure
  @config ||= Configuration.new
  yield(@config) if block_given?
end

.current_deviceObject



53
54
55
# File 'lib/honeydew/honeydew.rb', line 53

def current_device
  @current_device ||= default_device
end

.default_deviceObject



49
50
51
# File 'lib/honeydew/honeydew.rb', line 49

def default_device
  @default_device ||= device[default_device_serial]
end

.default_device_serialObject



45
46
47
# File 'lib/honeydew/honeydew.rb', line 45

def default_device_serial
  attached_devices.first
end

.devicesObject



66
67
68
# File 'lib/honeydew/honeydew.rb', line 66

def devices
  @devices
end

.using_device(serial, &block) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/honeydew/honeydew.rb', line 57

def using_device(serial, &block)
  original_device = current_device
  use_device(serial || Honeydew.default_device_serial).tap do |device|
    device.instance_eval(&block) if block_given?
  end
ensure
  @current_device = original_device
end