Skip to content

Commit

Permalink
Make constants less horrible.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhgills committed May 20, 2013
1 parent 5fd923a commit d4c758a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/sim_launcher/client.rb
Expand Up @@ -16,11 +16,11 @@ def initialize( app_path, options = {} )
end

def self.for_ipad_app( app_path, sdk = nil )
self.new( app_path, :sdk => sdk, :device => DeviceType::iPad )
self.new( app_path, :sdk => sdk, :device => DeviceType::Pad )
end

def self.for_iphone_app( app_path, sdk = nil )
self.new( app_path, :sdk => sdk, :device => DeviceType::iPhone )
self.new( app_path, :sdk => sdk, :device => DeviceType::Phone )
end

def server_uri=(uri)
Expand Down
4 changes: 2 additions & 2 deletions lib/sim_launcher/direct_client.rb
Expand Up @@ -10,11 +10,11 @@ def initialize( app_path, options = {} )
end

def self.for_ipad_app( app_path, sdk = nil )
self.new( app_path, :sdk => sdk, :device => DeviceType::iPad )
self.new( app_path, :sdk => sdk, :device => DeviceType::Pad )
end

def self.for_iphone_app( app_path, sdk = nil )
self.new( app_path, :sdk => sdk, :device => DeviceType::iPhone )
self.new( app_path, :sdk => sdk, :device => DeviceType::Phone )
end

def launch
Expand Down
30 changes: 15 additions & 15 deletions lib/sim_launcher/simulator.rb
@@ -1,21 +1,21 @@
module SimLauncher

module DeviceType
IPHONE = 'iphone'
RETINA_3_5_INCH_IPHONE = 'retina iphone (3.5 inch)'
RETINA_4_INCH_IPHONE = 'retina iphone (4 inch)'
Phone = 'iphone'
PhoneRetina3_5Inch = 'retina iphone (3.5 inch)'
PhoneRetina4Inch = 'retina iphone (4 inch)'

IPAD = 'ipad'
RETINA_IPAD = 'retina ipad'
Pad = 'ipad'
PadRetina = 'retina ipad'

IPHONE_DEVICES = [IPHONE, RETINA_3_5_INCH_IPHONE, RETINA_4_INCH_IPHONE]
IPAD_DEVICES = [IPAD, RETINA_IPAD]
RETINA_DEVICES = [RETINA_3_5_INCH_IPHONE, RETINA_4_INCH_IPHONE, RETINA_IPAD]
PhoneDevices = [Phone, PhoneRetina3_5Inch, PhoneRetina4Inch]
PadDevices = [Pad, PadRetina]
RetinaDevices = [PhoneRetina3_5Inch, PhoneRetina4Inch, PadRetina]
end

module DeviceFamily
IPHONE = 'iphone'
IPAD = 'ipad'
Phone = 'iphone'
Pad = 'ipad'
end

class Simulator
Expand Down Expand Up @@ -83,10 +83,10 @@ def launch_ios_app( app_path, options = {} )
def args_to_select_device( device )
args = ['--family', family_for_device(device)]

if DeviceType::RETINA_DEVICES.include? device
if DeviceType::RetinaDevices.include? device
args = args + ['--retina']

if device == DeviceType::RETINA_4_INCH_IPHONE
if device == DeviceType::PhoneRetina4Inch
args = args + ['--tall']
end
end
Expand All @@ -95,10 +95,10 @@ def args_to_select_device( device )
end

def family_for_device( device )
if DeviceType::IPHONE_DEVICES.include? device
DeviceFamily::IPHONE
if DeviceType::PhoneDevices.include? device
DeviceFamily::Phone
else
DeviceFamily::IPAD
DeviceFamily::Pad
end
end

Expand Down

0 comments on commit d4c758a

Please sign in to comment.