crono 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/crono/cli.rb +1 -1
  3. data/lib/crono/job.rb +2 -2
  4. data/lib/crono/performer_proxy.rb +5 -4
  5. data/lib/crono/version.rb +1 -1
  6. data/spec/cli_spec.rb +3 -2
  7. data/spec/internal/db/crono_test.sqlite +0 -0
  8. data/spec/internal/log/test.log +2417 -0
  9. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/-3/-39xcDaxqOfT5_YbKGMC2VoOLHUFg1gyuxeTL-Eup7k.cache +0 -0
  10. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/1I/1IjQIP_VOqgJXKhZpmU6BzJwwAQQ13eyxAePeBRHXEg.cache +2 -0
  11. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/1b/1bH_3dMMKuACfI0TmmCeyB8zoKIiuiZsSSP6HhRXLbA.cache +3 -0
  12. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/2s/2sJPeHyInPjaKqPfsEWbBdNYaCzFtvcr5nk8VlQjHvY.cache +0 -0
  13. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/47/479UaX78ImQpq18DwAHbpTAKCQcaS_g9kEFwudRxxC8.cache +1 -0
  14. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/7H/7H6n_CYmS-913TL8a3U1alFRI5CWy18J8jnwdLL_Gro.cache +1 -0
  15. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/8b/8bJ6EwvIAjMXaNe9Ic4zq8rauZNb-xiW27gp1sQAY44.cache +1 -0
  16. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/B1/B1NZJ5pbmAf6UeZz0obPpXJm4h-n3_qQvYyzru-IRXM.cache +2 -0
  17. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Bi/BicUSIwup1Ebl9N94HOoznAu2a8p4LqqIf0swCsboJk.cache +1 -0
  18. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/CT/CTH9PjxIhN-xu3gPlv5Xo1d1AFJOX0ETdUqvh74MZN4.cache +0 -0
  19. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Cj/Cjzu7j1PyqHJD0alH5TiAYfJDN0Zbxhg4zFZegEzuYM.cache +0 -0
  20. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/EF/EF9qrwbJ3DwrJmsImyKeW0iiA0yZ-AZ1IbNlYGuXnVs.cache +1 -0
  21. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Fi/FiX3vL70mZzXvdq98JwHM3hMmVjpV20ZRiPFXhrEw3A.cache +3 -0
  22. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/GW/GWdxGb7VI1UP5TTDis3jju2Ep7-oqCWjNmRUDRTfgNI.cache +0 -0
  23. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/LE/lEMT8eCBeJXLWA8GKsOLOQBRrEa21XylM_E5JCr4rgg.cache +1 -0
  24. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/LH/LHh7k1JlS1aIHCbv5fHLGjrvmMHH_Jz88vymBMjoCGk.cache +0 -0
  25. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/M2/M27EDDKK6_tC_Usl58dui_-zmw7oDqmzrrdQSIQY14Y.cache +1 -0
  26. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/M3/M34sNs1L2xLkDoLgxPZpTl1b_2gnlNorXfetzSSNFzQ.cache +0 -0
  27. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/MK/MKsj2fh8ePsAqeFVg9gjrj5TFKHFMhkpv3847HEtRCQ.cache +1 -0
  28. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/ML/MLV0jF0Mx0KJXC8UlPpWgJnHnCDmoZGYwvIY8iCScUo.cache +2 -0
  29. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/MM/MM4lzeaS_hxItA00rs1BMB2FiTSDW11M9YXnPe-tTis.cache +0 -0
  30. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Ng/Ng6PnQ3Vuj0_W2vnfOllxbQzYvtwYSP-2fJkIBNIQp4.cache +3 -0
  31. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Np/NpFyXvvOaE4AgXrrlhA8mGz0Zu3wiafGirgwSdbZdxM.cache +0 -0
  32. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Nv/NvbZ3Hlpr70GgSBXU-Zu8vuInq35MP6A63TQASVMfr8.cache +2 -0
  33. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/O6/O6ubwnCL6c5Yy8zI3admUI6VD1-5gDM8cbdeT2iBZ_Y.cache +2 -0
  34. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/OH/OHcmhT_tBVMS3zWpgTX93KyKUXBtbWDJsoFzXiYnhVc.cache +3 -0
  35. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Rq/RqtRjsxCy4uH845AVedRm0uhgG7RXL11Z72EYSDplIs.cache +1 -0
  36. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Rw/RwnfCAubyGSPbqkRrfgNdC6gRBBVWkqYUodv_-hpQ7w.cache +0 -0
  37. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/VY/VYQF15XEQNHgoXSorUWaNjqn-HSfupp3CZtdyCL7ymU.cache +0 -0
  38. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Vw/VwDJ5qrChK2CUSSnAwxLWSuLNUaForre3ZRxtFlW4Ac.cache +1 -0
  39. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/WI/WIYh9Gi9ndC88dKHN_bO8iFiJwSzUGaJI9gnhSO7Ji8.cache +0 -0
  40. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/X5/X5dT1Gdr8sbGtvrNlwW86aVIMgR2zTd-2kFQ9C3L7Wg.cache +0 -0
  41. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Xo/XoLrhpxlw0kg9u3bMnDyQen8HXO2rqPRTCb8NYObL8Y.cache +0 -0
  42. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/Y1/Y1VBjwUHneW8QFgIGPmxOM0Ug3nZUTAUKXzkKah9AOs.cache +0 -0
  43. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/_t/_tr5uJ_M5iBr2N9uBonXFmxfqt1TxbYfFCxnfAiyiNU.cache +1 -0
  44. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/_w/_wDP8qm_JkjY5FPjc6RNCiP_dc_uBNRMyH64Sl8LJzY.cache +1 -0
  45. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/aW/aWSe6QsJ8Dk7ZAuTOYgjegrAoC2XYQtCCeo9KVzVVQs.cache +0 -0
  46. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/ap/apMxRwM7mSeCyECnYWAbxnWbsfoJLdJfwaxudP9Chi8.cache +1 -0
  47. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/at/ataSdIHBESkY5GN7sMG-XyOftCkIWDK0QaKEewVkqIU.cache +0 -0
  48. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/cm/cm54PMT0IiaHCIjq6T3ZTIMm7Yxo42XwnsyOgnCOXiM.cache +3 -0
  49. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/cm/cmUPiFXFgGEC8LObv4RZX5lwwWHkwS9sqRq1o37epy8.cache +2 -0
  50. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/dJ/dJn0Pwx5cPYGC5q_eHDfNfFt4JiC-fmQVaH5myKr0VA.cache +3 -0
  51. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/dq/dq3gHEjKxw3E013mazOcCiXNbDdPTz-A8oh-ehBXeLY.cache +2 -0
  52. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/em/emsg06Cc17Q7p1Y0IO1PFRtnyhMbj1u4-wVx6W8bgJs.cache +2 -0
  53. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/fu/fuVeiMpLNyElLwjOR6EBQP7-ZUwuJTsQe_Ie11TlX7Y.cache +0 -0
  54. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/iF/iF-qi7hkpBxivxIEuDhEbYCCUdo723aaitG7rholzuY.cache +3 -0
  55. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/iF/if_9bC6Uj3ZokQmIk9el665rc-6LTBoL6U4qR7gtoJU.cache +1 -0
  56. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/j1/j1GLMjXSyzOpsUCKPd35AfXExAXEMHejQdvPd8UErkQ.cache +1 -0
  57. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/j3/j3e_BmEvAiJhmSyXAU9VAE_CZACcKEbzRxeshc8FhJs.cache +0 -0
  58. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/jV/JVKq8sER4GK2hEv9E7tZ7mvXxh14vJeTVCDEnZC0JaM.cache +0 -0
  59. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/jn/jnZ8_zeT39edfDrXllxCW_oH5T-ynBUYGT8YNgyFU9c.cache +2 -0
  60. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/kw/kwNFhW24nxXy_HfVKYdXJyRqhu7ljgl9wR2DcJUo-nA.cache +0 -0
  61. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/nz/nZA-tpBPvlKlQKIbdV4_4NL_5GSce7A27-uejTdXxyo.cache +0 -0
  62. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/nz/nZH58NGgTuROXOSPMik3s7SjDoBucsgev57n0u9vlPA.cache +2 -0
  63. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/qB/qBg00KcV6F7tmpcxNC5tjzrdC3FWusHvOGhz1aV0zs8.cache +1 -0
  64. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/qZ/qZuwDOadKdP81QKNPTbE4G8CESQEnmrIE_INtDzerso.cache +1 -0
  65. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/sR/sRyvthBFPCFQfQ75moJFSYPaR71b7XeQRo9UwjvCWFc.cache +0 -0
  66. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/sl/sliQa4_eurm9yEqcshtJrfPPE6M-DF-t8REXVSOfyUQ.cache +1 -0
  67. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/tA/tAZH91Tm6zrf_sm00veerMt3qNaM2uC74u4Zuxv2gg0.cache +1 -0
  68. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/uY/uYA487PT8yb9JEmcxwo8syJu8nzceyQ2LExeSnyVu50.cache +1 -0
  69. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/vg/vgD37dvBvogssYiXikQ4Olm53D_b46IIW7PB9aAcCVM.cache +0 -0
  70. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/w2/w2_uibK0i1njL5U_7brQZhib5VYdXXvpvhE06yX1SqE.cache +1 -0
  71. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/wN/wNw4kAG0E_RrvLeFAizMmTp_0jh-HGw1ONLtRyw92z0.cache +0 -0
  72. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/xA/xAEcSwhjIYJzUW_4aTWYVRUc7moZTTeCKKkqkxLhrfg.cache +0 -0
  73. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/xn/xnt4dCDEEL7zX5DqWMpQag3bopptMKMDNFzvfvF5OPs.cache +1 -0
  74. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/yI/yI2MBOO01NRSHWPeRJfC5SFBMpefo4xeYfHeWEvkdks.cache +1 -0
  75. data/spec/internal/tmp/cache/assets/sprockets/v4.0.0/z_/z_2HCE5ElxkvIdf9isrro0NsgSdEU0oRSalWcYQss74.cache +1 -0
  76. data/spec/job_spec.rb +17 -6
  77. data/spec/performer_proxy_spec.rb +9 -3
  78. metadata +124 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc81f4353cb4604f685c551dbf09ed6c6eee6fcf38daede4f0ce858818220c32
