cronic 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Cronic
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -0,0 +1,21 @@
1
+ # Sample job definitions
2
+ #
3
+ # All *.rb files found in this directory will be instance_eval'd in the context
4
+ # of a Rufus::Scheduler instance, see
5
+ # https://github.com/jmettraux/rufus-scheduler for more methods and options.
6
+ #
7
+ # Jobs will be run with the full Rails application loaded. Consider placing
8
+ # your more complex job logic into separate worker classes to keep job
9
+ # definitions readable.
10
+
11
+
12
+ # output the current time every 5 minutes
13
+ every 5.minutes do
14
+ puts "The current time is: #{Time.now}"
15
+ end
16
+
17
+ # run at noon from monday to friday
18
+ cron '0 12 * * 1-5' do
19
+ puts "Go to lunch now."
20
+ end
21
+
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Usage:
4
+ #
5
+ # startup as daemon:
6
+ # script/cronic -d -l log/cronic.log -P tmp/pids/cronic.pid
7
+ #
8
+ # shutdown running daemon:
9
+ # script/cronic -k -P tmp/pids/cronic.pid
10
+
11
+
12
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
13
+ require File.expand_path('../../config/boot', __FILE__)
14
+
15
+ require APP_PATH
16
+ Rails.application.require_environment!
17
+
18
+ require "cronic"
19
+ require "dante"
20
+
21
+
22
+ Dante.run('cronic scheduler') do
23
+ scheduler = Cronic::Scheduler.new
24
+ Dir[Rails.root.join('config', 'cronic.d', '**/*.rb')].each do |file|
25
+ puts "loading #{file}"
26
+ scheduler.load_jobs file
27
+ end
28
+ puts "Finished loading job definitions."
29
+ scheduler.join
30
+ end
31
+
metadata CHANGED
@@ -1,104 +1,123 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cronic
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
6
11
  platform: ruby
7
- authors:
8
- - Jens Krämer
12
+ authors:
13
+ - "Jens Kr\xC3\xA4mer"
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-11-27 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-03-07 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rufus-scheduler
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 2.0.17
22
- type: :runtime
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
- requirements:
25
+ requirements:
27
26
  - - ~>
28
- - !ruby/object:Gem::Version
27
+ - !ruby/object:Gem::Version
28
+ hash: 45
29
+ segments:
30
+ - 2
31
+ - 0
32
+ - 17
29
33
  version: 2.0.17
30
- - !ruby/object:Gem::Dependency
31
- name: dante
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 0.1.5
38
34
  type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: dante
39
38
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
39
+ requirement: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
- requirements:
41
+ requirements:
43
42
  - - ~>
44
- - !ruby/object:Gem::Version
43
+ - !ruby/object:Gem::Version
44
+ hash: 17
45
+ segments:
46
+ - 0
47
+ - 1
48
+ - 5
45
49
  version: 0.1.5
46
- - !ruby/object:Gem::Dependency
47
- name: rails
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '3'
54
50
  type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: rails
55
54
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
55
+ requirement: &id003 !ruby/object:Gem::Requirement
57
56
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '3'
62
- description: Taking advantage of Rufus Scheduler and Dante to provide a long running
63
- daemon for cron like jobs to be run in the context of your Rails application, without
64
- loading the full environment each and every time a job is run.
65
- email:
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 5
61
+ segments:
62
+ - 3
63
+ version: "3"
64
+ type: :runtime
65
+ version_requirements: *id003
66
+ description: Taking advantage of Rufus Scheduler and Dante to provide a long running daemon for cron like jobs to be run in the context of your Rails application, without loading the full environment each and every time a job is run.
67
+ email:
66
68
  - jk@jkraemer.net
67
69
  executables: []
70
+
68
71
  extensions: []
72
+
69
73
  extra_rdoc_files: []
70
- files:
74
+
75
+ files:
71
76
  - lib/cronic/recipes.rb
72
77
  - lib/cronic/scheduler.rb
73
78
  - lib/cronic/version.rb
74
79
  - lib/cronic.rb
75
80
  - lib/generators/cronic_generator.rb
76
81
  - recipes/cronic.rb
82
+ - templates/config/cronic.d/sample.rb
83
+ - templates/script/cronic
77
84
  - LICENSE
78
85
  - CHANGELOG.md
79
86
  - README.md
80
87
  homepage: http://github.com/jkraemer/cronic
81
88
  licenses: []
89
+
82
90
  post_install_message:
83
91
  rdoc_options: []
84
- require_paths:
92
+
93
+ require_paths:
85
94
  - lib
86
- required_ruby_version: !ruby/object:Gem::Requirement
95
+ required_ruby_version: !ruby/object:Gem::Requirement
87
96
  none: false
88
- requirements:
89
- - - ! '>='
90
- - !ruby/object:Gem::Version
91
- version: '0'
92
- required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
105
  none: false
94
- requirements:
95
- - - ! '>='
96
- - !ruby/object:Gem::Version
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ hash: 23
110
+ segments:
111
+ - 1
112
+ - 3
113
+ - 6
97
114
  version: 1.3.6
98
115
  requirements: []
116
+
99
117
  rubyforge_project: cronic
100
- rubygems_version: 1.8.23
118
+ rubygems_version: 1.8.25
101
119
  signing_key:
102
120
  specification_version: 3
103
121
  summary: Cron like scheduler daemon for Rails applications
104
122
  test_files: []
123
+