Skip to content

Commit

Permalink
Merge pull request #491 from calabash/release/2.1.4
Browse files Browse the repository at this point in the history
Release/2.1.4
  • Loading branch information
jmoody authored Jul 21, 2016
2 parents 63da76b + 7ccf4a4 commit 8c2f62a
Show file tree
Hide file tree
Showing 322 changed files with 1,577 additions and 628 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tmp
# The DeviceAgent binaries
lib/run_loop/device_agent/app/CBX-Runner.app
lib/run_loop/device_agent/ipa/CBX-Runner.app
lib/run_loop/device_agent/frameworks/Frameworks
lib/run_loop/device_agent/Frameworks

# RubyMine
.idea
Expand Down
46 changes: 32 additions & 14 deletions .irbrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require 'irb/ext/save-history'
require 'benchmark'
require 'run_loop'
require 'command_runner'
require "dnssd"

AwesomePrint.irb!

Expand Down Expand Up @@ -107,37 +108,54 @@ def delete_simulator(name)
true
end

if !ENV["CBXWS"]
moody = File.expand_path(File.join("~/", "git", "calabash", "xcuitest", "CBXDriver.xcworkspace"))
prometus = File.expand_path(File.join("~/", "calabash-xcuitest-server", "CBXDriver.xcworkspace"))

if File.directory?(moody)
ENV["CBXWS"] = moody
elsif File.directory?(prometus)
ENV["CBXWS"] = prometus
def cbx_launcher
device_agent_ws = ENV["CBXWS"]

if device_agent_ws == nil || device_agent_ws == ""
return :ios_device_manager
end
end

puts "XCUITest workspace = #{ENV["CBXWS"]}"
if device_agent_ws == "1"
path = File.expand_path(File.join("..", "DeviceAgent.iOS", "CBXDriver.xcworkspace"))
if File.exist?(path)
ENV["CBXWS"] = path
end
elsif device_agent_ws
if !File.exist?(device_agent_ws)
raise %Q[CBXWS defined as
#{device_agent_ws}
but that directory does not exist.
]
end
end
puts "XCUITest workspace = #{ENV["CBXWS"]}"
:xcodebuild
end

def xcuitest(bundle_id="com.apple.Preferences")
device = RunLoop::Device.detect_device({}, xcode, simctl, instruments)
cbx_launcher = RunLoop::DeviceAgent::Xcodebuild.new(device)
RunLoop::XCUITest.new(bundle_id, device, cbx_launcher)
end

