checkoff 0.67.0 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 651d344e64e8f9b999d1c8d1f235c6657428e11164844e85ea3f53f31dca581b
4
- data.tar.gz: bd94b2f08680af330190beb09c6659787e500d7d561a15a80a363a8c4675d158
3
+ metadata.gz: 6dd5c704b7e134bdda8158cf7851d59bc1c1288e969251bcf4f301d9f18bafed
4
+ data.tar.gz: 5f92ddd1ce0079e41d9a3aaf34159a5d17aa2ffafa1dbb86beff713a9ac110a1
5
5
  SHA512:
6
- metadata.gz: '086458eef1a121b9cf27c79d78d18a65289cb7658d37126647a363d784ecaec3251ca05aba3b4f22512a07a35ee012d7fdf58b585950845be0742560e3d0dd50'
7
- data.tar.gz: 05e1b5637f49ffd9c0dea9110705a43e79f875cedc699df023e1cc1d68480a7b9b68eb974faf201bc4e0c9efce1ba5333adbeca8bcf84ff0f7c076d57fb07753
6
+ metadata.gz: e7b890ec0a915814c77e4bce2137a50cdf740dbe8f22bdaac105e4b1b2f4a94dc2b09dc90768b4a7336d2ccf48b63bc61597e4f37d4a77cb3bc8270cb873c8ab
7
+ data.tar.gz: 564850bdc350602dd3fe4d7bb66a6457cd5b582d061aa83cf95b5a526da25741cdde8debb87ef8443b5bef94b6d8af6e186f6c369dc10232d35f41d40900fd5d
data/GLOSSARY.md ADDED
@@ -0,0 +1,11 @@
1
+ # Glossary
2
+
3
+ * ready/due: See tasks.rb#task_ready?. Indicates a task is ready for
4
+ a person to work on it. This is subtly different than what is used
5
+ by Asana to mark a date as red/green! A task is ready if it is not
6
+ dependent on an incomplete task and one of these is true:
7
+
8
+ * start is null and due on is today
9
+ * start is null and due at is after now
10
+ * start on is today
11
+ * start at is after now
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.67.0)
15
+ checkoff (0.68.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -61,6 +61,7 @@ module Checkoff
61
61
  # bundle exec ./${underscored_plural_name}.rb
62
62
  # :nocov:
63
63
  class << self
64
+ # @return [void]
64
65
  def run
65
66
  workspace_name = ARGV[0] || raise('Please pass workspace name as first argument')
66
67
  ${underscored_singular_name}_name = ARGV[1] || raise('Please pass ${underscored_singular_name} name as second argument')
@@ -335,7 +335,9 @@ module Checkoff
335
335
  # @param task [Asana::Resources::Task]
336
336
  # @return [Boolean]
337
337
  def evaluate(task)
338
- custom_field = pull_custom_field_by_name_or_raise(task, 'Estimated time')
338
+ custom_field = pull_custom_field_by_name(task, 'Estimated time')
339
+
340
+ return false if custom_field.nil?
339
341
 
340
342
  # @sg-ignore
341
343
  # @type [Integer, nil]
@@ -42,6 +42,16 @@ module Checkoff
42
42
  @workspaces = workspaces
43
43
  end
44
44
 
45
+ # Indicates a task is ready for a person to work on it. This is
46
+ # subtly different than what is used by Asana to mark a date as
47
+ # red/green! A task is ready if it is not dependent on an
48
+ # incomplete task and one of these is true:
49
+ #
50
+ # * start is null and due on is today
51
+ # * start is null and due at is after now
52
+ # * start on is today
53
+ # * start at is after now
54
+ #
45
55
  # @param task [Asana::Resources::Task]
46
56
  # @param ignore_dependencies [Boolean]
47
57
  def task_ready?(task, ignore_dependencies: false)
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'date'
6
+ require 'time'
7
+ require 'active_support'
8
+ # require 'active_support/time'
9
+ require 'forwardable'
10
+ require 'cache_method'
11
+ require_relative 'internal/config_loader'
12
+ require_relative 'workspaces'
13
+ require_relative 'clients'
14
+
15
+ module Checkoff
16
+ # Common vocabulary for managing time and time periods
17
+ class Timing
18
+ MINUTE = 60
19
+ HOUR = MINUTE * 60
20
+ DAY = 24 * HOUR
21
+ REALLY_LONG_CACHE_TIME = HOUR * 1
22
+ LONG_CACHE_TIME = MINUTE * 15
23
+ SHORT_CACHE_TIME = MINUTE
24
+
25
+ # @param today_getter [Class<Date>]
26
+ def initialize(today_getter: Date)
27
+ @today_getter = today_getter
28
+ end
29
+
30
+ # @param date [Date]
31
+ # @param period [Symbol<:indefinite>]
32
+ def in_period?(date, period)
33
+ return this_week?(date) if period == :this_week
34
+
35
+ return true if period == :indefinite
36
+
37
+ raise "Teach me how to handle period #{period.inspect}"
38
+ end
39
+
40
+ private
41
+
42
+ # @param date [Date]
43
+ def this_week?(date)
44
+ today = @today_getter.today
45
+
46
+ # Beginning of this week (assuming week starts on Sunday)
47
+ beginning_of_week = today - today.wday
48
+
49
+ # End of this week (assuming week ends on Saturday)
50
+ end_of_week = beginning_of_week + 6
51
+
52
+ date >= beginning_of_week && date <= end_of_week
53
+ end
54
+
55
+ # bundle exec ./time.rb
56
+ # :nocov:
57
+ class << self
58
+ # @return [void]
59
+ def run
60
+ time = Checkoff::Timing.new
61
+ # time = time.time_or_raise(workspace_name, time_name)
62
+ puts "Results: #{time}"
63
+ end
64
+ end
65
+ # :nocov:
66
+ end
67
+ end
68
+
69
+ # :nocov:
70
+ abs_program_name = File.expand_path($PROGRAM_NAME)
71
+ Checkoff::Timing.run if abs_program_name == File.expand_path(__FILE__)
72
+ # :nocov:
@@ -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.67.0'
6
+ VERSION = '0.68.0'
7
7
  end
data/lib/checkoff.rb CHANGED
@@ -6,6 +6,7 @@ require 'checkoff/workspaces'
6
6
  require 'checkoff/projects'
7
7
  require 'checkoff/sections'
8
8
  require 'checkoff/subtasks'
9
+ require 'checkoff/timing'
9
10
  require 'checkoff/tasks'
10
11
  require 'checkoff/custom_fields'
11
12
  require 'checkoff/tags'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.67.0
4
+ version: 0.68.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2023-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -103,6 +103,7 @@ files:
103
103
  - CODE_OF_CONDUCT.md
104
104
  - CONTRIBUTING.rst
105
105
  - DEVELOPMENT.md
106
+ - GLOSSARY.md
106
107
  - Gemfile
107
108
  - Gemfile.lock
108
109
  - LICENSE
@@ -162,6 +163,7 @@ files:
162
163
  - lib/checkoff/task_searches.rb
163
164
  - lib/checkoff/task_selectors.rb
164
165
  - lib/checkoff/tasks.rb
166
+ - lib/checkoff/timing.rb
165
167
  - lib/checkoff/version.rb
166
168
  - lib/checkoff/workspaces.rb
167
169
  - metrics/bigfiles_high_water_mark