4
- data.tar.gz: a507754afba5ca7f0db233e4564f8bb5b62e86ac5fd570c19de56847fc508db9
3
+ metadata.gz: ba6fb8bfaeaa6f982bb87dd401748c4678bd75a77073bbfa7a9acbe042f3cd76
4
+ data.tar.gz: 1c5a36409b2e602767b1a2536f719bd52f563728206510e5be2b6ebcd3fe4a17
5
5
  SHA512:
6
- metadata.gz: cf1e7b64777a524a154b5c867a76e7736506a71378faea6c42dc3c0d7362aeee75b16df8705679a5c3b90a8d1fbcd4e743dff29a8ff0599590c30ed232dec295
7
- data.tar.gz: ac6045954b72a3f7ddb98b5a38d70053bc0b28d1df81d3bbccbb260ad5b283f18c487ccf1a1fc14a60f890385d903a738147e1ed7d70c83688515a913f25b766
6
+ metadata.gz: d82b9b8ae012b7a7d275ebdaa81435128d726f75797d4f60224fdd458af84d14b708b114cacbea02d26d10d8d130b2d99c87a8808e401a057d02e3db26fc00de
7
+ data.tar.gz: 0aecebbbd8ac29daf3af5a065494eda766ceaecc8bb356d105a6d45673ce728828f9c2a6335469e213e79fc9d4b000d807841c402704ee03100497e2b7f3356e
data/lib/crono/cli.rb CHANGED
@@ -24,7 +24,7 @@ module Crono
24
24
 
