ruby-clock 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +18 -0
- data/README.md +16 -10
- data/lib/ruby-clock/version.rb +1 -1
- data/ruby-clock.gemspec +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 380a0d3214236bb95f84bcb5aa3a04fc74e6ef916e4e064a71c13bcfb76a6f15
|
4
|
+
data.tar.gz: ca43eca30e42447cdcfc563e0768ee0326f62679754996e0e6007774a62a9055
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bbf359d4a3523904d1e81c816cb89a11267a0fac2f4f891deb4bc27cb89834d4f70f34cda3a7849bfaa0b1184a8a8541e3e895f93d107402170e6a7f09816f3
|
7
|
+
data.tar.gz: 2896961f63395b0eb4fa22d4fe47a4df5466dc7f3577afc5c1feac7fb3e7bb4315609ae6e4f14a56d223fe8ac3d70f20704d23f2fd01867501de874c75e01d0f
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,31 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ruby-clock (0.1.0)
|
5
|
+
rufus-scheduler (>= 3.7.0)
|
6
|
+
|
1
7
|
GEM
|
2
8
|
remote: https://rubygems.org/
|
3
9
|
specs:
|
10
|
+
concurrent-ruby (1.1.7)
|
11
|
+
et-orbi (1.2.4)
|
12
|
+
tzinfo
|
13
|
+
fugit (1.4.1)
|
14
|
+
et-orbi (~> 1.1, >= 1.1.8)
|
15
|
+
raabro (~> 1.4)
|
16
|
+
raabro (1.4.0)
|
4
17
|
rake (12.3.3)
|
18
|
+
rufus-scheduler (3.7.0)
|
19
|
+
fugit (~> 1.1, >= 1.1.6)
|
20
|
+
tzinfo (2.0.4)
|
21
|
+
concurrent-ruby (~> 1.0)
|
5
22
|
|
6
23
|
PLATFORMS
|
7
24
|
ruby
|
8
25
|
|
9
26
|
DEPENDENCIES
|
10
27
|
rake (~> 12.0)
|
28
|
+
ruby-clock!
|
11
29
|
|
12
30
|
BUNDLED WITH
|
13
31
|
2.1.4
|
data/README.md
CHANGED
@@ -23,10 +23,6 @@ Add these lines to your application's Gemfile:
|
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
gem 'ruby-clock'
|
26
|
-
|
27
|
-
# ruby-clock currently depends on rufus-scheduler master
|
28
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
29
|
-
gem 'rufus-scheduler', github: 'jmettraux/rufus-scheduler'
|
30
26
|
```
|
31
27
|
|
32
28
|
And then execute:
|
@@ -39,7 +35,8 @@ Or install it yourself as:
|
|
39
35
|
|
40
36
|
## Usage
|
41
37
|
|
42
|
-
|
38
|
+
Create a file named Clockfile. This will hold your job definitions.
|
39
|
+
The DSL and capabilities
|
43
40
|
are the same as those of [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler/).
|
44
41
|
Read the rufus-scheduler documentation to see what you can do.
|
45
42
|
|
@@ -49,7 +46,7 @@ schedule.every('5 minutes') do
|
|
49
46
|
end
|
50
47
|
|
51
48
|
# do something every day, five minutes after midnight
|
52
|
-
|
49
|
+
schedule.cron '5 0 * * *' do
|
53
50
|
DailyActivitySummary.generate_and_send
|
54
51
|
end
|
55
52
|
```
|
@@ -86,16 +83,25 @@ clock: bundle exec rails runer clock
|
|
86
83
|
|
87
84
|
### Error Handling
|
88
85
|
|
89
|
-
|
86
|
+
You can catch and report errors raised in your jobs by defining an error catcher at
|
87
|
+
the top of your Clockfile like this:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
def schedule.on_error(job, error)
|
91
|
+
ErrorReporter.track_exception(error)
|
92
|
+
end
|
93
|
+
```
|
90
94
|
|
91
95
|
### Callbacks
|
92
96
|
|
93
|
-
|
97
|
+
You can define before, after, and around callbacks which will run for all jobs.
|
98
|
+
Read [the rufus-scheduler documentation](https://github.com/jmettraux/rufus-scheduler/#callbacks)
|
99
|
+
to learn how to do this. Where the documentation references `s`, you should use `schedule`.
|
94
100
|
|
95
|
-
### rufus-scheduler Options
|
101
|
+
### other rufus-scheduler Options
|
96
102
|
|
97
103
|
All rufus-scheduler options are set to defaults. The `schedule` variable
|
98
|
-
|
104
|
+
available in your Clockfile is an instance of `Rufus::Scheduler`,
|
99
105
|
so anything you can do on this instance, you can do in your Clockfile.
|
100
106
|
|
101
107
|
Perhaps in the future ruby-clock will add some easier specific configuration
|
data/lib/ruby-clock/version.rb
CHANGED
data/ruby-clock.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-clock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bachir
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
12
|
-
dependencies:
|
11
|
+
date: 2020-12-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rufus-scheduler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.7.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.7.0
|
13
27
|
description:
|
14
28
|
email:
|
15
29
|
- j@jjb.cc
|