day_planner 0.1.0.pre17 → 0.1.0.pre18

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: a74ddae8b98993a1585fe8cecf359e550fa6c3f9
4
- data.tar.gz: a8d7be50dc05066c38708ccf3adfebdb36010a93
3
+ metadata.gz: 54e7c7defa992590f7a9b23bace79f15a9932957
4
+ data.tar.gz: fed59fdc0ca7b46285c0c866b1385478af633135
5
5
  SHA512:
6
- metadata.gz: a114a9bf382eee55536f4b096e74737c7f5e44c105cf558178708d5151fecb26e98d1b135f86e67e65aa3b79156fab497b42188071dda955c23bac53df6e57f2
7
- data.tar.gz: 60b7d571150543254f7ce6d6790937802a1bd75413dd271ed74beba29d66baeb3e2c28eb002ed62f7f454863017803e2856ddd7718b86fd68c7e0a544d960aed
6
+ metadata.gz: a3cb492de98bb9ab46479c2bff385a436555c79a645e2c6a047458d418dea65af7e8371ca8b64fd49610a17ef6bee5b049963676ebacd8a04583119511e609c8
7
+ data.tar.gz: d70c9739ba2ec643cfc8958cfe0d8d9e9787e3bda1b980c66692c1d045fd1e905ee15f9005603a16cd0474f48c1ee1d65cac16e47e9f77aca9bc30b32979f010
data/README.md CHANGED
@@ -73,6 +73,15 @@ Note that if you try to schedule a task with an interval shorter than DayPlanner
73
73
 
74
74
  Specify your preferred interval (and whatever other settings which may be implemented one day) in config/scheduled_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 to change the setting. If you alter this value while DayPlanner is already running, it won't take effect until the current interval ends.
75
75
 
76
+ ### Logging
77
+
78
+ If you'd like to log your tasks, go for it. Add logging thusly:
79
+
80
+ rails generate day_planner:log
81
+ rake db:migrate
82
+
83
+ This just adds an extra table entitled 'day_planner_log'. As long as the table's there, it'll log each task execution, as well as every instance in which DayPlanner activates. Clear the log as the spirit takes you. Do what you do best.
84
+
76
85
  ## Contributing
77
86
 
78
87
  1. Fork it
@@ -21,9 +21,14 @@ module DayPlanner
21
21
  task = DayPlanner::Task.create(fields)
22
22
  end
23
23
 
24
- def log
24
+ def log(last, now)
25
25
  if ActiveRecord::Base.connection.table_exists?('day_planner_log')
26
- DayPlanner::Log.create(name: name, interval: interval, datetime: Time.now)
26
+ if now < last + interval
27
+ early = last + interval - now
28
+ else
29
+ early = nil
30
+ end
31
+ DayPlanner::Log.create(name: name, interval: interval, datetime: Time.now, early: early)
27
32
  end
28
33
  end
29
34
 
@@ -121,7 +121,7 @@ module DayPlanner
121
121
 
122
122
  task.save!
123
123
 
124
- t.log
124
+ t.log(task.last_execution, time)
125
125
  t.block.call
126
126
  end
127
127
  end
@@ -1,9 +1,12 @@
1
1
  class CreateDayPlannerLog < ActiveRecord::Migration
2
2
  def up
3
+ drop table :day_planner_log
4
+
3
5
  create_table :day_planner_log do |t|
4
6
  t.string :name
5
7
  t.integer :interval
6
8
  t.datetime :datetime
9
+ t.early :datetime
7
10
  end
8
11
  end
9
12
 
@@ -2,7 +2,7 @@ module DayPlanner
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
4
  TINY = 0
5
- PRE = "pre17"
5
+ PRE = "pre18"
6
6
  BUILD = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, TINY, PRE, BUILD].compact.join(".")
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.1.0.pre17
4
+ version: 0.1.0.pre18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damon Siefert