Module: SimCtl::Command::Push
- Included in:
- SimCtl::Command
- Defined in:
- lib/simctl/command/push.rb
Instance Method Summary collapse
-
#push(device, bundle, payload) ⇒ void
Send some push notification.
Instance Method Details
#push(device, bundle, payload) ⇒ void
This method returns an undefined value.
Send some push notification
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/simctl/command/push.rb', line 15 def push(device, bundle, payload) unless Xcode::Version.gte? '11.4' raise UnsupportedCommandError, 'Needs at least Xcode 11.4' end file = Tempfile.new('push') if payload.is_a?(Hash) JSON.dump payload, file file.close elsif payload.is_a?(String) && File.exist?(payload) file.close FileUtils.cp payload, file.path else file.write payload file.close end Executor.execute(command_for('push', device.udid, bundle, file.path)) end |