totalizer 0.1.2 → 0.1.3

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: 9fac0dec1ae7285a0f81968e4fce2ff7563a3530
4
- data.tar.gz: 9cda6a130b3130b402cc0286de8c59197b36991b
3
+ metadata.gz: 7e2ecb903857aa2c383d1cbf1b73faa7fbde1849
4
+ data.tar.gz: cb093ae0bbe5957961644821b9c21f492a9cabc8
5
5
  SHA512:
6
- metadata.gz: b6236213e7a88889002a9307d7425f137b4e7186a7d8a22878b8d484ec23a9c640fb08e780c855fc6d36e73c903b771c0ad23a135b79f55b00a14dd2b92eae16
7
- data.tar.gz: 3276b0bdbbf6e1b1a55b6212a24fe3b1596c033a662f74e2b937056ad9a136f4b2c9d1097e568c92ee198084b3546f4299e65d4e461948c4665cb7a8ce9cd7e4
6
+ metadata.gz: 2e532b1f38e433cc55a514e9731bdc93e14fb4667d0a8ee5e8f1f82f7932d392c55efe697ece238b000c86e4f845231ba6f95ccf3d631a8819ff06f614f4c585
7
+ data.tar.gz: 35f353bfe7d244f7aafdb36f90c6e04c2350eeaca5d0a8276ead0cb3d204dcc8ea16a6df2cf60ac983357f0a00488d0145ac47cb969997866770af18f309b9fc
data/README.md CHANGED
@@ -179,6 +179,22 @@ Churn
179
179
  Last 30 days: 3.29% (34/1032)
180
180
  ```
181
181
 
182
+ ### Combined
183
+
184
+ You can also run a single rake task every day which will run execute the daily
185
+ task each time and execute the weekly task on a defined week day which by
186
+ default is Monday.
187
+
188
+ ```
189
+ $ rake totalizer:combined
190
+ ```
191
+
192
+ To change the week day add the following line to your initializer:
193
+
194
+ ```ruby
195
+ Totalizer.weekly_day = 0 #(0-6, Sunday is zero)
196
+ ```
197
+
182
198
  ***
183
199
 
184
200
  In addition to Metric, you can also use the following underlying objects.
@@ -14,7 +14,7 @@ namespace :totalizer do
14
14
  end
15
15
 
16
16
  task weekly: :validate do
17
- Totalizer.logger.info "Totalizer: Daily"
17
+ Totalizer.logger.info "Totalizer: Weekly"
18
18
  messages = {
19
19
  activation: [Totalizer.generate(:activation, 7), Totalizer.generate(:activation, 30)],
20
20
  engagement: [Totalizer.generate(:engagement, 7), Totalizer.generate(:engagement, 30)],
@@ -23,4 +23,9 @@ namespace :totalizer do
23
23
  }
24
24
  Totalizer.notify messages
25
25
  end
26
+
27
+ task combined: :validate do
28
+ Rake::Task["daily"].invoke
29
+ Rake::Task["weekly"].invoke if DateTime.now.wday == Totalizer.weekly_day
30
+ end
26
31
  end
@@ -45,4 +45,12 @@ module Totalizer
45
45
  notifier = NOTIFIERS[notifier_options.first].constantize
46
46
  notifier.call(message_groups, notifier_options.last)
47
47
  end
48
+
49
+ def weekly_day
50
+ @weekly_day ||= 1
51
+ end
52
+
53
+ def weekly_day= day
54
+ @weekly_day = day
55
+ end
48
56
  end
@@ -1,3 +1,3 @@
1
1
  module Totalizer
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totalizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Dijkstra