auto_cron 0.1.14 → 0.1.15
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.
- data/README.rdoc +35 -10
- data/VERSION +1 -1
- data/auto_cron.gemspec +2 -2
- data/lib/auto_cron.rb +1 -2
- data/lib/capistrano/auto_cron.rb +2 -1
- metadata +4 -4
data/README.rdoc
CHANGED
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
= auto_cron
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Powerful way to manage crontabs using capistrano.
|
|
4
|
+
|
|
5
|
+
== Getting started
|
|
6
|
+
1) Add auto_cron to your Gemfile
|
|
7
|
+
|
|
8
|
+
2) In your capistrano deploy.rb file, add:
|
|
9
|
+
|
|
10
|
+
require "capistrano/auto_cron"
|
|
11
|
+
|
|
12
|
+
after "deploy:restart", "auto_cron:publish"
|
|
13
|
+
|
|
14
|
+
3) If using ext/multistage: In deploy/production.rb, e.g. add:
|
|
15
|
+
|
|
16
|
+
set :auto_cron_templates, %w( publish production )
|
|
17
|
+
|
|
18
|
+
role :publish_crons, "cron-internal.example.com"
|
|
19
|
+
|
|
20
|
+
4) In config/auto_cron, add erb files corresponding to the files specified in step 3
|
|
21
|
+
|
|
22
|
+
e.g., config/auto_cron/publish.erb
|
|
23
|
+
|
|
24
|
+
# crons for production
|
|
25
|
+
*/5 * * * * cd /mnt/apps/mysite && bundle exec rake thinking_sphinx:index RAILS_ENV=<%= Rails.env %>
|
|
26
|
+
|
|
27
|
+
== Advantages over other ruby cron managers
|
|
28
|
+
|
|
29
|
+
* Uses crontab syntax, not a DSL that is going to get in your way
|
|
30
|
+
|
|
31
|
+
* Uses ERB, everyone is familiar
|
|
32
|
+
|
|
33
|
+
* Customize crons across environment
|
|
34
|
+
|
|
35
|
+
* Crons are namespaced using application name specified in capistrano deploy file, so you can write crons for multiple apps to the same crontab without collision
|
|
4
36
|
|
|
5
37
|
== Contributing to auto_cron
|
|
6
38
|
|
|
7
|
-
*
|
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
|
9
|
-
* Fork the project
|
|
10
|
-
* Start a feature/bugfix branch
|
|
11
|
-
* Commit and push until you are happy with your contribution
|
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
|
39
|
+
* Contributions welcome, fork the project
|
|
14
40
|
|
|
15
41
|
== Copyright
|
|
16
42
|
|
|
17
|
-
Copyright (c) 2011 Alex Farrill. See LICENSE.txt for
|
|
18
|
-
further details.
|
|
43
|
+
Copyright (c) 2011 Alex Farrill. See LICENSE.txt for further details.
|
|
19
44
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.15
|
data/auto_cron.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{auto_cron}
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.15"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Alex Farrill"]
|
|
12
|
-
s.date = %q{2011-11-
|
|
12
|
+
s.date = %q{2011-11-23}
|
|
13
13
|
s.description = %q{Generate a crontab}
|
|
14
14
|
s.email = %q{alex.farrill@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/auto_cron.rb
CHANGED
|
@@ -3,8 +3,7 @@ require 'auto_cron/railtie' if defined?(Rails)
|
|
|
3
3
|
class AutoCron
|
|
4
4
|
def initialize( templates, application )
|
|
5
5
|
require 'erb'
|
|
6
|
-
|
|
7
|
-
@auto_cron_dir = File.join( Rails.root, "config", "auto_cron" )
|
|
6
|
+
@auto_cron_dir = ENV["CONFIG_AUTO_CRON"]
|
|
8
7
|
@templates = templates.split(",")
|
|
9
8
|
@application = application
|
|
10
9
|
end
|
data/lib/capistrano/auto_cron.rb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Capistrano::Configuration.instance.load do
|
|
2
2
|
namespace :auto_cron do
|
|
3
3
|
task :publish, :roles => :publish do
|
|
4
|
-
|
|
4
|
+
@config_dir = File.join release_path, "config", "auto_cron"
|
|
5
|
+
run "cd #{release_path} && #{rake} TEMPLATES=#{fetch(:auto_cron_templates, %w( publish )).join(",")} APPLICATION=#{application} RAILS_ENV=#{rails_env} CONFIG_AUTO_CRON=#{@config_dir} auto_cron"
|
|
5
6
|
end
|
|
6
7
|
end
|
|
7
8
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auto_cron
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 5
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 1
|
|
9
|
-
-
|
|
10
|
-
version: 0.1.
|
|
9
|
+
- 15
|
|
10
|
+
version: 0.1.15
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Alex Farrill
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-11-
|
|
18
|
+
date: 2011-11-23 00:00:00 -05:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|