Class: Fourflusher::SimControl
- Inherits:
-
Object
- Object
- Fourflusher::SimControl
show all
- Extended by:
- Executable
- Defined in:
- lib/fourflusher/find.rb,
lib/fourflusher/simctl.rb,
lib/fourflusher/xcodebuild.rb
Overview
Instance Method Summary
collapse
Methods included from Executable
capture_command, executable, execute_command, which
Constructor Details
Returns a new instance of SimControl.
59
60
61
|
# File 'lib/fourflusher/find.rb', line 59
def initialize
@os_regex = /^-- (?<os_name>.*?) (?<os_version>[0-9].[0-9]) --$/
end
|
Instance Method Details
#destination(filter, minimum_version = '1.0') ⇒ Object
5
6
7
8
9
|
# File 'lib/fourflusher/xcodebuild.rb', line 5
def destination(filter, minimum_version = '1.0')
sim = simulator(filter, minimum_version)
raise "Simulator #{filter} is not available." if sim.nil?
['-destination', "id=#{sim.id}"]
end
|
#list(args) ⇒ Object
9
10
11
|
# File 'lib/fourflusher/simctl.rb', line 9
def list(args)
simctl!(['list'] + args)
end
|
#simulator(filter, minimum_version = '1.0') ⇒ Object
63
64
65
|
# File 'lib/fourflusher/find.rb', line 63
def simulator(filter, minimum_version = '1.0')
usable_simulators(filter, minimum_version).first
end
|
#usable_simulators(filter = nil, minimum_version = '1.0') ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/fourflusher/find.rb', line 67
def usable_simulators(filter = nil, minimum_version = '1.0')
os_name = ''
os_version = ''
sims = []
list(['devices']).lines.each do |line|
@os_regex.match(line) do |m|
os_name = m['os_name']
os_version = m['os_version']
end
sims += Simulator.match(line, os_name, os_version)
end
return sims if filter.nil?
minimum_version = Gem::Version.new(minimum_version)
sims.select { |sim| sim.name == filter && sim.compatible?(minimum_version) }
end
|