todo_or_die 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: '0491e8c47bb1f59f0b38966bb65a8dbd6d31a18aa9044ca9445cce8962c55e62'
4
- data.tar.gz: c82c1ce0e56afbfb197ff4d7a66d7187003ef085b58d7096c510696faca4dbc9
3
+ metadata.gz: 7cc7971ad1d363af9350c7f9bdc7ae6884104ad1161b1a584de791eb1bccd2f6
4
+ data.tar.gz: 037644cf228dd8c3fae1f15fe568d11c50aebff47494a040ee6702198305464b
5
5
  SHA512:
6
- metadata.gz: 18751ea8ecfeb4e50ddbdc42229b721957a86bd5d6535655264dec37a46f99f68596fd98be14eb2d585395956cf0b1c01712610750664fae8c8bfa910ac4e0b2
7
- data.tar.gz: 6fdf682b441ce3edf280f1322cc4a88bf6af9c84057334eef449e894fcd41ff20a3a2164ccd80a13bbe0214787101c0ff38e24cff1f73ae2353853eaf1563c4c
6
+ metadata.gz: fce9ed473d8727a3596380df75079d51e88c23328dc741bc700eaaafd167fcec00a5b510f84931134860a530bf7692ca6dff9f9e62d93eec3b8ad3b085b4428f
7
+ data.tar.gz: 70a8d8b3df3da35509932cb01ab3f2861b79e7e030602183e581d0a8ea83018dfeb675254618976788789f20aec052323a84b157f587a4a75e31c669bfbb1f4c
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.1.1] - 2022-07-01
8
+
9
+ - Fix `warn_by` [#16](https://github.com/searls/todo_or_die/pull/16)
10
+
7
11
  ## [0.1.0] - 2022-06-27
8
12
 
9
13
  - Add `warn_by` option [#14](https://github.com/searls/todo_or_die/pull/14)
data/Gemfile.lock CHANGED
@@ -1,36 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- todo_or_die (0.1.0)
4
+ todo_or_die (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
10
- jaro_winkler (1.5.4)
11
- minitest (5.11.3)
12
- parallel (1.19.1)
13
- parser (2.7.1.2)
14
- ast (~> 2.4.0)
15
- rainbow (3.0.0)
16
- rake (13.0.1)
17
- rexml (3.2.4)
18
- rubocop (0.82.0)
19
- jaro_winkler (~> 1.5.1)
9
+ ast (2.4.2)
10
+ minitest (5.16.1)
11
+ parallel (1.22.1)
12
+ parser (3.1.2.0)
13
+ ast (~> 2.4.1)
14
+ rainbow (3.1.1)
15
+ rake (13.0.6)
16
+ regexp_parser (2.5.0)
17
+ rexml (3.2.5)
18
+ rubocop (1.29.1)
20
19
  parallel (~> 1.10)
21
- parser (>= 2.7.0.1)
20
+ parser (>= 3.1.0.0)
22
21
  rainbow (>= 2.2.2, < 4.0)
23
- rexml
22
+ regexp_parser (>= 1.8, < 3.0)
23
+ rexml (>= 3.2.5, < 4.0)
24
+ rubocop-ast (>= 1.17.0, < 2.0)
24
25
  ruby-progressbar (~> 1.7)
25
- unicode-display_width (>= 1.4.0, < 2.0)
26
- rubocop-performance (1.5.2)
27
- rubocop (>= 0.71.0)
28
- ruby-progressbar (1.10.1)
29
- standard (0.4.1)
30
- rubocop (~> 0.82.0)
31
- rubocop-performance (~> 1.5.2)
32
- timecop (0.9.1)
33
- unicode-display_width (1.7.0)
26
+ unicode-display_width (>= 1.4.0, < 3.0)
27
+ rubocop-ast (1.18.0)
28
+ parser (>= 3.1.1.0)
29
+ rubocop-performance (1.13.3)
30
+ rubocop (>= 1.7.0, < 2.0)
31
+ rubocop-ast (>= 0.4.0)
32
+ ruby-progressbar (1.11.0)
33
+ standard (1.12.1)
34
+ rubocop (= 1.29.1)
35
+ rubocop-performance (= 1.13.3)
36
+ timecop (0.9.5)
37
+ unicode-display_width (2.2.0)
34
38
 
35
39
  PLATFORMS
36
40
  ruby
@@ -1,3 +1,3 @@
1
1
  module TodoOrDie
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/todo_or_die.rb CHANGED
@@ -52,15 +52,19 @@ module TodoOrDie
52
52
  end
53
53
 
54
54
  # The main event
55
- def TodoOrDie(message, by: by_omitted = true, if: if_omitted = true, warn_by: warn_by_omitted = true) # rubocop:disable Naming/MethodName
55
+ def TodoOrDie(message, by: by_omitted = true, if: if_omitted = true, warn_by: warn_by_omitted = true)
56
56
  due_at = Time.parse(by.to_s) unless by_omitted
57
57
  warn_at = Time.parse(warn_by.to_s) unless warn_by_omitted
58
58
  condition = binding.local_variable_get(:if) unless if_omitted
59
59
 
60
- should_warn = !warn_by_omitted && Time.now > warn_at
61
- is_due = by_omitted || Time.now > due_at
60
+ is_past_due_date = by_omitted || Time.now > due_at
62
61
  die_condition_met = if_omitted || (condition.respond_to?(:call) ? condition.call : condition)
63
- should_die = is_due && die_condition_met
62
+ no_conditions_given = by_omitted && if_omitted && warn_by_omitted
63
+ only_warn_condition_given = (if_omitted && by_omitted && !warn_by_omitted)
64
+
65
+ ready_to_die = is_past_due_date && die_condition_met && !only_warn_condition_given
66
+ should_die = no_conditions_given || ready_to_die
67
+ should_warn = !warn_by_omitted && Time.now > warn_at
64
68
 
65
69
  if should_die
66
70
  die = TodoOrDie.config[:die]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todo_or_die
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-27 00:00:00.000000000 Z
11
+ date: 2022-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.3.7
122
+ rubygems_version: 3.3.6
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Write TO​DOs in code that ensure you actually do them