resque-scheduler 4.2.1 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of resque-scheduler might be problematic. Click here for more details.

Files changed (60) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +12 -0
  3. data/.github/workflows/rubocop.yml +27 -0
  4. data/.github/workflows/ruby.yml +48 -0
  5. data/AUTHORS.md +7 -0
  6. data/CHANGELOG.md +495 -0
  7. data/CODE_OF_CONDUCT.md +74 -0
  8. data/Gemfile +8 -0
  9. data/README.md +37 -17
  10. data/Rakefile +1 -5
  11. data/{bin → exe}/resque-scheduler +0 -0
  12. data/lib/resque/scheduler/cli.rb +1 -0
  13. data/lib/resque/scheduler/delaying_extensions.rb +38 -6
  14. data/lib/resque/scheduler/env.rb +8 -4
  15. data/lib/resque/scheduler/lock/resilient.rb +19 -12
  16. data/lib/resque/scheduler/locking.rb +2 -2
  17. data/lib/resque/scheduler/scheduling_extensions.rb +4 -3
  18. data/lib/resque/scheduler/server/views/delayed.erb +1 -1
  19. data/lib/resque/scheduler/server/views/search_form.erb +1 -1
  20. data/lib/resque/scheduler/server.rb +1 -1
  21. data/lib/resque/scheduler/version.rb +1 -1
  22. data/lib/resque/scheduler.rb +39 -16
  23. data/resque-scheduler.gemspec +29 -10
  24. metadata +62 -66
  25. data/.gitignore +0 -17
  26. data/.rubocop.yml +0 -18
  27. data/.rubocop_todo.yml +0 -71
  28. data/.simplecov +0 -3
  29. data/.travis.yml +0 -26
  30. data/.vagrant-provision-as-vagrant.sh +0 -15
  31. data/.vagrant-provision.sh +0 -23
  32. data/.vagrant-skel/bash_profile +0 -7
  33. data/.vagrant-skel/bashrc +0 -7
  34. data/HISTORY.md +0 -303
  35. data/Vagrantfile +0 -14
  36. data/examples/Rakefile +0 -2
  37. data/examples/config/initializers/resque-web.rb +0 -37
  38. data/examples/dynamic-scheduling/README.md +0 -28
  39. data/examples/dynamic-scheduling/app/jobs/fix_schedules_job.rb +0 -52
  40. data/examples/dynamic-scheduling/app/jobs/send_email_job.rb +0 -9
  41. data/examples/dynamic-scheduling/app/models/user.rb +0 -16
  42. data/examples/dynamic-scheduling/config/resque.yml +0 -4
  43. data/examples/dynamic-scheduling/config/static_schedule.yml +0 -7
  44. data/examples/dynamic-scheduling/lib/tasks/resque.rake +0 -48
  45. data/examples/run-resque-web +0 -3
  46. data/script/migrate_to_timestamps_set.rb +0 -16
  47. data/tasks/resque_scheduler.rake +0 -2
  48. data/test/cli_test.rb +0 -231
  49. data/test/delayed_queue_test.rb +0 -925
  50. data/test/env_test.rb +0 -47
  51. data/test/multi_process_test.rb +0 -125
  52. data/test/resque-web_test.rb +0 -364
  53. data/test/scheduler_args_test.rb +0 -222
  54. data/test/scheduler_hooks_test.rb +0 -55
  55. data/test/scheduler_locking_test.rb +0 -316
  56. data/test/scheduler_setup_test.rb +0 -141
  57. data/test/scheduler_task_test.rb +0 -72
  58. data/test/scheduler_test.rb +0 -473
  59. data/test/test_helper.rb +0 -147
  60. data/test/util_test.rb +0 -17