25
25
  setup_log
26
26
 
27
- write_pid unless config.daemonize
27
+ write_pid if config.daemonize
28
28
  load_rails
29
29
  Cronotab.process(File.expand_path(config.cronotab))
30
30
  print_banner
data/lib/crono/job.rb CHANGED
@@ -9,10 +9,10 @@ module Crono
9
9
  attr_accessor :performer, :period, :job_args, :last_performed_at, :job_options,
10
10
  :next_performed_at, :job_log, :job_logger, :healthy, :execution_interval
11
11
 
12
- def initialize(performer, period, job_args, job_options = nil)
12
+ def initialize(performer, period, job_args = nil, job_options = nil)
13
13
  self.execution_interval = 0.minutes
14
14
  self.performer, self.period = performer, period
15
- self.job_args = JSON.generate(job_args)
15
+ self.job_args = JSON.generate(job_args) if job_args.present?
16
16
  self.job_log = StringIO.new
17
17
  self.job_logger = Logger.new(job_log)
18
18
  self.job_options = job_options || {}
@@ -1,14 +1,15 @@
1
1
  module Crono
2
2
  # Crono::PerformerProxy is a proxy used in cronotab.rb semantic
3
3
  class PerformerProxy
4
- def initialize(performer, scheduler, job_args)
4
+ def initialize(performer, scheduler, job_args = nil, job_options = nil)
5
5
  @performer = performer
6
6
  @scheduler = scheduler
7
7
  @job_args = job_args
8
+ @job_options = job_options
8
9
  end
9
10
 
10
11
  def every(period, **options)
11
- @job = Job.new(@performer, Period.new(period, **options), @job_args, @options)
12
+ @job = Job.new(@performer, Period.new(period, **options), @job_args, @job_options)
12
13
  @scheduler.add_job(@job)
13
14
  self
14
15
  end
@@ -19,12 +20,12 @@ module Crono
19
20
  end
20
21
 
21
22
  def with_options(options)
22
- @options = options
23
+ @job_options = options
23
24
  self
24
25
  end
25
26
  end
26
27
 
27
28
  def self.perform(performer, *job_args)
28
- PerformerProxy.new(performer, Crono.scheduler, job_args)
29
+ PerformerProxy.new(performer, Crono.scheduler, *job_args)
29
30
  end
30
31
  end
data/lib/crono/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Crono
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
data/spec/cli_spec.rb CHANGED
@@ -11,7 +11,7 @@ describe Crono::CLI do
11
11
  expect(cli).to receive(:start_working_loop)
12
12
  expect(cli).to receive(:parse_options)
13
13
  expect(cli).to receive(:parse_command)
14
- expect(cli).to receive(:write_pid)
14
+ expect(cli).not_to receive(:write_pid)
15
15
  expect(Crono::Cronotab).to receive(:process)
16
16
  cli.run
17
17
  end
@@ -25,7 +25,8 @@ describe Crono::CLI do
25
25
  expect(cli).to receive(:start_working_loop_in_daemon)
26
26
  expect(cli).to receive(:parse_options)
27
27
  expect(cli).to receive(:parse_command)
28
- expect(cli).not_to receive(:write_pid)
28
+ expect(cli).to receive(:setup_log)
29
+ expect(cli).to receive(:write_pid)
29
30
  expect(Crono::Cronotab).to receive(:process)
30
31
  cli.run
31
32
  end
Binary file