Skip to content

Commit

Permalink
Merge pull request #18 from fulldecent/master
Browse files Browse the repository at this point in the history
Prepare for itc-localized-screenshot-uploader integration
  • Loading branch information
jonathanpenn committed Jan 8, 2014
2 parents e9bff96 + 69c41b3 commit 9934bf3
Show file tree
Hide file tree
Showing 30 changed files with 104 additions and 52 deletions.
Expand Up @@ -23,14 +23,14 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
AB84220C162B03A700DE1074 /* UI ScreenShooter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "UI ScreenShooter.app"; sourceTree = BUILT_PRODUCTS_DIR; };
AB84220C162B03A700DE1074 /* Hello World International.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Hello World International.app"; sourceTree = BUILT_PRODUCTS_DIR; };
AB842210162B03A700DE1074 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
AB842212162B03A700DE1074 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
AB842214162B03A700DE1074 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
AB842218162B03A700DE1074 /* UI ScreenShooter-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UI ScreenShooter-Info.plist"; sourceTree = "<group>"; };
AB842218162B03A700DE1074 /* Hello World International-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Hello World International-Info.plist"; sourceTree = "<group>"; };
AB84221A162B03A700DE1074 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
AB84221C162B03A700DE1074 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
AB84221E162B03A700DE1074 /* UI ScreenShooter-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UI ScreenShooter-Prefix.pch"; sourceTree = "<group>"; };
AB84221E162B03A700DE1074 /* Hello World International-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Hello World International-Prefix.pch"; sourceTree = "<group>"; };
AB84221F162B03A700DE1074 /* NLAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NLAppDelegate.h; sourceTree = "<group>"; };
AB842220162B03A700DE1074 /* NLAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NLAppDelegate.m; sourceTree = "<group>"; };
AB842222162B03A700DE1074 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
Expand Down Expand Up @@ -65,7 +65,7 @@
AB842201162B03A700DE1074 = {
isa = PBXGroup;
children = (
AB842216162B03A700DE1074 /* UI ScreenShooter */,
AB842216162B03A700DE1074 /* Hello World International */,
AB84220F162B03A700DE1074 /* Frameworks */,
AB84220D162B03A700DE1074 /* Products */,
);
Expand All @@ -74,7 +74,7 @@
AB84220D162B03A700DE1074 /* Products */ = {
isa = PBXGroup;
children = (
AB84220C162B03A700DE1074 /* UI ScreenShooter.app */,
AB84220C162B03A700DE1074 /* Hello World International.app */,
);
name = Products;
sourceTree = "<group>";
Expand All @@ -89,7 +89,7 @@
name = Frameworks;
sourceTree = "<group>";
};
AB842216162B03A700DE1074 /* UI ScreenShooter */ = {
AB842216162B03A700DE1074 /* Hello World International */ = {
isa = PBXGroup;
children = (
AB84221F162B03A700DE1074 /* NLAppDelegate.h */,
Expand All @@ -101,17 +101,17 @@
AB84222F162B03A700DE1074 /* NLLanguageViewController.m */,
AB842217162B03A700DE1074 /* Supporting Files */,
);
path = "UI ScreenShooter";
path = "Hello World International";
sourceTree = "<group>";
};
AB842217162B03A700DE1074 /* Supporting Files */ = {
isa = PBXGroup;
children = (
AB842236162B071800DE1074 /* Localizable.strings */,
AB842218162B03A700DE1074 /* UI ScreenShooter-Info.plist */,
AB842218162B03A700DE1074 /* Hello World International-Info.plist */,
AB842219162B03A700DE1074 /* InfoPlist.strings */,
AB84221C162B03A700DE1074 /* main.m */,
AB84221E162B03A700DE1074 /* UI ScreenShooter-Prefix.pch */,
AB84221E162B03A700DE1074 /* Hello World International-Prefix.pch */,
AB842222162B03A700DE1074 /* Default.png */,
AB842224162B03A700DE1074 /* Default@2x.png */,
AB842226162B03A700DE1074 /* Default-568h@2x.png */,
Expand All @@ -122,9 +122,9 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
AB84220B162B03A700DE1074 /* UI ScreenShooter */ = {
AB84220B162B03A700DE1074 /* Hello World International */ = {
isa = PBXNativeTarget;
buildConfigurationList = AB842233162B03A700DE1074 /* Build configuration list for PBXNativeTarget "UI ScreenShooter" */;
buildConfigurationList = AB842233162B03A700DE1074 /* Build configuration list for PBXNativeTarget "Hello World International" */;
buildPhases = (
AB842208162B03A700DE1074 /* Sources */,
AB842209162B03A700DE1074 /* Frameworks */,
Expand All @@ -134,9 +134,9 @@
);
dependencies = (
);
name = "UI ScreenShooter";
productName = "UI ScreenShooter";
productReference = AB84220C162B03A700DE1074 /* UI ScreenShooter.app */;
name = "Hello World International";
productName = "Hello World International";
productReference = AB84220C162B03A700DE1074 /* Hello World International.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand All @@ -149,7 +149,7 @@
LastUpgradeCheck = 0450;
ORGANIZATIONNAME = "Cocoa Manifest";
};
buildConfigurationList = AB842206162B03A700DE1074 /* Build configuration list for PBXProject "UI ScreenShooter" */;
buildConfigurationList = AB842206162B03A700DE1074 /* Build configuration list for PBXProject "Hello World International" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
Expand All @@ -164,7 +164,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
AB84220B162B03A700DE1074 /* UI ScreenShooter */,
AB84220B162B03A700DE1074 /* Hello World International */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -285,9 +285,9 @@
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UI ScreenShooter/UI ScreenShooter-Prefix.pch";
INFOPLIST_FILE = "UI ScreenShooter/UI ScreenShooter-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
GCC_PREFIX_HEADER = "Hello World International/Hello World International-Prefix.pch";
INFOPLIST_FILE = "Hello World International/Hello World International-Info.plist";
PRODUCT_NAME = "Hello World International";
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand All @@ -296,17 +296,17 @@
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UI ScreenShooter/UI ScreenShooter-Prefix.pch";
INFOPLIST_FILE = "UI ScreenShooter/UI ScreenShooter-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
GCC_PREFIX_HEADER = "Hello World International/Hello World International-Prefix.pch";
INFOPLIST_FILE = "Hello World International/Hello World International-Info.plist";
PRODUCT_NAME = "Hello World International";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
AB842206162B03A700DE1074 /* Build configuration list for PBXProject "UI ScreenShooter" */ = {
AB842206162B03A700DE1074 /* Build configuration list for PBXProject "Hello World International" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AB842231162B03A700DE1074 /* Debug */,
Expand All @@ -315,7 +315,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
AB842233162B03A700DE1074 /* Build configuration list for PBXNativeTarget "UI ScreenShooter" */ = {
AB842233162B03A700DE1074 /* Build configuration list for PBXNativeTarget "Hello World International" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AB842234162B03A700DE1074 /* Debug */,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>E5A6DD7B-7356-4917-9702-DEDDE1A0266D</string>
<key>IDESourceControlProjectName</key>
<string>Hello World International</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>2F565D56-8E03-4AA5-A2E8-3618FE55F855</key>
<string>ssh://github.com/fulldecent/ui-screen-shooter.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>Hello World International.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>2F565D56-8E03-4AA5-A2E8-3618FE55F855</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>ssh://github.com/fulldecent/ui-screen-shooter.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>2F565D56-8E03-4AA5-A2E8-3618FE55F855</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>2F565D56-8E03-4AA5-A2E8-3618FE55F855</string>
<key>IDESourceControlWCCName</key>
<string>ui-screen-shooter-FD</string>
</dict>
</array>
</dict>
</plist>
File renamed without changes
File renamed without changes
File renamed without changes
@@ -1,5 +1,5 @@
//
// Prefix header for all source files of the 'UI ScreenShooter' target in the 'UI ScreenShooter' project
// Prefix header for all source files of the 'Hello World International' target in the 'Hello World International' project
//

#import <Availability.h>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
//
// main.m
// UI ScreenShooter
// Hello World International
//
// Created by Jonathan Penn on 10/14/12.
// Copyright (c) 2012 Cocoa Manifest. All rights reserved.
Expand Down
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -7,13 +7,13 @@ You can see the script run against one of [my apps](http://readmoreapp.com) in [

[readmorevid]: http://nl1551.s3.amazonaws.com/cocoamanifest.net/2012/readmore-screenshots.mov

## Installation
## Prerequesites

First, you need to get Xcode from the App Store. It's free and comes with (almost) everything you need. Once you have Xcode installed, you need to install the command line tools. Choose "Preferences" from the "Xcode" menu. Choose the "Downloads" and choose the "Components" sub tab. You'll see "Command Line Tools" in the list. Click the install button next to it and wait until it finishes setting up.

Pull down this repository and change to the directory in the terminal.

## Usage
## Demonstration

To run the demonstration, type `./run_screenshooter.sh ~/Desktop/screenshots` to tell it where to put the final set of screen shots. After a few minutes, you can open the destination directory and see all the languages, devices types and screen sizes as PNGs.

Expand All @@ -23,6 +23,10 @@ By default each screenshot is named like so:

The first part is the locale identifier, the second is the device (iphone, iphone5, ipad), the third is the device orientation, and the fourth is an identifier that you choose for each screen shot when you call `captureLocalizedScreenshot()`.

## Usage

To use UI Screen Shooter, copy the files (except the Hello World sample app) next to your project files. You may need to change the "Release" build configuration to add i386 to the VALID_ARCHITECTURES for this to work. Then play with the script `automation/shoot_the_screens.js` to simulate the user interaction you want. ((CONTRIBUTORS, PLEASE HELP EXPAND THIS SECTION WITH YOUR INTEGRATION ADVICE.))

## How It Works

`run_screenshooter.sh` triggers a build of the application for the iOS simulator and puts the resulting bundle in `/tmp` with a custom name so it can find it. Then, the `instruments` command line tool is invoked which installs the app bundle and then executes `automation/shoot_the_screens.js` which drives the simulator. `shoot_the_screens.js` drives the app and calls `captureLocalizedScreenshot()` to shoot each image after navigating to the right screen.
Expand Down
2 changes: 1 addition & 1 deletion bin/choose_sim_device
Expand Up @@ -39,7 +39,7 @@ on run argv
set iosVersion to item 2 of argv

set xcodePath to do shell script "xcode-select -p"
activate application (xcodePath & "Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator")
activate application (xcodePath & "/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator")
tell application "System Events"
tell process "iOS Simulator"
tell menu bar 1
Expand Down
51 changes: 29 additions & 22 deletions run_screenshooter.sh → ui-screen-shooter.sh
Expand Up @@ -32,6 +32,9 @@ languages="en_US fr ja"
# The iOS version we want to run the script against
ios_version="7.0"

# The iOS devices we want to run, can include: iphone4 iphone5 ipad
ios_devices="iphone4 iphone5 ipad"

function main {
_check_destination

Expand All @@ -41,25 +44,29 @@ function main {
original_language=$(bin/choose_sim_language)
echo "Saving original language $original_language..."

# We have to build and explicitly set the device family to iPhone because
# otherwise Instruments will always try to launch a universal app on the iPad
# simulator.
#
# If your app isn't universal and only on iPhone or iPad, then you can remove
# the parts that don't matter for you.
_xcode clean build TARGETED_DEVICE_FAMILY=1
bin/choose_sim_device "iPhone Retina (3.5-inch)" $ios_version
_shoot_screens_for_all_languages

bin/choose_sim_device "iPhone Retina (4-inch)" $ios_version
_shoot_screens_for_all_languages

# We have to build again with the iPad device family because otherwise
# Instruments will only launch the app as we built it before, for the iPhone
# simulator.
_xcode build TARGETED_DEVICE_FAMILY=2
bin/choose_sim_device "iPad Retina" $ios_version
_shoot_screens_for_all_languages
# We have to build and explicitly set the device family because otherwise
# Instruments will always launch a universal app on the iPad simulator.

if [[ "$ios_devices" == *iphone* ]]
then
_xcode clean build TARGETED_DEVICE_FAMILY=1
if [[ "$ios_devices" == *iphone4* ]]
then
bin/choose_sim_device "iPhone Retina (3.5-inch)" $ios_version
_shoot_screens_for_all_languages
fi
if [[ "$ios_devices" == *iphone5* ]]
then
bin/choose_sim_device "iPhone Retina (4-inch)" $ios_version
_shoot_screens_for_all_languages
fi
fi
if [[ "$ios_devices" == *ipad* ]]
then
_xcode build TARGETED_DEVICE_FAMILY=2
bin/choose_sim_device "iPad Retina" $ios_version
_shoot_screens_for_all_languages
fi

bin/close_sim

Expand All @@ -80,9 +87,9 @@ function _check_destination {
# Abort if the destination directory already exists. Better safe than sorry.

if [ -z "$destination" ]; then
echo "usage: run_screenshooter.sh destination_directory"
exit 1
elif [ -d "$destination" ]; then
destination="$HOME/Desktop/screenshots"
fi
if [ -d "$destination" ]; then
echo "Destination directory \"$destination\" already exists! Aborting."
exit 1
fi
Expand Down

0 comments on commit 9934bf3

Please sign in to comment.