Guest User

Untitled

a guest
Jun 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. println ">>> Initialising ${args[0]}"
  2.  
  3. def script = new GroovyShell().parse(new File(args[0]))
  4.  
  5. Integer.metaClass.loop = {
  6. int loops = 0
  7. while (true) {
  8. def res = it(loops++)
  9. if (res && loops < delegate) {
  10. Thread.sleep(res)
  11. }
  12. else break
  13. }
  14. }
  15.  
  16. def emc = new ExpandoMetaClass(Script.class)
  17. emc.running = true
  18. emc.loop = {
  19. int loops = 0
  20. while (running) {
  21. def res = it(loops++)
  22. if (res) {
  23. Thread.sleep(res)
  24. }
  25. else break
  26. }
  27. }
  28. emc.initialize()
  29.  
  30. script.metaClass = emc
  31.  
  32. script.run()
  33.  
  34. println ">>> Running ${script.name}"
  35. println script.description
  36.  
  37. script.script.call()
Add Comment
Please, Sign In to add comment