[WatchKit] Be sure to find right extension and fail if there is none.

This commit is contained in:
Eloy Durán
2014-12-11 20:26:21 +01:00
parent 89c8b4d2cb
commit 5e8f8ffae2

View File

@@ -79,6 +79,15 @@ end
namespace :watch do
desc "Run the Watch application on the simulator"
task :simulator do
watch_extension = App.config.targets.find do |target|
File.exist?(File.join(target.path, 'watch_app'))
end
unless watch_extension
App.fail 'You can only use this task with a WatchKit application ' \
'configured. To configure one use ' \
'`app.target "path/to/MyWatchApp", :extension`.'
end
if ENV['type'] && ENV['type'].downcase == 'notification' && ENV['payload'].nil?
App.fail 'The `payload=path/to/payload.json` option is required with `type=notification`.'
end
@@ -86,8 +95,7 @@ namespace :watch do
unless ENV["skip_build"]
Rake::Task["build:simulator"].invoke
end
# TODO need a way to identify a watch extension from other extensions
watch_extension = App.config.targets.first
app = App.config.app_bundle('iPhoneSimulator')
sim = File.join(App.config.bindir, 'watch-sim')