hyper-smart-pkg 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/hyper-smart-pkg.gemspec +11 -0
  3. data/whenever-1.1.2/Appraisals +69 -0
  4. data/whenever-1.1.2/CHANGELOG.md +434 -0
  5. data/whenever-1.1.2/CONTRIBUTING.md +38 -0
  6. data/whenever-1.1.2/Gemfile +11 -0
  7. data/whenever-1.1.2/LICENSE +22 -0
  8. data/whenever-1.1.2/Makefile +5 -0
  9. data/whenever-1.1.2/README.md +350 -0
  10. data/whenever-1.1.2/Rakefile +10 -0
  11. data/whenever-1.1.2/bin/whenever +49 -0
  12. data/whenever-1.1.2/bin/wheneverize +71 -0
  13. data/whenever-1.1.2/gemfiles/activesupport5.0.gemfile +11 -0
  14. data/whenever-1.1.2/gemfiles/activesupport5.1.gemfile +11 -0
  15. data/whenever-1.1.2/gemfiles/activesupport5.2.gemfile +11 -0
  16. data/whenever-1.1.2/gemfiles/activesupport6.0.gemfile +17 -0
  17. data/whenever-1.1.2/gemfiles/activesupport6.1.gemfile +17 -0
  18. data/whenever-1.1.2/gemfiles/activesupport7.0.gemfile +11 -0
  19. data/whenever-1.1.2/gemfiles/activesupport7.1.gemfile +11 -0
  20. data/whenever-1.1.2/gemfiles/activesupport7.2.gemfile +11 -0
  21. data/whenever-1.1.2/gemfiles/activesupport8.0.gemfile +11 -0
  22. data/whenever-1.1.2/gemfiles/activesupport8.1.gemfile +11 -0
  23. data/whenever-1.1.2/lib/whenever/capistrano/v2/hooks.rb +8 -0
  24. data/whenever-1.1.2/lib/whenever/capistrano/v2/recipes.rb +49 -0
  25. data/whenever-1.1.2/lib/whenever/capistrano/v2/support.rb +53 -0
  26. data/whenever-1.1.2/lib/whenever/capistrano/v3/tasks/whenever.rake +56 -0
  27. data/whenever-1.1.2/lib/whenever/capistrano.rb +7 -0
  28. data/whenever-1.1.2/lib/whenever/command_line.rb +171 -0
  29. data/whenever-1.1.2/lib/whenever/cron.rb +181 -0
  30. data/whenever-1.1.2/lib/whenever/job.rb +56 -0
  31. data/whenever-1.1.2/lib/whenever/job_list.rb +186 -0
  32. data/whenever-1.1.2/lib/whenever/numeric.rb +13 -0
  33. data/whenever-1.1.2/lib/whenever/numeric_seconds.rb +48 -0
  34. data/whenever-1.1.2/lib/whenever/os.rb +7 -0
  35. data/whenever-1.1.2/lib/whenever/output_redirection.rb +57 -0
  36. data/whenever-1.1.2/lib/whenever/setup.rb +31 -0
  37. data/whenever-1.1.2/lib/whenever/version.rb +3 -0
  38. data/whenever-1.1.2/lib/whenever.rb +42 -0
  39. data/whenever-1.1.2/test/functional/command_line_test.rb +458 -0
  40. data/whenever-1.1.2/test/functional/output_at_test.rb +246 -0
  41. data/whenever-1.1.2/test/functional/output_default_defined_jobs_test.rb +310 -0
  42. data/whenever-1.1.2/test/functional/output_defined_job_test.rb +113 -0
  43. data/whenever-1.1.2/test/functional/output_description_test.rb +25 -0
  44. data/whenever-1.1.2/test/functional/output_env_test.rb +29 -0
  45. data/whenever-1.1.2/test/functional/output_jobs_for_roles_test.rb +65 -0
  46. data/whenever-1.1.2/test/functional/output_jobs_with_mailto_test.rb +168 -0
  47. data/whenever-1.1.2/test/functional/output_redirection_test.rb +248 -0
  48. data/whenever-1.1.2/test/test_case.rb +32 -0
  49. data/whenever-1.1.2/test/test_helper.rb +51 -0
  50. data/whenever-1.1.2/test/unit/capistrano_support_test.rb +147 -0
  51. data/whenever-1.1.2/test/unit/cron_test.rb +418 -0
  52. data/whenever-1.1.2/test/unit/executable_test.rb +142 -0
  53. data/whenever-1.1.2/test/unit/job_test.rb +114 -0
  54. data/whenever-1.1.2/whenever.gemspec +29 -0
  55. metadata +93 -0
