quartz-jruby 0.1.0 → 0.1.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.
data/README.markdown CHANGED
@@ -4,9 +4,17 @@ From [Quartz Scheduler's website](http://www.quartz-scheduler.org/)
4
4
 
5
5
  > Quartz is a full-featured, open source job scheduling service that can be integrated with, or used along side virtually any Java EE or Java SE application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components that may executed virtually anything you may program them to do. The Quartz Scheduler includes many enterprise-class features, such as JTA transactions and clustering.
6
6
 
7
+ Here is a quick [blog post](http://www.artha42.com/blog/scheduling_jobs_with_quartz_jruby) comparing the the Java version to the Ruby Version.
7
8
 
8
9
  ## Usage
9
10
 
11
+ Install with
12
+
13
+ $ gem install quartz-jruby
14
+
15
+ You need to require the jars included /java directory independently.
16
+
17
+ require 'quartz'
10
18
  class TestScheduler
11
19
  include Quartz::Scheduler
12
20
  schedule(:say_hello_5, :every=>5.seconds) { info "every 5 seconds" }
@@ -14,6 +22,8 @@ From [Quartz Scheduler's website](http://www.quartz-scheduler.org/)
14
22
  end
15
23
  TestScheduler.instance.run
16
24
 
25
+ If you use log4j in your app, quartz-jruby integrates with it as well.
26
+
17
27
  ## Feedback
18
28
 
19
29
  If you have any feedback, send me an email vagmi <at> [artha42.com](http://www.artha42.com).
@@ -17,32 +17,33 @@ module Quartz
17
17
  end
18
18
 
19
19
  module ClassMethods
20
- def schedule(name,options,&block)
21
- instance.schedule(name,options,block)
20
+ def schedule(name, options, &block)
21
+ instance.schedule(name, options, block)
22
22
  end
23
23
  def log
24
24
  org.apache.log4j.Logger.get_logger(self.name)
25
25
  end
26
26
  def info(msg)
27
- log.log(org.apache.log4j.Level::INFO,msg)
27
+ log.log(org.apache.log4j.Level::INFO, msg)
28
28
  end
29
29
  def error(msg)
30
- log.log(org.apache.log4j.Level::ERROR,msg)
30
+ log.log(org.apache.log4j.Level::ERROR, msg)
31
31
  end
32
32
  def warn(msg)
33
- log.log(org.apache.log4j.Level::WARN,msg)
33
+ log.log(org.apache.log4j.Level::WARN, msg)
34
34
  end
35
35
  end
36
36
 
37
37
  module InstanceMethods
38
38
  def schedule(name, options, block)
39
- options=defaults.merge options
39
+ options = defaults.merge options
40
40
  job_factory.jobs[name.to_s] = block
41
- job_detail = JobDetail.new(name.to_s, "cronjob",CronJob.new(name.to_s))
42
- cron_expression = Cronify.cronify(options[:every],options[:at])
43
- trigger=CronTrigger.new("#{name.to_s}_crontrig","cront_trig_group",name.to_s,"cronjob",cron_expression)
41
+ job_detail = JobDetail.new(name.to_s, "cronjob", CronJob.new(name.to_s))
42
+ at = Time.parse(options[:at]) rescue nil || options[:at]
43
+ cron_expression = Cronify.cronify(options[:every], at)
44
+ trigger = CronTrigger.new("#{name.to_s}_crontrig", "cront_trig_group", name.to_s, "cronjob", cron_expression)
44
45
  scheduler.set_job_factory(job_factory)
45
- scheduler.schedule_job(job_detail,trigger)
46
+ scheduler.schedule_job(job_detail, trigger)
46
47
  end
47
48
  def defaults
48
49
  {
@@ -1,3 +1,3 @@
1
1
  module Quartz
2
- VERSION="0.1.0"
2
+ VERSION="0.1.1"
3
3
  end
@@ -5,6 +5,6 @@ class TestScheduler
5
5
  include Quartz::Scheduler
6
6
  schedule(:say_hello_5, :every=>5.seconds) { info "every 5 seconds" }
7
7
  schedule(:say_hello_30, :every=>30.seconds) { error "every 30 seconds" }
8
-
8
+ schedule(:say_hello_at, :every=>1.day, :at=>'15:06:00') { info "fire at 3:05 pm" }
9
9
  end
10
10
  TestScheduler.instance.run
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Vagmi Mudumbai
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-02 00:00:00 +05:30
17
+ date: 2011-01-11 00:00:00 +05:30
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency