cwninja-whenever 0.1.5.1 → 0.1.5.2

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 CHANGED
@@ -89,6 +89,15 @@ USING THE "--write-crontab" OPTION WILL COMPLETELY OVERWRITE ANY EXISTING CRONTA
89
89
 
90
90
  You can use --update-crontab to simply update whenever generated tasks.
91
91
 
92
+ You can use --marker to customize crontab marker for each Rails app
93
+
94
+ namespace :deploy do
95
+ desc "write the crontab file"
96
+ task :write_crontab, :roles => :app do
97
+ run "cd #{release_path} && whenever --update-crontab --marker crontab_for_my_app_name"
98
+ end
99
+ end
100
+
92
101
  == Credit
93
102
 
94
103
  Whenever was created for use at Inkling (http://inklingmarkets.com) where I work.
data/bin/whenever CHANGED
@@ -15,6 +15,7 @@ OptionParser.new do |opts|
15
15
  opts.on('-v', '--version') { puts "Whenever v#{Whenever::VERSION::STRING}"; exit }
16
16
  opts.on('-w', '--write-crontab') { options[:write] = true }
17
17
  opts.on('-p', '--update-crontab') { options[:update] = true }
18
+ opts.on('-m', '--marker [a specific string token]') { |token| options[:marker] = token }
18
19
  opts.on('-f', '--load-file [schedule file]', 'default: config/schedule.rb') do |file|
19
20
  options[:file] = file if file
20
21
  end
data/bin/wheneverize CHANGED
File without changes
data/lib/command_line.rb CHANGED
@@ -1,12 +1,20 @@
1
-
2
1
  class CommandLine
3
2
  START_MARKER = "### BEGIN whenever generated crontab ###"
4
3
  END_MARKER = "### END whenever generated crontab ###"
5
-
4
+
6
5
  attr_reader :options
7
-
6
+
7
+ def start_marker
8
+ "### BEGIN #{@marker} ###"
9
+ end
10
+
11
+ def end_marker
12
+ "### END #{@marker} ###"
13
+ end
14
+
8
15
  def initialize(options = {})
9
16
  @options = options
17
+ @marker = options[:marker] || "whenever generated crontab"
10
18
  end
11
19
 
12
20
  def write!
@@ -17,15 +25,15 @@ class CommandLine
17
25
  def update!
18
26
  before, after = strip_whenever_crontab(read_crontab)
19
27
  whenever_cron = Whenever.cron(:file => options[:file])
20
- write_crontab((before + [START_MARKER, whenever_cron, END_MARKER] + after).compact.join("\n"))
28
+ write_crontab((before + [start_marker, whenever_cron, end_marker] + after).compact.join("\n"))
21
29
  end
22
30
 
23
31
  private
24
32
  def strip_whenever_crontab(existing_crontab)
25
33
  return [], [] if existing_crontab.nil? or existing_crontab == ""
26
34
  lines = existing_crontab.split("\n")
27
- if start = lines.index(START_MARKER)
28
- if finish = lines.index(END_MARKER)
35
+ if start = lines.index(start_marker)
36
+ if finish = lines.index(end_marker)
29
37
  return lines[0...start], lines[(finish + 1)..-1]
30
38
  else
31
39
  warn "[fail] could not find END marker in existing crontab"
data/lib/version.rb CHANGED
@@ -3,7 +3,7 @@ module Whenever
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
5
  TINY = 5
6
- FORK = 1
6
+ FORK = 2
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, FORK].join('.')
9
9
  end
data/whenever.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{whenever}
5
- s.version = "0.1.5.1"
5
+ s.version = "0.1.5.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Javan Makhmali"]
9
- s.date = %q{2009-02-20}
9
+ s.date = %q{2009-02-23}
10
10
  s.description = %q{Provides clean ruby syntax for defining messy cron jobs and running them Whenever.}
11
11
  s.email = %q{javan@javan.us}
12
12
  s.executables = ["whenever", "wheneverize"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cwninja-whenever
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5.1
4
+ version: 0.1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javan Makhmali
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-20 00:00:00 -08:00
12
+ date: 2009-02-23 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency