moredip/Sim-Launcher — pull request #22 by mgrebenets (2013-10-18 01:04:53+00:00)
Title: All options

Hi.

I really wanted sim_launcher to support more command line options of ios-sim, especially options like `:retina`, `:tall` and `:env`.
I am aware of https://github.com/moredip/Sim-Launcher/pull/16 pull request, but it has too many changes for me to grasp, also deals with things like Frank, Sinatra and so on. And it's been there for quite a while as well, with no progress.

So I tried to come up with minimum changes required to support more ios-sim options.

I also kept the public API unchanged (`launch_ios_app`) so it's backwards compatible.

The `start_simulator`, `launch_ipad_app`, `launch_ipad_app_with_name`, `launch_iphone_app`, `launch_iphone_app_with_name` are backwards compatible as well. They do have new arguments, but these arguments have default values, so it won't break existing code.

The new public API is `launch_ios_app_with_options`, it's almost same as `launch_ios_app` with addition of one new argument `options`. This options hash can be used to pass any command line option that ios-sim supports.
Here are some examples
``` ruby
s = SimLauncher::Simulator.new
# iPad retina, SDK 6.1, load environment variables from env.plist
options = { :retina => nil, :env => "env.plist" }
s.start_simulator("6.1", "ipad", options)
# iPhone tall retina (4-inch), SDK 7.0, set environment variables 'dev' and 'reset' to true
options = { :retina => nil, :tall => nil, :setenv => "dev=true", :setenv => "reset=true" }
s.start_simulator("7.0", "iphone", options)
# Start with no options (backwards compatibility)
s.start_simulator("7.0", "iphone")
```

I know that `:retina => nil` might be a bit confusing, I'd welcome any suggestions on this one.

This is pretty much all the change.

The differences look big because of the comments added to document the code.
You can now run `yardoc .` and get 100% code documented.

Finally, I was confused by mixed styling in the code.
Some places use spaces around operands, some don't.
Some pieces of code put spaces around `(` and `)`, others don't.
So followed https://github.com/bbatsov/ruby-style-guide and https://github.com/styleguide/ruby to make the code consistent, but after all that's just cosmetic change.