day_planner 0.0.12.1 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a18356accc7526285959f70146b9d69b4e3f7a73
4
- data.tar.gz: cb79a13c6db5840e060f8edbe012a990aa0e5c96
3
+ metadata.gz: 2f22f16d1b49963c3290b1e6a8e91d3f4dfd1797
4
+ data.tar.gz: e6514798c238eab344078c3d2ca75fa418ea2a65
5
5
  SHA512:
6
- metadata.gz: bbda3bb5e7ccd6c4b42cb6af1053e2f54eed73604c6be6be922d5fbc095cad5ba2c520820dc650da6cb83203d164881e9c8b77574aea73e063460c2657499c56
7
- data.tar.gz: f1d489524a7729ce29c6d6845d9e9e54364abaacdcc9d451104ea6433b336e000c89b74310eeb03ab1dc87f65a5d4e554009867653acd078526f71d367c3229b
6
+ metadata.gz: d3b4905a664d1695fb2a6ffaa828da69822ef077f5537d50cf2f226d14f57b3a08a47e1b618aab07711edccf6edc5c8694f50fd244f8e648e3243c59b4e70d6f
7
+ data.tar.gz: 013cb5b39b8c68cb3ba8b283f63c1d8ab5ac19efb8adbf9f991bcd855e9bc34413686e073f87bf1232df13951fb69a3977f7e35d48c49f5f7f304fb097c702dc
data/README.md CHANGED
@@ -14,11 +14,7 @@ Add this line to your application's Gemfile:
14
14
 
15
15
  And then execute:
16
16
 
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install day_planner
17
+ $ bundle install
22
18
 
23
19
  If you're using Rails, it'll expect to find a file listing scheduled tasks in 'config/scheduled_tasks.rb'. If you're not using Rails, do whatever makes you happy. Stick some scheduled tasks somewhere and make sure it's somewhere that runs when your application starts.
24
20
 
@@ -50,19 +46,7 @@ I have not tested it outside of Rails and it may not work at all but ideally I'd
50
46
 
51
47
  The tasks in the schedule will each be performed on startup and then thereafter according to their stated intervals.
52
48
 
53
- I'm not doing a whole damn ton to protect you from tasks that throw errors, but there is a begin/rescue/end up in there at some point. I definitely am not protecting you from a process that just won't end or anything like that. Remember that your interval is really the minimum possible time between instances of the task being performed, as it does not spawn a new thread for that purpose.
54
-
55
- By default, DayPlanner checks for tasks to be performed once per minute. You have the power to change this:
56
-
57
- DayPlanner.interval = 5.seconds
58
-
59
- Or, like
60
-
61
- DayPlanner.interval = 5
62
-
63
- Note that if you try to schedule a task with an interval shorter than DayPlanner's interval, it'll complain and fail. If you shorten DayPlanner's interval to less than that of one of its tasks, it'll complain but not fail. The task obviously will only run at scheduler thread's intervals. Use your best judgment.
64
-
65
- Specify your preferred interval (and whatever other goodies may be waiting in the pipeline) in config/day_planner_tasks.rb. Note that you probably won't manage to precede that first minute-long wait. I may default to a shorter value in the future. I dunno. Don't pressure me.
49
+ I'm not doing a whole damn ton to protect you from tasks that throw errors, but there is a begin/rescue/end up in there at some point. I definitely am not protecting you from a process that just won't end or anything like that. Remember that your interval is really the minimum possible time between instances of the task being performed, as it does not spawn a new thread for each task. (That seemed to cause problems with Heroku.)
66
50
 
67
51
  ### Other options
68
52
 
@@ -85,11 +69,32 @@ If you're using Rails, you can include environment in your options hash, setting
85
69
  # I run every hour, but only if you're using Rails and in production.
86
70
  end
87
71
 
72
+ ### Managing DayPlanner and tasks
73
+
74
+ You can activate or deactivate DayPlanner with those respective methods. You can also check whether it's running with DayPlanner.status.
75
+
88
76
  To cancel a task, you can either call the task's "destroy" method, or call a class method on DayPlanner:
77
+
89
78
  DayPlanner.cancel(task)
90
79
 
91
80
  You can either pass a name, if you named the task, or the task object.
92
81
 
82
+ #### DayPlanner.interval
83
+
84
+ By default, DayPlanner checks for tasks to be performed once per minute. You have the power to change this:
85
+
86
+ DayPlanner.interval = 5.seconds
87
+
88
+ Or, like
89
+
90
+ DayPlanner.interval = 5
91
+
92
+ Since tasks are not run in separate threads (this seemed to be giving me database connection issues on Heroku), remember that the interval is basically a minimum possible period before it's performed again -- if a task takes time to run, keep that in mind (or spin off a new thread yourself in the task).
93
+
94
+ Note that if you try to schedule a task with an interval shorter than DayPlanner's interval, it'll complain and fail. If you shorten DayPlanner's interval to less than that of one of its tasks, it'll complain but not fail. The task obviously will only run at scheduler thread's intervals. Use your best judgment.
95
+
96
+ Specify your preferred interval (and whatever other goodies may be waiting in the pipeline) in config/day_planner_tasks.rb. As long as you set your interval before DayPlanner is activated, you won't have to wait for it to cycle through an interval. If you alter this value while DayPlanner is already running, it won't take effect until the current interval ends.
97
+
93
98
  ## Contributing
94
99
 
95
100
  1. Fork it
@@ -98,7 +98,7 @@ module DayPlanner
98
98
  attr_reader :last_executed, :interval
99
99
 
100
100
  def perform
101
- if @environment.nil? || (defined?(Rails) && defined?(Rails.environment) && Rails.environment == @environment)
101
+ if @environment.nil? || (defined?(Rails) && defined?(Rails.env) && Rails.env == @environment)
102
102
  @last_executed = Time.now
103
103
 
104
104
  @task.call
@@ -1,8 +1,8 @@
1
1
  module DayPlanner
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- TINY = 12
5
- BUILD = 1
4
+ TINY = 13
5
+ BUILD = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, TINY, BUILD].compact.join(".")
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: day_planner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12.1
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damon Siefert
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.0.3
78
+ rubygems_version: 2.0.14
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Built to have a way to schedule tasks without running an extra process and