@@ -0,0 +1,350 @@
1
+ Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs.
2
+
3
+ ### Installation
4
+
5
+ ```sh
6
+ $ gem install whenever
7
+ ```
8
+
9
+ Or with Bundler in your Gemfile.
10
+
11
+ ```ruby
12
+ gem 'whenever', require: false
13
+ ```
14
+
15
+ ### Getting started
16
+
17
+ ```sh
18
+ $ cd /apps/my-great-project
19
+ $ bundle exec wheneverize .
20
+ ```
21
+
22
+ This will create an initial `config/schedule.rb` file for you (as long as the config folder is already present in your project).
23
+
24
+ ### The `whenever` command
25
+
26
+ The `whenever` command will simply show you your `schedule.rb` file converted to cron syntax. It does not read or write your crontab file.
27
+
28
+ ```sh
29
+ $ cd /apps/my-great-project
30
+ $ bundle exec whenever
31
+ ```
32
+
33
+ To write your crontab file for your jobs, execute this command:
34
+
35
+ ```sh
36
+ $ whenever --update-crontab
37
+ ```
38
+
39
+ Other commonly used options include:
40
+ ```sh
41
+ $ whenever --user app # set a user as which to install the crontab
42
+ $ whenever --load-file config/my_schedule.rb # set the schedule file
43
+ $ whenever --crontab-command 'sudo crontab' # override the crontab command
44
+ ```
45
+
46
+ > Note: If you run the whenever --update-crontab without passing the --user attribute, cron will be generated by the current user. This mean tasks that needs other user permission will fail.
47
+
48
+ You can list installed cron jobs using `crontab -l`.
49
+
50
+ Run `whenever --help` for a complete list of options for selecting the schedule to use, setting variables in the schedule, etc.
51
+
52
+ ### Example schedule.rb file
53
+
54
+ ```ruby
55
+ every 3.hours do # 1.minute 1.day 1.week 1.month 1.year is also supported
56
+ # the following tasks are run in parallel (not in sequence)
57
+ runner "MyModel.some_process"
58
+ rake "my:rake:task"
59
+ command "/usr/bin/my_great_command"
60
+ end
61
+
62
+ every 1.day, at: '4:30 am' do
63
+ runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
64
+ end
65
+
66
+ every 1.day, at: ['4:30 am', '6:00 pm'] do
67
+ runner "Mymodel.task_to_run_in_two_times_every_day"
68
+ end
69
+
70
+ every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot
71
+ runner "SomeModel.ladeeda"
72
+ end
73
+
74
+ every :sunday, at: '12pm' do # Use any day of the week or :weekend, :weekday
75
+ runner "Task.do_something_great"
76
+ end
77
+
78
+ every '0 0 27-31 * *' do
79
+ command "echo 'you can use raw cron syntax too'"
80
+ end
81
+
82
+ # run this task only on servers with the :app role in Capistrano
83
+ # see Capistrano roles section below
84
+ every :day, at: '12:20am', roles: [:app] do
85
+ rake "app_server:task"
86
+ end
87
+ ```
88
+
89
+ ### Define your own job types
90
+
91
+ Whenever ships with three pre-defined job types: command, runner, and rake. You can define your own with `job_type`.
92
+
93
+ For example:
94
+
95
+ ```ruby
96
+ job_type :awesome, '/usr/local/bin/awesome :task :fun_level'
97
+
98
+ every 2.hours do
99
+ awesome "party", fun_level: "extreme"
100
+ end
101
+ ```
102
+
103
+ Would run `/usr/local/bin/awesome party extreme` every two hours. `:task` is always replaced with the first argument, and any additional `:whatevers` are replaced with the options passed in or by variables that have been defined with `set`.
104
+
105
+ The default job types that ship with Whenever are defined like so:
106
+
107
+ ```ruby
108
+ job_type :command, ":task :output"
109
+ job_type :rake, "cd :path && :environment_variable=:environment :bundle_command rake :task --silent :output"
110
+ job_type :script, "cd :path && :environment_variable=:environment :bundle_command script/:task :output"
111
+ job_type :runner, "cd :path && :bundle_command :runner_command -e :environment ':task' :output"
112
+ ```
113
+
114
+ Pre-Rails 3 apps and apps that don't use Bundler will redefine the `rake` and `runner` jobs respectively to function correctly.
115
+
116
+ If a `:path` is not set it will default to the directory in which `whenever` was executed. `:environment_variable` will default to 'RAILS_ENV'. `:environment` will default to 'production'. `:output` will be replaced with your output redirection settings which you can read more about here: <http://github.com/javan/whenever/wiki/Output-redirection-aka-logging-your-cron-jobs>
117
+
118
+ All jobs are by default run with `bash -l -c 'command...'`. Among other things, this allows your cron jobs to play nice with RVM by loading the entire environment instead of cron's somewhat limited environment. Read more: <http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production>
119
+
120
+ You can change this by setting your own `:job_template`.
121
+
122
+ ```ruby
123
+ set :job_template, "bash -l -c ':job'"
124
+ ```
125
+
126
+ Or set the job_template to nil to have your jobs execute normally.
127
+
128
+ ```ruby
129
+ set :job_template, nil
130
+ ```
131
+
132
+ ### Parsing dates and times
133
+
134
+ Whenever uses the [Chronic](https://github.com/mojombo/chronic) gem to parse the specified dates and times.
135
+
136
+ You can set your custom Chronic configuration if the defaults don't fit you.
137
+
138
+ For example, to assume a 24 hour clock instead of the default 12 hour clock:
139
+
140
+ ```ruby
141
+ set :chronic_options, hours24: true
142
+
143
+ # By default this would run the job every day at 3am
144
+ every 1.day, at: '3:00' do
145
+ runner "MyModel.nightly_archive_job"
146
+ end
147
+ ```
148
+
149
+ You can see a list of all available options here: <https://github.com/mojombo/chronic/blob/master/lib/chronic/parser.rb>
150
+
151
+ ### Customize email recipient with the `MAILTO` environment variable
152
+
153
+ Output from the jobs is sent to the email address configured in the `MAILTO` environment variable.
154
+
155
+ There are many ways to further configure the recipient.
156
+
157
+ Example: A global configuration, overriding the environment's value:
158
+
159
+ ```ruby
160
+ env 'MAILTO', 'output_of_cron@example.com'
161
+
162
+ every 3.hours do
163
+ command "/usr/bin/my_great_command"
164
+ end
165
+ ```
166
+
167
+ Example: A `MAILTO` configured for all the jobs in an interval block:
168
+
169
+ ```ruby
170
+ every 3.hours, mailto: 'my_super_command@example.com' do
171
+ command "/usr/bin/my_super_command"
172
+ end
173
+ ```
174
+
175
+ Example: A `MAILTO` configured for a single job:
176
+
177
+ ```ruby
178
+ every 3.hours do
179
+ command "/usr/bin/my_super_command", mailto: 'my_super_command_output@example.com'
180
+ end
181
+ ```
182
+
183
+ ### Adding comments to crontab
184
+
185
+ A description can be added to a job that will be included in the crontab as a comment above the cron entry.
186
+
187
+ Example: A single line description:
188
+
189
+ ```ruby
190
+ every 1.hours, description: "My job description" do
191
+ command "/usr/bin/my_great_command"
192
+ end
193
+ ```
194
+
195
+ Example: A multi line description:
196
+
197
+ ```ruby
198
+ every 1.hours, description: "My job description\nhas multiple lines" do
199
+ command "/usr/bin/my_great_command"
200
+ end
201
+ ```
202
+
203
+ ### Capistrano integration
204
+
205
+ Use the built-in Capistrano recipe for easy crontab updates with deploys. For Capistrano V3, see the next section.
206
+
207
+ In your "config/deploy.rb" file:
208
+
209
+ ```ruby
210
+ require "whenever/capistrano"
211
+ ```
212
+
213
+ Take a look at the recipe for options you can set. <https://github.com/javan/whenever/blob/main/lib/whenever/capistrano/v2/recipes.rb>
214
+ For example, if you're using bundler do this:
215
+
216
+ ```ruby
217
+ set :whenever_command, "bundle exec whenever"
218
+ require "whenever/capistrano"
219
+ ```
220
+
221
+ If you are using different environments (such as staging, production), then you may want to do this:
222
+
223
+ ```ruby
224
+ set :whenever_environment, defer { stage }
225
+ require "whenever/capistrano"
226
+ ```
227
+
228
+ The capistrano variable `:stage` should be the one holding your environment name. This will make the correct `:environment` available in your `schedule.rb`.
229
+
230
+ If both your environments are on the same server you'll want to namespace them, or they'll overwrite each other when you deploy:
231
+
232
+ ```ruby
233
+ set :whenever_environment, defer { stage }
234
+ set :whenever_identifier, defer { "#{application}_#{stage}" }
235
+ require "whenever/capistrano"
236
+ ```
237
+
238
+ If you use a schedule at an alternative path, you may configure it like so:
239
+
240
+ ```ruby
241
+ set :whenever_load_file, defer { "#{release_path}/somewhere/else/schedule.rb" }
242
+ require "whenever/capistrano"
243
+ ```
244
+
245
+ ### Capistrano V3 Integration
246
+
247
+ In your "Capfile" file:
248
+
249
+ ```ruby
250
+ require "whenever/capistrano"
251
+ ```
252
+
253
+ Take a look at the [load:defaults task](https://github.com/javan/whenever/blob/main/lib/whenever/capistrano/v3/tasks/whenever.rake) (bottom of file) for options you can set. For example, to namespace the crontab entries by application and stage do this in your "config/deploy.rb" file:
254
+
255
+ ```ruby
256
+ set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }
257
+ ```
258
+
259
+ The Capistrano integration by default expects the `:application` variable to be set in order to scope jobs in the crontab.
260
+
261
+ ### Capistrano roles
262
+
263
+ The first thing to know about the new roles support is that it is entirely
264
+ optional and backwards-compatible. If you don't need different jobs running on
265
+ different servers in your capistrano deployment, then you can safely stop reading
266
+ now and everything should just work the same way it always has.
267
+
268
+ When you define a job in your schedule.rb file, by default it will be deployed to
269
+ all servers in the whenever_roles list (which defaults to `[:db]`).
270
+
271
+ However, if you want to restrict certain jobs to only run on subset of servers,
272
+ you can add a `roles: [...]` argument to their definitions. **Make sure to add
273
+ that role to the whenever_roles list in your deploy.rb.**
274
+
275
+ When you run `cap deploy`, jobs with a :roles list specified will only be added to
276
+ the crontabs on servers with one or more of the roles in that list.
277
+
278
+ Jobs with no :roles argument will be deployed to all servers in the whenever_roles
279
+ list. This is to maintain backward compatibility with previous releases of whenever.
280
+
281
+ So, for example, with the default whenever_roles of `[:db]`, a job like this would be
282
+ deployed to all servers with the `:db` role:
283
+
284
+ ```ruby
285
+ every :day, at: '12:20am' do
286
+ rake 'foo:bar'
287
+ end
288
+ ```
289
+
290
+ If we set whenever_roles to `[:db, :app]` in deploy.rb, and have the following
291
+ jobs in schedule.rb:
292
+
293
+ ```ruby
294
+ every :day, at: '1:37pm', roles: [:app] do
295
+ rake 'app:task' # will only be added to crontabs of :app servers
296
+ end
297
+
298
+ every :hour, roles: [:db] do
299
+ rake 'db:task' # will only be added to crontabs of :db servers
300
+ end
301
+
302
+ every :day, at: '12:02am' do
303
+ command "run_this_everywhere" # will be deployed to :db and :app servers
304
+ end
305
+ ```
306
+
307
+ Here are the basic rules:
308
+
309
+ 1. If a server's role isn't listed in whenever_roles, it will *never* have jobs
310
+ added to its crontab.
311
+ 1. If a server's role is listed in the whenever_roles, then it will have all
312
+ jobs added to its crontab that either list that role in their :roles arg or
313
+ that don't have a :roles arg.
314
+ 1. If a job has a :roles arg but that role isn't in the whenever_roles list,
315
+ that job *will not* be deployed to any server.
316
+
317
+ ### RVM Integration
318
+
319
+ If your production environment uses RVM (Ruby Version Manager) you will run into a gotcha that causes your cron jobs to hang. This is not directly related to Whenever, and can be tricky to debug. Your .rvmrc files must be trusted or else the cron jobs will hang waiting for the file to be trusted. A solution is to disable the prompt by adding this line to your user rvm file in `~/.rvmrc`
320
+
321
+ `rvm_trust_rvmrcs_flag=1`
322
+
323
+ This tells rvm to trust all rvmrc files.
324
+
325
+ ### Heroku?
326
+
327
+ No. Heroku does not support cron, instead providing [Heroku Scheduler](https://devcenter.heroku.com/articles/scheduler). If you deploy to Heroku, you should use that rather than Whenever.
328
+
329
+ ### Testing
330
+
331
+ [whenever-test](https://github.com/heartbits/whenever-test) is an extension to Whenever for testing a Whenever schedule.
332
+
333
+ ### Credit
334
+
335
+ Whenever was created for use at Inkling (<http://inklingmarkets.com>). Their take on it: <http://blog.inklingmarkets.com/2009/02/whenever-easy-way-to-do-cron-jobs-from.html>
336
+
337
+ Thanks to all the contributors who have made it even better: <http://github.com/javan/whenever/contributors>
338
+
339
+ ### Discussion / Feedback / Issues / Bugs
340
+
341
+ For general discussion and questions, please use the google group: <http://groups.google.com/group/whenever-gem>
342
+
343
+ If you've found a genuine bug or issue, please use the Issues section on github: <http://github.com/javan/whenever/issues>
344
+
345
+ Ryan Bates created a great Railscast about Whenever: <http://railscasts.com/episodes/164-cron-in-ruby>
346
+ It's a little bit dated now, but remains a good introduction.
347
+
348
+ ----
349
+
350
+ Copyright &copy; 2017 Javan Makhmali
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |test|
5
+ test.libs << 'lib' << 'test'
6
+ test.pattern = 'test/{functional,unit}/**/*_test.rb'
7
+ test.verbose = true
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'whenever'
5
+
6
+ options = {}
7
+
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: whenever [options]"
10
+ opts.on('-i', '--update-crontab [schedule]',
11
+ 'Install the schedule to crontab.',
12
+ ' Default: full path to schedule.rb file') do |identifier|
13
+ options[:update] = true
14
+ options[:identifier] = identifier if identifier
15
+ end
16
+ opts.on('-w', '--write-crontab [schedule]',
17
+ 'Clear current crontab, and overwrite it with only the given schedule.',
18
+ ' Default: full path to schedule.rb file') do |identifier|
19
+ options[:write] = true
20
+ options[:identifier] = identifier if identifier
21
+ end
22
+ opts.on('-c', '--clear-crontab [schedule]',
23
+ 'Uninstall the schedule from crontab.',
24
+ ' Default: full path to schedule.rb file') do |identifier|
25
+ options[:clear] = true
26
+ options[:identifier] = identifier if identifier
27
+ end
28
+ opts.on('-s', '--set [variables]', 'Example: --set \'environment=staging&path=/my/sweet/path\'') do |set|
29
+ options[:set] = set if set
30
+ end
31
+ opts.on('-f', '--load-file [schedule file]', 'Default: config/schedule.rb') do |file|
32
+ options[:file] = file if file
33
+ end
34
+ opts.on('-u', '--user [user]', 'Default: current user') do |user|
35
+ options[:user] = user if user
36
+ end
37
+ opts.on('-k', '--cut [lines]', 'Cut lines from the top of the cronfile') do |lines|
38
+ options[:cut] = lines.to_i if lines
39
+ end
40
+ opts.on('-r', '--roles [role1,role2]', 'Comma-separated list of server roles to generate cron jobs for') do |roles|
41
+ options[:roles] = roles.split(',').map(&:to_sym) if roles
42
+ end
43
+ opts.on('-x', '--crontab-command [command]', 'Default: crontab') do |crontab_command|
44
+ options[:crontab_command] = crontab_command if crontab_command
45
+ end
46
+ opts.on('-v', '--version') { puts "Whenever v#{Whenever::VERSION}"; exit(0) }
47
+ end.parse!
48
+
49
+ Whenever::CommandLine.execute(options)
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file is based heavily on Capistrano's `capify` command
4
+
5
+ require 'optparse'
6
+ require 'fileutils'
7
+
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: #{File.basename($0)} [path]"
10
+
11
+ begin
12
+ opts.parse!(ARGV)
13
+ rescue OptionParser::ParseError => e
14
+ warn e.message
15
+ puts opts
16
+ exit 1
17
+ end
18
+ end
19
+
20
+ unless ARGV.empty?
21
+ if !File.exist?(ARGV.first)
22
+ abort "`#{ARGV.first}' does not exist."
23
+ elsif !File.directory?(ARGV.first)
24
+ abort "`#{ARGV.first}' is not a directory."
25
+ elsif ARGV.length > 1
26
+ abort "Too many arguments; please specify only the directory to wheneverize."
27
+ end
28
+ end
29
+
30
+ content = <<-FILE
31
+ # Use this file to easily define all of your cron jobs.
32
+ #
33
+ # It's helpful, but not entirely necessary to understand cron before proceeding.
34
+ # http://en.wikipedia.org/wiki/Cron
35
+
36
+ # Example:
37
+ #
38
+ # set :output, "/path/to/my/cron_log.log"
39
+ #
40
+ # every 2.hours do
41
+ # command "/usr/bin/some_great_command"
42
+ # runner "MyModel.some_method"
43
+ # rake "some:great:rake:task"
44
+ # end
45
+ #
46
+ # every 4.days do
47
+ # runner "AnotherModel.prune_old_records"
48
+ # end
49
+
50
+ # Learn more: http://github.com/javan/whenever
51
+ FILE
52
+
53
+ file = 'config/schedule.rb'
54
+ base = ARGV.empty? ? '.' : ARGV.shift
55
+
56
+ file = File.join(base, file)
57
+ if File.exist?(file)
58
+ warn "[skip] `#{file}' already exists"
59
+ elsif File.exist?(file.downcase)
60
+ warn "[skip] `#{file.downcase}' exists, which could conflict with `#{file}'"
61
+ else
62
+ dir = File.dirname(file)
63
+ if !File.exist?(dir)
64
+ warn "[add] creating `#{dir}'"
65
+ FileUtils.mkdir_p(dir)
66
+ end
67
+ puts "[add] writing `#{file}'"
68
+ File.open(file, "w") { |f| f.write(content) }
69
+ end
70
+
71
+ puts "[done] wheneverized!"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 5.0.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 5.1.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 5.2.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,17 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 6.0.0"
10
+ gem "base64"
11
+ gem "bigdecimal"
12
+ gem "mutex_m"
13
+ gem "benchmark"
14
+ gem "logger"
15
+ gem "concurrent-ruby", "1.3.4"
16
+
17
+ gemspec path: "../"
@@ -0,0 +1,17 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 6.1.0"
10
+ gem "base64"
11
+ gem "bigdecimal"
12
+ gem "mutex_m"
13
+ gem "benchmark"
14
+ gem "logger"
15
+ gem "concurrent-ruby", "1.3.4"
16
+
17
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 7.0.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 7.1.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 7.2.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 8.0.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "mocha"
7
+ gem "minitest"
8
+ gem "appraisal"
9
+ gem "activesupport", "~> 8.1.0"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ require "whenever/capistrano/v2/recipes"
2
+
3
+ Capistrano::Configuration.instance(:must_exist).load do
4
+ # Write the new cron jobs near the end.
5
+ before "deploy:finalize_update", "whenever:update_crontab"
6
+ # If anything goes wrong, undo.
7
+ after "deploy:rollback", "whenever:update_crontab"
8
+ end
@@ -0,0 +1,49 @@
1
+ require 'whenever/capistrano/v2/support'
2
+
3
+ Capistrano::Configuration.instance(:must_exist).load do
4
+ Whenever::CapistranoSupport.load_into(self)
5
+
6
+ _cset(:whenever_roles) { :db }
7
+ _cset(:whenever_options) { {:roles => fetch(:whenever_roles)} }
8
+ _cset(:whenever_command) { "whenever" }
9
+ _cset(:whenever_identifier) { fetch :application }
10
+ _cset(:whenever_environment) { fetch :rails_env, fetch(:stage, "production") }
11
+ _cset(:whenever_variables) { "environment=#{fetch :whenever_environment}" }
12
+ _cset(:whenever_update_flags) { "--update-crontab #{fetch :whenever_identifier} --set #{fetch :whenever_variables}" }
13
+ _cset(:whenever_clear_flags) { "--clear-crontab #{fetch :whenever_identifier}" }
14
+ _cset(:whenever_path) { fetch :latest_release }
15
+
16
+ namespace :whenever do
17
+ desc "Update application's crontab entries using Whenever"
18
+ task :update_crontab do
19
+ args = {
20
+ :command => fetch(:whenever_command),
21
+ :flags => fetch(:whenever_update_flags),
22
+ :path => fetch(:whenever_path)
23
+ }
24
+
25
+ if whenever_servers.any?
26
+ args = whenever_prepare_for_rollback(args) if task_call_frames[0].task.fully_qualified_name == 'deploy:rollback'
27
+ whenever_run_commands(args)
28
+
29
+ on_rollback do
30
+ args = whenever_prepare_for_rollback(args)
31
+ whenever_run_commands(args)
32
+ end
33
+ end
34
+ end
35
+
36
+ desc "Clear application's crontab entries using Whenever"
37
+ task :clear_crontab do
38
+ if whenever_servers.any?
39
+ args = {
40
+ :command => fetch(:whenever_command),
41
+ :flags => fetch(:whenever_clear_flags),
42
+ :path => fetch(:whenever_path)
43
+ }
44
+
45
+ whenever_run_commands(args)
46
+ end
47
+ end
48
+ end
49
+ end