GithubHelp home page GithubHelp logo

simulator's Introduction

simulator - simctl beautifier

Xcode 6 ships with a nifty little utility called simctl that allows easy management of simulators. It even lets you give them nice, readable names like "iOS7 iPad" when creating them! It does not however, let you reference them by those names for other commands. This means that scripting is hard because you must know or parse out the identifier for the simulator you want to target, instead of being able to refer to it by a consistent name. simulator wraps simctl and extends it just a bit to make it easier to work with.

Use cases

Originally inspired by trying to create a test script that every dev could run without modifying. In order to do that with simctl, you'd need to know the UDID which would be different on each machine.

For the original case, I scripted creating 2 simulators ZTestsimulator81, ZTestSimulator71, to run tests cleanly from the command line without running the risk of clearing a developers current development data.

I created this wrapper after realizing that identifying and managing simulators by name would make any scripting task easier.

Install

Homebrew

brew tap davelyon/tap
brew install simulator

Other Options

Open to suggestions, but possibly the easiest is just to clone the repo and ensure that the directory ends up in your PATH

Examples:

simulator create "My Test Simulator" iPhone-5s iOS-8-2 
# A9F00BFD-66D5-4E78-8E18-C08DC3772C28

simulator list
# == Devices ==
# -- iOS 8.2 --
# iPhone 4s           	 (4183E129-01F2-47C4-941C-E7DE6AB69F5F) (Shutdown)
# iPhone 5            	 (9547A985-3409-48B0-94AF-2C9639DE76ED) (Shutdown)
# iPhone 5s           	 (BEC8FB3E-475D-49DC-9119-3CF007F574E7) (Shutdown)
# My Test Simulator   	 (A9F00BFD-66D5-4E78-8E18-C08DC3772C28) (Shutdown)

simulator reset "My Test Simulator"
simulator destroy "My Test Simulator" 

simulator's People

Contributors

davelyon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jpaolantonio

simulator's Issues

Add support for handling issues with `reset`

The idea for this project started from trying to reliably script "resetting" a simulator for testing purposes. Some issues exist however:

  1. If the simulator is "booted" it can't be reset, and you'll get an error
  2. If the simulator doesn't exist, it can't be cleared either
  3. Other unexpected errors may occur

Some other concerns:

Stopping a "booted" simulator may require a hard killall iOS Simulator to be 'reliable' which may lead to other issues in the long term. In a CI environment, if we can assume that only one task can run with the simulator at a time, these are easier to handle (assume that we're the one task).

I'm considering something like:

$ simulator reset "ZTestSimulator"
Unable to reset simulator while booted. (Exit 1)
$ simulator  reset -f "ZTestSimulator"
Stopping simulator ZTestSimulator
Reset ZTestSimulator "4183E129-01F2-47C4-941C-E7DE6AB69F5F"

# No simulator exists by that name/device/sdk
$ simulator prepare "ZTestSimulator" iPhone-5s iOS-8-2
Creating ZTestSimulator [iPhone 5S] [iOS 8.2]

# Simulator exists
$ simulator prepare "ZTestSimulator" iPhone-5s iOS-8-2
Resetting ZTestSimulator [iPhone 5S] [iOS 8.2]

# Simulator exists and is booted
$ simulator prepare "ZTestSimulator" iPhone-5s iOS-8-2
Unable to reset ZTestSimulator [iPhone 5S] [iOS 8.2] (Exit 1)

$ simulator prepare -f "ZTestSimulator" iPhone-5s iOS-8-2
Stopping simulator ZTestSimulator
Resetting ZTestSimulator [iPhone 5S] [iOS 8.2]

Add command to import/export a list of simulators

To help with keeping development environments consistent for developers on a team, it would be nice to be able to script the creation of a set of simulators. Perhaps that would look like:

$ simulator import project/.simulators
Importing list of expected simulators...
Creating iPhone 4s Simulator [iPhone 4s] [iOS 7.1]
Found iPhone 5 Simulator [iPhone 5] [iOS 7.1]
...

$ simulator export project/.simulators
Exporting all simulators

The file might look like:

iPhone 4s Simulator,iPhone-4s,iOS-7-1
iPhone 5 Simulator,iPhone-5s,iOS-7-1
ZTestSimulator-8-2,iPhone-6,iOS-8-2
ZTestSimulator-7-1,iPhone-5s,iOS-7-1

It might be simplest to use CSV, with columns: Name, Device, Runtime -- though it could be nicer to read if it were more concise or grouped by SDK somehow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.