Skip to content

Instantly share code, notes, and snippets.

@mabdi
Last active May 28, 2020 13:57
Show Gist options
  • Save mabdi/54634327ac408dfce7420ac889556e45 to your computer and use it in GitHub Desktop.
Save mabdi/54634327ac408dfce7420ac889556e45 to your computer and use it in GitHub Desktop.
| sendPush appId appAuthKey pushProc search packages testPackages tests targetedTests|
appId := 'TODO'.
appAuthKey := 'TODO'.
sendPush := [ :msg | |entity|
entity := STONJSON
toString:
{('app_id' -> appId).
('included_segments' -> #(All)).
('contents' -> {('en' -> msg)} asDictionary)} asDictionary.
ZnClient new
url: 'https://onesignal.com/api/v1/notifications';
headerAt: 'Authorization' put: 'Basic ' , appAuthKey;
headerAt: 'Content-Type' put: 'application/json; charset=utf-8';
entity: (ZnEntity with: entity type: ZnMimeType applicationJson);
post;
response
].
pushProc := [
1 to: 100 do: [:i | 10 minutes wait. sendPush value: 'Still running '. ]
] newProcess.
pushProc priority: Processor userInterruptPriority.
pushProc name: 'pushProc'.
pushProc resume.
[targetedTests := (((FileLocator imageDirectory / 'todo.txt') readStream upToEnd splitOn: Character lf) reject: #isEmpty) collect: #asClass.
targetedTests
do: [ :t |
SmallAmp initializeDefault
testCase: t;
amplifyEval ]
displayingProgress: [ :t | 'Amplifying ' , t name ].
pushProc terminate.
sendPush value: 'finished: ', search] on: Error do: [:x | pushProc terminate. sendPush value: 'error: ', x description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment