checkoff 0.67.1 → 0.69.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: 63b887dd83f103cab32923b8326be62de742bc54b4e137a390d005366d57d1c6
4
- data.tar.gz: b65f844a89f4bb5821fec1845d417838b61ef317e59b93c1b4825daf97a59ac2
3
+ metadata.gz: c51c3e2471e530356afaae22363325c6f6c3d1ce976740071d5776b7c30f4a13
4
+ data.tar.gz: 8f4661f622986dc3a7b02898222f9b6baea259e8b4b06a75e1631b5b7d4f171a
5
5
  SHA512:
6
- metadata.gz: 27ecc27a347c29621c95690e93c3614955295b231dec563703f5db8b2a7647c013eacf70b79c6756b6a39dfb5f1b7bcdbfe2fe56a70ab668e40c2ff66d339f22
7
- data.tar.gz: 8633ada2cb84d24b32ab6fa1585a648902718d4cf318f5c15ebb6fc1d36bcce076aff818e4406a7931c3450136cd04f4f3d47a4e3e13f2cfb9c60b9b827028a3
6
+ metadata.gz: e632e71b7259b119cdf58d0fb9c21ce0158465054cd95336d3af36e0dc0fa255f29a7e4299d8d4b182fb07cee1161c1f9b248bda8e3fbf36bdb279f1e4c4946c
7
+ data.tar.gz: f648d9ca336c7b7e77c9fbdaee2bdd6716c0a32e1a45ad45cb52687958de5dd3194145c09edc25d186a7cdddf9f5a35204b9af1a48a77beba107f3df4f34d158
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.67.1)
15
+ checkoff (0.69.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')
@@ -131,13 +131,22 @@ module Checkoff
131
131
  if s.nil?
132
132
  valid_sections = sections_or_raise(workspace_name, project_name).map(&:name)
133
133
 
134
- raise "Could not find section #{section_name} under project #{project_name} " \
135
- "under workspace #{workspace_name}. Valid sections: #{valid_sections}"
134
+ raise "Could not find section #{section_name.inspect} under project #{project_name.inspect} " \
135
+ "under workspace #{workspace_name.inspect}. Valid sections: #{valid_sections.inspect}"
136
136
  end
137
137
  s
138
138
  end
139
139
  cache_method :section_or_raise, LONG_CACHE_TIME
140
140
 
141
+ # @param name [String]
142
+ # @return [String, nil]
143
+ def section_key(name)
144
+ inbox_section_names = ['(no section)', 'Untitled section', 'Inbox', 'Recently assigned']
145
+ return nil if inbox_section_names.include?(name)
146
+
147
+ name
148
+ end
149
+
141
150
  private
142
151
 
143
152
  # @return [Asana::Client]
@@ -159,15 +168,6 @@ module Checkoff
159
168
  by_section(active_tasks, project.gid)
160
169
  end
161
170
 
162
- # @param name [String]
163
- # @return [String, nil]
164
- def section_key(name)
165
- inbox_section_names = ['(no section)', 'Untitled section', 'Inbox', 'Recently assigned']
166
- return nil if inbox_section_names.include?(name)
167
-
168
- name
169
- end
170
-
171
171
  # Given a list of tasks, pull a Hash of tasks with section name -> task list
172
172
  # @param tasks [Enumerable<Asana::Resources::Task>]
173
173
  # @param project_gid [String]
@@ -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.1'
6
+ VERSION = '0.69.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.1
4
+ version: 0.69.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-20 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
@@ -163,6 +163,7 @@ files:
163
163
  - lib/checkoff/task_searches.rb
164
164
  - lib/checkoff/task_selectors.rb
165
165
  - lib/checkoff/tasks.rb
166
+ - lib/checkoff/timing.rb
166
167
  - lib/checkoff/version.rb
167
168
  - lib/checkoff/workspaces.rb
168
169
  - metrics/bigfiles_high_water_mark