def holmes(bundle_id="com.apple.Preferences")
def holmes(options={})
device = RunLoop::Device.detect_device({}, xcode, simctl, instruments)
options = {

default_options = {
:app => "com.apple.Preferences",
:device => device.udid,
:xcuitest => true,
:xcode => xcode,
:simctl => simctl,
:instruments => instruments,
:app => bundle_id,
:cbx_launcher => :xcodebuild
:cbx_launcher => cbx_launcher
}
RunLoop.run(options)

merged_options = default_options.merge(options)
RunLoop.run(merged_options)
end

verbose
Expand Down
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Force Xcode environment
language: objective-c

# Forces macOS 10.11
osx_image: xcode7.3

before_script:
- gem uninstall -Vax --force --no-abort-on-dependent run_loop
- scripts/ci/travis/instruments-auth.sh

script:
Expand All @@ -12,8 +15,8 @@ script:

rvm:
- 2.0.0
- 2.1.7
- 2.2.3
- 2.1.9
- 2.2.5

notifications:
email:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
## Change Log

### 2.1.4

* RunLoop.run detects and respects gesture performer key #490
* run-loop cache needs to provide DeviceAgent details #489
* Don't call ps in the context of xcrun #488
* DeviceAgent: update to iOS 10 and Xcode 8 compatible binaries #486
* Travis uses macOS 10.11 and Xcode 7.3 #485
* XCUITest can use iOSDeviceManager binary to launch CBX-Runner and AUT
#483
* Detecting and handling Xcode 8 and iOS 10 #482
* DetectAUT: increase search depth for AUT for Xamarin projects #481
* Rename exec methods in various classes #479
* XCUITest respects to DEVICE_AGENT_URL #477
* XCUITest: simplify the common gestures API #476
* XCUITest: support text entry #474

### 2.1.3

* Replace ~/ with Environment.user\_home\_directory #472
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

### Requirements

* Xcode 6 and 7.
* Xcode 7.
* ruby >= 2.0

The most recent versions of Xcode and ruby are strongly recommended.
Expand Down Expand Up @@ -52,6 +52,13 @@ At this time, there is no reason to update.

- [1] https://github.com/vaskas/udidetect/pull/3

## Building Device Agent Resources

It is your responsibility for checking the git branch.

```
$ rake device_agent:install
```

### Tests

Expand All @@ -70,9 +77,9 @@ $ be rake unit

#### Integration Tests

Take a break because these test launch and quit the simulator multiple times
which hijacks your machine. You have enough time to take some deep breaths
and do some stretching. You'll feel better afterward.
Take a break because these test launch and quit the simulator multiple
times. You have enough time to take some deep breaths and do some
stretching. You'll feel better afterward.

For continuous TDD/BDD see the Guard section below.

Expand Down
218 changes: 189 additions & 29 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,194 @@ begin
rescue LoadError => _
end

task :ctags do
sh 'rm -f .git/tags'
excluded = [
'--exclude=*.png',
'--exclude=.screenshots',
'--exclude=*screenshots*',
'--exclude=reports',
'--exclude=*.app',
'--exclude=*.dSYM',
'--exclude=*.ipa',
'--exclude=*.zip',
'--exclude=*.framework',
'--exclude=.irb-history',
'--exclude=.pry-history',
'--exclude=.idea',
'--exclude=*.plist',
'--exclude=.gitignore',
'--exclude=Gemfile.lock',
'--exclude=Gemfile',
'--exclude=docs',
'--exclude=*.md',
'--exclude=*.java',
'--exclude=*.xml',
'--exclude=.pryrc',
'--exclude=.irbrc',
'--exclude=.DS_Store'
]
cmd = "ctags --tag-relative -V -f .git/tags -R #{excluded.join(' ')} --languages=ruby lib/ spec/"
sh cmd
namespace :device_agent do

task :install => [:clean, :build]

def colorize(string, color)
"\033[#{color}m#{string}\033[0m"
end

def cyan(string)
colorize(string, 36)
end

def green(string)
colorize(string, 32)
end

def magenta(string)
colorize(string, 35)
end

def log_unix_cmd(msg)
puts cyan("EXEC: #{msg}") if msg
end

def log_info(msg)
puts green("INFO: #{msg}") if msg
end

def banner(msg)
puts ""
puts magenta("######## #{msg} ########")
puts ""
end

def device_agent_dir
@device_agent_dir ||= begin
dir = File.join(".", "lib", "run_loop", "device_agent")
File.expand_path(dir)
end
end

def frameworks_dir
@frameworks_dir ||= File.join(device_agent_dir, "Frameworks")
end

def frameworks_zip
@frameworks_zip ||= "#{frameworks_dir}.zip"
end

def app_dir
@app_dir ||= File.join(device_agent_dir, "app", "CBX-Runner.app")
end

def app_zip
@app_zip ||= "#{app_dir}.zip"
end

def ipa_dir
@ipa_dir ||= File.join(device_agent_dir, "ipa", "CBX-Runner.app")
end

def ipa_zip
@ipa_zip ||= "#{ipa_dir}.zip"
end

def bin
@bin ||= File.join(device_agent_dir, "bin", "iOSDeviceManager")
end

def rm_path(path)
log_info("Deleting #{path}")
FileUtils.rm_rf(path)
end

def expect_path_to_repo(name)
local = File.expand_path(File.join(".", name))
return local if File.exist?(local)

up_one = File.expand_path(File.join("..", name))
return up_one if File.exist?(up_one)

raise %Q[
Could not find repo #{name}. Checked these two directories:
#{local}
#{up_one}
To specify a non-standard location for these repositories, use:
* FBSIMCONTROL_PATH=path/to/FBSimulatorControl
* DEVICEAGENT_PATH=path/to/DeviceAgent.iOS
* IOS_DEVICE_MANAGER=path/to/iOSDeviceManager
]
end

def fbsimctl
path = ENV["FBSIMCTL"] || expect_path_to_repo("FBSimulatorControl")
log_info "Using FBSIMCONTROL_PATH=#{path}"
path
end

def device_agent
path = ENV["DEVICE_AGENT"] || expect_path_to_repo("DeviceAgent.iOS")
log_info "Using DEVICEAGENT_PATH=#{path}"
path
end

def ios_device_manager
path = ENV["IOS_DEVICE_MANAGER"] || expect_path_to_repo("iOSDeviceManager")
log_info "Using iOSDeviceManager=#{path}"
path
end

def ditto(source, target)
args = ["ditto", source, target]

log_unix_cmd("xcrun #{args.join(" ")}")

result = system("xcrun", *args)
if !result
raise %Q[Could not copy
source = #{source}
target = #{target}
]
else
end
end

def ditto_zip(source, target)
args = ["ditto", "-ck", "--rsrc", "--sequesterRsrc", "--keepParent",
source, target]

log_unix_cmd("xcrun #{args.join(" ")}")

result = system("xcrun", *args)
if !result
raise %Q[Could not zip:
source = #{source}
target = #{target}
]
end
end

task :build do
banner("Building")

# Memoize base target directory
device_agent_dir

env = {"DEVICEAGENT_PATH" => device_agent,
"FBSIMCONTROL_PATH" => fbsimctl}
Dir.chdir(ios_device_manager) do
result = system(env, "make", "dependencies")
if !result
raise "Could not build DeviceAgent dependencies."
end

banner("Installing to run_loop")

Dir.chdir(File.join("Distribution", "dependencies")) do
ditto(File.join("bin", "iOSDeviceManager"), bin)
log_info("Installed #{bin}")
ditto_zip("Frameworks", frameworks_zip)
log_info("Installed #{frameworks_zip}")
ditto_zip(File.join("app", "CBX-Runner.app"), app_zip)
log_info("Installed #{app_zip}")
ditto_zip(File.join("ipa", "CBX-Runner.app"), ipa_zip)
log_info("Installed #{ipa_zip}")
end
end
end

task :clean do
banner("Cleaning")
rm_path(frameworks_dir)
rm_path(app_dir)
rm_path(ipa_dir)
rm_path(frameworks_zip)
rm_path(app_zip)
rm_path(ipa_dir)
rm_path(bin)
end

task :uninstall do
banner("Uninstalling")
rm_path(frameworks_dir)
rm_path(app_dir)
rm_path(ipa_dir)
end
end

Loading

0 comments on commit 8c2f62a

Please sign in to comment.