checkoff 0.13.0 → 0.14.1
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 +4 -4
- data/.rubocop.yml +9 -0
- data/Gemfile.lock +5 -5
- data/coverage/.last_run.json +2 -2
- data/lib/checkoff/subtasks.rb +29 -3
- data/lib/checkoff/tasks.rb +33 -0
- data/lib/checkoff/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa6999ea3bcde70f2cba0d6ecbf45102c85041d109e4d0d6ab55b92a941a1f3a
|
4
|
+
data.tar.gz: 52fe760413e0a8f559c42b9c0ac736e80f467d4d77578e77315fc0eea98b82ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ed9570ef12c90f3abb8ff8a19a8cf3678729c47785ab3bbfb1b000daab79a257f5df123ae4aa5b93fb9bb22bffb125c83552ee5168a59d4e5ae7ec36b57b31d
|
7
|
+
data.tar.gz: fad8749d150cddccdc7bab8baab9084bb63502d02874969113879f4607f02fa791f41444c70419218c45224053a4321a19e4f1c0bf53ac00f759e01d9789fe4d
|
data/.rubocop.yml
CHANGED
@@ -45,6 +45,15 @@ Naming/MethodParameterName:
|
|
45
45
|
- x # cartesian coordinates
|
46
46
|
- y # cartesian coordinates
|
47
47
|
|
48
|
+
# by default (EnforcedStyle=NormalCase) this rule doesn't like
|
49
|
+
# things like check_1, check_2, etc and wants check1, check2, etc. I
|
50
|
+
# like the former.
|
51
|
+
#
|
52
|
+
# https://docs.rubocop.org/rubocop/cops_naming.html#namingvariablenumber
|
53
|
+
Naming/VariableNumber:
|
54
|
+
Enabled: true
|
55
|
+
EnforcedStyle: snake_case
|
56
|
+
|
48
57
|
#
|
49
58
|
# Add 'XX X' to the standard list
|
50
59
|
#
|
data/Gemfile.lock
CHANGED
@@ -12,7 +12,7 @@ GIT
|
|
12
12
|
PATH
|
13
13
|
remote: .
|
14
14
|
specs:
|
15
|
-
checkoff (0.
|
15
|
+
checkoff (0.14.1)
|
16
16
|
activesupport
|
17
17
|
asana (> 0.10.0)
|
18
18
|
cache_method
|
@@ -85,7 +85,7 @@ GEM
|
|
85
85
|
iniparse (~> 1.4)
|
86
86
|
rexml (~> 3.2)
|
87
87
|
parallel (1.20.1)
|
88
|
-
parser (3.0.
|
88
|
+
parser (3.0.2.0)
|
89
89
|
ast (~> 2.4.1)
|
90
90
|
pry (0.14.1)
|
91
91
|
coderay (~> 1.1)
|
@@ -95,16 +95,16 @@ GEM
|
|
95
95
|
rake (13.0.3)
|
96
96
|
regexp_parser (2.1.1)
|
97
97
|
rexml (3.2.5)
|
98
|
-
rubocop (1.
|
98
|
+
rubocop (1.18.4)
|
99
99
|
parallel (~> 1.10)
|
100
100
|
parser (>= 3.0.0.0)
|
101
101
|
rainbow (>= 2.2.2, < 4.0)
|
102
102
|
regexp_parser (>= 1.8, < 3.0)
|
103
103
|
rexml
|
104
|
-
rubocop-ast (>= 1.
|
104
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
105
105
|
ruby-progressbar (~> 1.7)
|
106
106
|
unicode-display_width (>= 1.4.0, < 3.0)
|
107
|
-
rubocop-ast (1.
|
107
|
+
rubocop-ast (1.8.0)
|
108
108
|
parser (>= 3.0.1.1)
|
109
109
|
rubocop-minitest (0.12.1)
|
110
110
|
rubocop (>= 0.90, < 2.0)
|
data/coverage/.last_run.json
CHANGED
data/lib/checkoff/subtasks.rb
CHANGED
@@ -11,6 +11,19 @@ module Checkoff
|
|
11
11
|
|
12
12
|
extend Forwardable
|
13
13
|
|
14
|
+
def initialize(config: Checkoff::ConfigLoader.load(:asana),
|
15
|
+
projects: Checkoff::Projects.new(config: config))
|
16
|
+
@projects = projects
|
17
|
+
end
|
18
|
+
|
19
|
+
# True if all subtasks of the task are completed
|
20
|
+
def all_subtasks_completed?(task)
|
21
|
+
raw_subtasks = raw_subtasks(task)
|
22
|
+
active_subtasks = @projects.active_tasks(raw_subtasks)
|
23
|
+
# anything left should be a section
|
24
|
+
active_subtasks.all? { |subtask| subtask_section?(subtask) }
|
25
|
+
end
|
26
|
+
|
14
27
|
# pulls a Hash of subtasks broken out by section
|
15
28
|
def by_section(tasks)
|
16
29
|
current_section = nil
|
@@ -24,14 +37,27 @@ module Checkoff
|
|
24
37
|
|
25
38
|
# Returns all subtasks, including section headers
|
26
39
|
def raw_subtasks(task)
|
27
|
-
|
40
|
+
task_options = projects.task_options
|
41
|
+
task_options[:options][:fields] << 'is_rendered_as_separator'
|
42
|
+
task.subtasks(task_options)
|
43
|
+
end
|
44
|
+
cache_method :raw_subtasks, SHORT_CACHE_TIME
|
45
|
+
|
46
|
+
# True if the subtask passed in represents a section in the subtasks
|
47
|
+
#
|
48
|
+
# Note: expect this to be removed in a future version, as Asana is
|
49
|
+
# expected to move to the new-style way of representing sections
|
50
|
+
# as memberships with a separate API within a task.
|
51
|
+
def subtask_section?(subtask)
|
52
|
+
subtask.is_rendered_as_separator
|
28
53
|
end
|
29
|
-
cache_method :raw_subtasks, LONG_CACHE_TIME
|
30
54
|
|
31
55
|
private
|
32
56
|
|
57
|
+
attr_reader :projects
|
58
|
+
|
33
59
|
def file_task_by_section(current_section, by_section, task)
|
34
|
-
if task
|
60
|
+
if subtask_section?(task)
|
35
61
|
current_section = task.name
|
36
62
|
by_section[current_section] = []
|
37
63
|
else
|
data/lib/checkoff/tasks.rb
CHANGED
@@ -16,12 +16,24 @@ module Checkoff
|
|
16
16
|
|
17
17
|
def initialize(config: Checkoff::ConfigLoader.load(:asana),
|
18
18
|
sections: Checkoff::Sections.new(config: config),
|
19
|
+
time_class: Time,
|
19
20
|
asana_task: Asana::Resources::Task)
|
20
21
|
@config = config
|
21
22
|
@sections = sections
|
23
|
+
@time_class = time_class
|
22
24
|
@asana_task = asana_task
|
23
25
|
end
|
24
26
|
|
27
|
+
def task_ready?(task)
|
28
|
+
return false if incomplete_dependencies?(task)
|
29
|
+
|
30
|
+
due = due_time(task)
|
31
|
+
|
32
|
+
return true if due.nil?
|
33
|
+
|
34
|
+
due < @time_class.now
|
35
|
+
end
|
36
|
+
|
25
37
|
# Pull a specific task by name
|
26
38
|
def task(workspace_name, project_name, task_name,
|
27
39
|
section_name: :unspecified,
|
@@ -45,6 +57,11 @@ module Checkoff
|
|
45
57
|
workspace: workspace_gid, name: name)
|
46
58
|
end
|
47
59
|
|
60
|
+
# Return an end-user URL to the task in question
|
61
|
+
def url_of_task(task)
|
62
|
+
"https://app.asana.com/0/0/#{task.gid}/f"
|
63
|
+
end
|
64
|
+
|
48
65
|
private
|
49
66
|
|
50
67
|
def client
|
@@ -58,5 +75,21 @@ module Checkoff
|
|
58
75
|
def default_assignee_gid
|
59
76
|
@config.fetch(:default_assignee_gid)
|
60
77
|
end
|
78
|
+
|
79
|
+
def due_time(task)
|
80
|
+
return @time_class.parse(task.due_at) if task.due_at
|
81
|
+
return @time_class.parse(task.due_on) if task.due_on
|
82
|
+
|
83
|
+
nil
|
84
|
+
end
|
85
|
+
|
86
|
+
def incomplete_dependencies?(task)
|
87
|
+
task.dependencies.any? do |parent_task_info|
|
88
|
+
parent_task_gid = parent_task_info.gid
|
89
|
+
parent_task = @asana_task.find_by_id(client, parent_task_gid,
|
90
|
+
options: { fields: ['completed'] })
|
91
|
+
!parent_task.completed
|
92
|
+
end
|
93
|
+
end
|
61
94
|
end
|
62
95
|
end
|
data/lib/checkoff/version.rb
CHANGED
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.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vince Broz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|