data/test/cli_test.rb DELETED
@@ -1,231 +0,0 @@
1
- # vim:fileencoding=utf-8
2
- require_relative 'test_helper'
3
-
4
- context 'Cli' do
5
- def mock_runtime_env
6
- mock.tap { |m| m.stubs(:setup) }
7
- end
8
-
9
- def new_cli(argv = [], env = {})
10
- Resque::Scheduler::Cli.new(argv, env).tap do |cli|
11
- cli.stubs(:runtime_env).returns(mock_runtime_env)
12
- end
13
- end
14
-
15
- test 'does not require any positional arguments' do
16
- assert(!new_cli.nil?)
17
- end
18
-
19
- test 'initializes verbose from the env' do
20
- cli = new_cli([], 'VERBOSE' => 'foo')
21
- assert_equal('foo', cli.send(:options)[:verbose])
22
- end
23
-
24
- test 'defaults to non-verbose' do
25
- assert_equal(false, !!new_cli.send(:options)[:verbose])
26
- end
27
-
28
- test 'accepts verbose via -v' do
29
- cli = new_cli(%w(-v))
30
- cli.parse_options
31
- assert_equal(true, cli.send(:options)[:verbose])
32
- end
33
-
34
- test 'accepts verbose via --verbose' do
35
- cli = new_cli(%w(--verbose))
36
- cli.parse_options
37
- assert_equal(true, cli.send(:options)[:verbose])
38
- end
39
-
40
- test 'initializes background from the env' do
41
- cli = new_cli([], 'BACKGROUND' => '1')
42
- assert_equal('1', cli.send(:options)[:background])
43
- end
44
-
45
- test 'defaults to background=false' do
46
- assert_equal(false, !!new_cli.send(:options)[:background])
47
- end
48
-
49
- test 'accepts background via -B' do
50
- cli = new_cli(%w(-B))
51
- cli.parse_options
52
- assert_equal(true, cli.send(:options)[:background])
53
- end
54
-
55
- test 'accepts background via --background' do
56
- cli = new_cli(%w(--background))
57
- cli.parse_options
58
- assert_equal(true, cli.send(:options)[:background])
59
- end
60
-
61
- test 'initializes pidfile from the env' do
62
- cli = new_cli([], 'PIDFILE' => 'bar')
63
- assert_equal('bar', cli.send(:options)[:pidfile])
64
- end
65
-
66
- test 'defaults to nil pidfile' do
67
- assert_equal(nil, new_cli.send(:options)[:pidfile])
68
- end
69
-
70
- test 'accepts pidfile via -P' do
71
- cli = new_cli(%w(-P foo))
72
- cli.parse_options
73
- assert_equal('foo', cli.send(:options)[:pidfile])
74
- end
75
-
76
- test 'accepts pidfile via --pidfile' do
77
- cli = new_cli(%w(--pidfile foo))
78
- cli.parse_options
79
- assert_equal('foo', cli.send(:options)[:pidfile])
80
- end
81
-
82
- test 'defaults to nil dynamic' do
83
- assert_equal(nil, new_cli.send(:options)[:dynamic])
84
- end
85
-
86
- test 'initializes env from the env' do
87
- cli = new_cli([], 'RAILS_ENV' => 'flurb')
88
- assert_equal('flurb', cli.send(:options)[:env])
89
- end
90
-
91
- test 'defaults to nil env' do
92
- assert_equal(nil, new_cli.send(:options)[:env])
93
- end
94
-
95
- test 'accepts env via -E' do
96
- cli = new_cli(%w(-E bork))
97
- cli.parse_options
98
- assert_equal('bork', cli.send(:options)[:env])
99
- end
100
-
101
- test 'accepts env via --environment' do
102
- cli = new_cli(%w(--environment hork))
103
- cli.parse_options
104
- assert_equal('hork', cli.send(:options)[:env])
105
- end
106
-
107
- test 'initializes initializer_path from the env' do
108
- cli = new_cli([], 'INITIALIZER_PATH' => 'herp.rb')
109
- assert_equal('herp.rb', cli.send(:options)[:initializer_path])
110
- end
111
-
112
- test 'defaults to nil initializer_path' do
113
- assert_equal(nil, new_cli.send(:options)[:initializer_path])
114
- end
115
-
116
- test 'accepts initializer_path via -I' do
117
- cli = new_cli(%w(-I hambone.rb))
118
- cli.parse_options
119
- assert_equal('hambone.rb', cli.send(:options)[:initializer_path])
120
- end
121
-
122
- test 'accepts initializer_path via --initalizer-path' do
123
- cli = new_cli(%w(--initializer-path cookies.rb))
124
- cli.parse_options
125
- assert_equal('cookies.rb', cli.send(:options)[:initializer_path])
126
- end
127
-
128
- test 'loads given initilalizer_path' do
129
- cli = new_cli(%w(--initializer-path fuzzbert.rb))
130
- cli.expects(:load).with('fuzzbert.rb')
131
- cli.pre_run
132
- end
133
-
134
- test 'initializes quiet from the env' do
135
- cli = new_cli([], 'QUIET' => '1')
136
- assert_equal('1', cli.send(:options)[:quiet])
137
- end
138
-
139
- test 'defaults to un-quieted' do
140
- assert_equal(false, !!new_cli.send(:options)[:quiet])
141
- end
142
-
143
- test 'accepts quiet via -q' do
144
- cli = new_cli(%w(-q))
145
- cli.parse_options
146
- assert_equal(true, cli.send(:options)[:quiet])
147
- end
148
-
149
- test 'accepts quiet via --quiet' do
150
- cli = new_cli(%w(--quiet))
151
- cli.parse_options
152
- assert_equal(true, cli.send(:options)[:quiet])
153
- end
154
-
155
- test 'initializes logfile from the env' do
156
- cli = new_cli([], 'LOGFILE' => 'example.log')
157
- assert_equal('example.log', cli.send(:options)[:logfile])
158
- end
159
-
160
- test 'defaults to nil logfile' do
161
- assert_equal(nil, new_cli.send(:options)[:logfile])
162
- end
163
-
164
- test 'accepts logfile via -l' do
165
- cli = new_cli(%w(-l hurm.out))
166
- cli.parse_options
167
- assert_equal('hurm.out', cli.send(:options)[:logfile])
168
- end
169
-
170
- test 'accepts logfile via --logfile' do
171
- cli = new_cli(%w(--logfile flam.log))
172
- cli.parse_options
173
- assert_equal('flam.log', cli.send(:options)[:logfile])
174
- end
175
-
176
- test 'initializes logformat from the env' do
177
- cli = new_cli([], 'LOGFORMAT' => 'fancy')
178
- assert_equal('fancy', cli.send(:options)[:logformat])
179
- end
180
-
181
- test 'defaults to nil logformat' do
182
- assert_equal(nil, new_cli.send(:options)[:logformat])
183
- end
184
-
185
- test 'accepts logformat via -F' do
186
- cli = new_cli(%w(-F silly))
187
- cli.parse_options
188
- assert_equal('silly', cli.send(:options)[:logformat])
189
- end
190
-
191
- test 'accepts logformat via --logformat' do
192
- cli = new_cli(%w(--logformat flimsy))
193
- cli.parse_options
194
- assert_equal('flimsy', cli.send(:options)[:logformat])
195
- end
196
-
197
- test 'defaults to dynamic=false' do
198
- assert_equal(false, !!new_cli.send(:options)[:dynamic])
199
- end
200
-
201
- test 'initializes app_name from the env' do
202
- cli = new_cli([], 'APP_NAME' => 'sprocket')
203
- assert_equal('sprocket', cli.send(:options)[:app_name])
204
- end
205
-
206
- test 'defaults to nil app_name' do
207
- assert_equal(nil, new_cli.send(:options)[:app_name])
208
- end
209
-
210
- test 'accepts app_name via -n' do
211
- cli = new_cli(%w(-n hambone))
212
- cli.parse_options
213
- assert_equal('hambone', cli.send(:options)[:app_name])
214
- end
215
-
216
- test 'accepts app_name via --app-name' do
217
- cli = new_cli(%w(--app-name flimsy))
218
- cli.parse_options
219
- assert_equal('flimsy', cli.send(:options)[:app_name])
220
- end
221
-
222
- test 'runs Resque::Scheduler' do
223
- Resque::Scheduler.expects(:run)
224
- Resque::Scheduler::Cli.run!([], {})
225
- end
226
-
227
- test 'does not create keys for unspecified environment variables' do
228
- cli = new_cli([], 'DYNAMIC_SCHEDULE' => 'true')
229
- assert_equal({ dynamic: 'true' }, cli.send(:options))
230
- end
231
- end