README.md in snapshot-0.2.4 vs README.md in snapshot-0.3.0

- old
+ new

@@ -165,16 +165,18 @@ ### Scheme To not be asked which scheme to use, just set it like this: ```ruby scheme "Name" ``` +You can also use the environment variable ```SNAPSHOT_SCHEME```. ### Screenshots output path All generated screenshots will be stored in the given path. ```ruby screenshots_path './screenshots' ``` +You can also use the environment variable ```SNAPSHOT_SCREENSHOTS_PATH```. ### Project Path By default, ```snapshot``` will look for your project in the current directory. If it is located somewhere else, pass your custom path: ```ruby project_path "./my_project/Project.xcworkspace" @@ -196,9 +198,40 @@ ### Custom Build Command If for some reason, the default build command does not work for your project, you can pass your own build script. The script will be executed **once** before the tests are being run. **Make sure** you are setting the output path to ```/tmp/snapshot```. +```ruby +build_command "xcodebuild DSTROOT='/tmp/snapshot' OBJROOT='/tmp/snapshot' SYMROOT='/tmp/snapshot' ... " +``` + +### Custom callbacks to prepare your app +Run your own script when ```snapshot``` switches the simulator type or the language. +This can be used to +- Logout the user +- Reset all user defaults +- Pre-fill the database + +To run a shell script, just use ```system('./script.sh')```. +```ruby +setup_for_device_change do |device| + puts "Preparing device: #{device}" +end + +setup_for_language_change do |lang, device| + puts "Running #{lang} on #{device}" + system("./popuplateDatabase.sh") +end + +teardown_language do |lang, device| + puts "Finished with #{lang} on #{device}" +end + +teardown_device do |device| + puts "Cleaning device #{device}" + system("./cleanup.sh") +end +``` # Tips ## Available language codes ```ruby ["da-DK", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi-FI", "fr-CA", "fr-FR", "id-ID", "it-IT", "ja-JP", "ko-KR", "ms-MY", "nl-NL", "no-NO", "pt-BR", "pt-PT", "ru-RU", "sv-SE", "th-TH", "tr-TR", "vi-VI", "cmn-Hans", "zh_CN", "cmn-Hant"]