checkoff 0.179.0 → 0.181.0

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: 57ff6205af493cb019f7035e1ad898b43907543127cc236e80e683c5bcac4cad
4
- data.tar.gz: bc95487dc4169e59477873e4fcfd73b3a5ee86c6d704b22b715479e26f11207b
3
+ metadata.gz: 4375c2b0377fc7ccfb25e724d4d5dfcaba964c9abb6080a46f4948a6cb58d5a9
4
+ data.tar.gz: 799f7950940dd1c9be03f6521dd876667b6935c02171cd88d23044172b80fa6e
5
5
  SHA512:
6
- metadata.gz: 40dd22182d73405aa85fa64492201b480d848af226178691c64f2d7c6712f37b6240a32bae7d518aaa4ac6d9dbe809b1c185ef41a1e81a527c251b9738d354cf
7
- data.tar.gz: 815605f29fb98fb3b9bca63400c545c31b437c3d2b3d69e07ef6f255757f3ca7151fd6c38b0f7bf7a746fd3ec45ae1fb3e5f7c8fcc7c2713a0118d5e0310fef8
6
+ metadata.gz: ee8b4f82321e18945ed5327263d172c5dbc9de9ee092504076d90918f865dfb1ba1ae6fe1e0b6a9a6f128755557c6ac22d97d93d2ce13d7ca601f23db977fe0e
7
+ data.tar.gz: 293b79d78064763fd18a4d012cc301f2283857efea170c01cd2ce1beb27b852f0f0013c59a3c4188ce81a0e94aa274e83f80bb6ad21500343af97a1b63155b01
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.179.0)
15
+ checkoff (0.181.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -6,6 +6,31 @@ require 'checkoff/internal/task_timing'
6
6
  module Checkoff
7
7
  module SelectorClasses
8
8
  module Task
9
+ # :in_a_real_project? function
10
+ class InARealProjectPFunctionEvaluator < FunctionEvaluator
11
+ def matches?
12
+ fn?(selector, :in_a_real_project?)
13
+ end
14
+
15
+ # @param _index [Integer]
16
+ def evaluate_arg?(_index)
17
+ false
18
+ end
19
+
20
+ # @sg-ignore
21
+ # @param task [Asana::Resources::Task]
22
+ # @return [Boolean]
23
+ def evaluate(task)
24
+ # @type [Hash{'unwrapped' => Hash}]
25
+ task_data = @tasks.task_to_h(task)
26
+ # @type [Hash{'membership_by_project_name' => Hash}]
27
+ unwrapped = task_data.fetch('unwrapped')
28
+ # @type [Array]
29
+ projects = unwrapped.fetch('membership_by_project_name').keys
30
+ !(projects - [:my_tasks]).empty?
31
+ end
32
+ end
33
+
9
34
  # :section_name_starts_with? function
10
35
  class SectionNameStartsWithPFunctionEvaluator < FunctionEvaluator
11
36
  def matches?
@@ -40,6 +40,8 @@ module Checkoff
40
40
  def in_period?(date_or_time, period)
41
41
  return this_week?(date_or_time) if period == :this_week
42
42
 
43
+ return next_week?(date_or_time) if period == :next_week
44
+
43
45
  return day_of_week?(date_or_time, period) if %i[monday tuesday wednesday thursday friday saturday
44
46
  sunday].include?(period)
45
47
 
@@ -120,6 +122,23 @@ module Checkoff
120
122
  date >= beginning_of_week && date <= end_of_week
121
123
  end
122
124
 
125
+ # @param date_or_time [Date,Time,nil]
126
+ def next_week?(date_or_time)
127
+ return false if date_or_time.nil?
128
+
129
+ today = @today_getter.today
130
+
131
+ # Beginning of next week (assuming week starts on Sunday)
132
+ beginning_of_week = today - today.wday + 7
133
+
134
+ # End of this week (assuming week ends on Saturday)
135
+ end_of_week = beginning_of_week + 6
136
+
137
+ date = date_or_time.to_date
138
+
139
+ date >= beginning_of_week && date <= end_of_week
140
+ end
141
+
123
142
  # @type [Hash<Symbol,Integer>]
124
143
  WDAY_FROM_DAY_OF_WEEK = {
125
144
  monday: 1,
@@ -3,5 +3,5 @@
3
3
  # Command-line and gem client for Asana (unofficial)
4
4
  module Checkoff
5
5
  # Version of library
6
- VERSION = '0.179.0'
6
+ VERSION = '0.181.0'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.179.0
4
+ version: 0.181.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz