checkoff 0.165.0 → 0.167.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -2
- data/Gemfile +1 -0
- data/Gemfile.lock +7 -4
- data/lib/checkoff/internal/project_selector_evaluator.rb +15 -2
- data/lib/checkoff/internal/selector_classes/function_evaluator.rb +4 -0
- data/lib/checkoff/internal/selector_classes/project/function_evaluator.rb +6 -0
- data/lib/checkoff/internal/selector_classes/project.rb +23 -0
- data/lib/checkoff/internal/task_timing.rb +3 -3
- data/lib/checkoff/project_selectors.rb +8 -1
- data/lib/checkoff/projects.rb +1 -2
- data/lib/checkoff/sections.rb +3 -1
- 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: 39ac47375577c961f420ca90fb137fcb53e45baba61ab6cf97c3892196792c09
|
4
|
+
data.tar.gz: 8880260934a2e1adee59cd74c391952d888480af4305a766b54053d1c135072d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4095ea667d2102b2ea7d0dc578f8dd6bb261a1823d7aa71621da1de9adfac7ced8c9c971e2f3deba2cf75c72a0667359ea64d1383152d54106675f5a9a89c66b
|
7
|
+
data.tar.gz: bb03d3a4b4aafb155a823d172cd164232c4890574c48e99b5b22e3b3b97aae95b04807e065d00b0d9997ccf7be7dcaf0209cfc60223f23b77997a0f69d106193
|
data/.circleci/config.yml
CHANGED
@@ -128,8 +128,6 @@ jobs:
|
|
128
128
|
git config --global user.name "Test Test"
|
129
129
|
bundle exec overcommit --sign
|
130
130
|
bundle exec overcommit --sign pre-commit
|
131
|
-
|
132
|
-
git status
|
133
131
|
bundle exec bump --commit-message ' [skip ci]' --tag --tag-prefix=v minor
|
134
132
|
bundle install
|
135
133
|
# bundle exec needed for overcommit hooks
|
@@ -138,6 +136,7 @@ jobs:
|
|
138
136
|
# https://app.circleci.com/settings/project/github/apiology/checkoff/ssh
|
139
137
|
# includes a read-write 'user key':
|
140
138
|
bundle exec git push --set-upstream origin "${CIRCLE_BRANCH:?}"
|
139
|
+
git status
|
141
140
|
bundle exec rake release trigger_next_builds
|
142
141
|
|
143
142
|
workflows:
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -12,7 +12,7 @@ GIT
|
|
12
12
|
PATH
|
13
13
|
remote: .
|
14
14
|
specs:
|
15
|
-
checkoff (0.
|
15
|
+
checkoff (0.167.0)
|
16
16
|
activesupport
|
17
17
|
asana (> 0.10.0)
|
18
18
|
cache_method
|
@@ -180,8 +180,9 @@ GEM
|
|
180
180
|
unicode-display_width (>= 2.4.0, < 3.0)
|
181
181
|
rubocop-ast (1.30.0)
|
182
182
|
parser (>= 3.2.1.0)
|
183
|
-
rubocop-minitest (0.
|
183
|
+
rubocop-minitest (0.34.4)
|
184
184
|
rubocop (>= 1.39, < 2.0)
|
185
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
185
186
|
rubocop-rake (0.6.0)
|
186
187
|
rubocop (~> 1.0)
|
187
188
|
ruby-progressbar (1.13.0)
|
@@ -216,10 +217,11 @@ GEM
|
|
216
217
|
tomlrb (2.0.3)
|
217
218
|
tzinfo (2.0.6)
|
218
219
|
concurrent-ruby (~> 1.0)
|
219
|
-
undercover (0.
|
220
|
+
undercover (0.5.0)
|
221
|
+
bigdecimal
|
220
222
|
imagen (>= 0.1.8)
|
221
223
|
rainbow (>= 2.1, < 4.0)
|
222
|
-
rugged (>= 0.27, < 1.
|
224
|
+
rugged (>= 0.27, < 1.8)
|
223
225
|
unicode-display_width (2.5.0)
|
224
226
|
webmock (3.19.1)
|
225
227
|
addressable (>= 2.8.0)
|
@@ -240,6 +242,7 @@ DEPENDENCIES
|
|
240
242
|
checkoff!
|
241
243
|
fakeweb
|
242
244
|
mdl
|
245
|
+
mime-types (= 3.5.1)
|
243
246
|
minitest-profile
|
244
247
|
minitest-reporters
|
245
248
|
mocha (>= 2)
|
@@ -10,12 +10,18 @@ module Checkoff
|
|
10
10
|
# @param project [Asana::Resources::Project]
|
11
11
|
# @param projects [Checkoff::Projects]
|
12
12
|
# @param custom_fields [Checkoff::CustomFields]
|
13
|
+
# @param workspaces [Checkoff::Workspaces]
|
14
|
+
# @param portfolios [Checkoff::Portfolios]
|
13
15
|
def initialize(project:,
|
14
16
|
projects: Checkoff::Projects.new,
|
15
|
-
custom_fields: Checkoff::CustomFields.new
|
17
|
+
custom_fields: Checkoff::CustomFields.new,
|
18
|
+
workspaces: Checkoff::Workspaces.new,
|
19
|
+
portfolios: Checkoff::Portfolios.new)
|
16
20
|
@item = project
|
17
21
|
@projects = projects
|
18
22
|
@custom_fields = custom_fields
|
23
|
+
@workspaces = workspaces
|
24
|
+
@portfolios = portfolios
|
19
25
|
super()
|
20
26
|
end
|
21
27
|
|
@@ -38,7 +44,10 @@ module Checkoff
|
|
38
44
|
|
39
45
|
# @return [Hash]
|
40
46
|
def initializer_kwargs
|
41
|
-
{
|
47
|
+
{
|
48
|
+
projects: projects, custom_fields: custom_fields,
|
49
|
+
workspaces: workspaces, portfolios: portfolios
|
50
|
+
}
|
42
51
|
end
|
43
52
|
|
44
53
|
# @return [Asana::Resources::Project]
|
@@ -47,5 +56,9 @@ module Checkoff
|
|
47
56
|
attr_reader :projects
|
48
57
|
# @return [Checkoff::CustomFields]
|
49
58
|
attr_reader :custom_fields
|
59
|
+
# @return [Checkoff::Workspaces]
|
60
|
+
attr_reader :workspaces
|
61
|
+
# @return [Checkoff::Portfolios]
|
62
|
+
attr_reader :portfolios
|
50
63
|
end
|
51
64
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'checkoff/internal/logging'
|
4
|
+
|
3
5
|
module Checkoff
|
4
6
|
module SelectorClasses
|
5
7
|
# Base class to evaluate types of selector functions
|
6
8
|
class FunctionEvaluator
|
9
|
+
include Logging
|
10
|
+
|
7
11
|
# @sg-ignore
|
8
12
|
# @param _index [Integer]
|
9
13
|
def evaluate_arg?(_index)
|
@@ -9,11 +9,17 @@ module Checkoff
|
|
9
9
|
class FunctionEvaluator < ::Checkoff::SelectorClasses::FunctionEvaluator
|
10
10
|
# @param selector [Array<(Symbol, Array)>,String]
|
11
11
|
# @param projects [Checkoff::Projects]
|
12
|
+
# @param portfolios [Checkoff::Portfolios]
|
13
|
+
# @param workspaces [Checkoff::Workspaces]
|
12
14
|
def initialize(selector:,
|
13
15
|
projects:,
|
16
|
+
portfolios:,
|
17
|
+
workspaces:,
|
14
18
|
**_kwargs)
|
15
19
|
@selector = selector
|
16
20
|
@projects = projects
|
21
|
+
@portfolios = portfolios
|
22
|
+
@workspaces = workspaces
|
17
23
|
super()
|
18
24
|
end
|
19
25
|
|
@@ -36,6 +36,29 @@ module Checkoff
|
|
36
36
|
@projects.project_ready?(project, period: period)
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
# :in_portfolio_named? function
|
41
|
+
class InPortfolioNamedPFunctionEvaluator < FunctionEvaluator
|
42
|
+
FUNCTION_NAME = :in_portfolio_named?
|
43
|
+
|
44
|
+
def matches?
|
45
|
+
fn?(selector, FUNCTION_NAME)
|
46
|
+
end
|
47
|
+
|
48
|
+
# @param project [Asana::Resources::Project]
|
49
|
+
# @param portfolio_name [String]
|
50
|
+
# @param workspace_name [String, nil]
|
51
|
+
# @param extra_project_fields [Array<String>]
|
52
|
+
#
|
53
|
+
# @return [Boolean]
|
54
|
+
def evaluate(project, portfolio_name, workspace_name: nil, extra_project_fields: [])
|
55
|
+
workspace_name ||= project.workspace&.name
|
56
|
+
workspace_name ||= @workspaces.default_workspace.name
|
57
|
+
projects = @portfolios.projects_in_portfolio(workspace_name, portfolio_name,
|
58
|
+
extra_project_fields: extra_project_fields)
|
59
|
+
projects.any? { |p| p.name == project.name }
|
60
|
+
end
|
61
|
+
end
|
39
62
|
end
|
40
63
|
end
|
41
64
|
end
|
@@ -34,7 +34,7 @@ module Checkoff
|
|
34
34
|
# @sg-ignore
|
35
35
|
# @return [Date, Time, nil]
|
36
36
|
def start_date_or_time(task)
|
37
|
-
return @time_class.parse(task.start_at) unless task.start_at.nil?
|
37
|
+
return @time_class.parse(task.start_at).localtime unless task.start_at.nil?
|
38
38
|
|
39
39
|
return @date_class.parse(task.start_on) unless task.start_on.nil?
|
40
40
|
|
@@ -47,7 +47,7 @@ module Checkoff
|
|
47
47
|
# @sg-ignore
|
48
48
|
# @return [Date, Time, nil]
|
49
49
|
def due_date_or_time(task)
|
50
|
-
return @time_class.parse(task.due_at) unless task.due_at.nil?
|
50
|
+
return @time_class.parse(task.due_at).localtime unless task.due_at.nil?
|
51
51
|
|
52
52
|
return @date_class.parse(task.due_on) unless task.due_on.nil?
|
53
53
|
|
@@ -58,7 +58,7 @@ module Checkoff
|
|
58
58
|
#
|
59
59
|
# @return [Time, nil]
|
60
60
|
def modified_time(task)
|
61
|
-
@time_class.parse(task.modified_at) unless task.modified_at.nil?
|
61
|
+
@time_class.parse(task.modified_at).localtime unless task.modified_at.nil?
|
62
62
|
end
|
63
63
|
|
64
64
|
# @param task [Asana::Resources::Task]
|
@@ -23,17 +23,20 @@ module Checkoff
|
|
23
23
|
# @param workspaces [Checkoff::Workspaces]
|
24
24
|
# @param projects [Checkoff::Projects]
|
25
25
|
# @param custom_fields [Checkoff::CustomFields]
|
26
|
+
# @param portfolios [Checkoff::Portfolios]
|
26
27
|
# @param clients [Checkoff::Clients]
|
27
28
|
# @param client [Asana::Client]
|
28
29
|
def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
|
29
30
|
workspaces: Checkoff::Workspaces.new(config: config),
|
30
31
|
projects: Checkoff::Projects.new(config: config),
|
31
32
|
custom_fields: Checkoff::CustomFields.new(config: config),
|
33
|
+
portfolios: Checkoff::Portfolios.new(config: config),
|
32
34
|
clients: Checkoff::Clients.new(config: config),
|
33
35
|
client: clients.client)
|
34
36
|
@workspaces = workspaces
|
35
37
|
@projects = projects
|
36
38
|
@custom_fields = custom_fields
|
39
|
+
@portfolios = portfolios
|
37
40
|
@client = client
|
38
41
|
end
|
39
42
|
|
@@ -42,7 +45,8 @@ module Checkoff
|
|
42
45
|
# project details. Examples: [:tag, 'foo'] [:not, [:tag, 'foo']] [:tag, 'foo']
|
43
46
|
# @return [Boolean]
|
44
47
|
def filter_via_project_selector(project, project_selector)
|
45
|
-
evaluator = ProjectSelectorEvaluator.new(project: project, projects: projects, custom_fields: custom_fields
|
48
|
+
evaluator = ProjectSelectorEvaluator.new(project: project, projects: projects, custom_fields: custom_fields,
|
49
|
+
workspaces: workspaces, portfolios: portfolios)
|
46
50
|
evaluator.evaluate(project_selector)
|
47
51
|
end
|
48
52
|
|
@@ -57,6 +61,9 @@ module Checkoff
|
|
57
61
|
# @return [Checkoff::CustomFields]
|
58
62
|
attr_reader :custom_fields
|
59
63
|
|
64
|
+
# @return [Checkoff::Portfolios]
|
65
|
+
attr_reader :portfolios
|
66
|
+
|
60
67
|
# @return [Asana::Client]
|
61
68
|
attr_reader :client
|
62
69
|
|
data/lib/checkoff/projects.rb
CHANGED
@@ -126,7 +126,6 @@ module Checkoff
|
|
126
126
|
only_uncompleted: only_uncompleted,
|
127
127
|
extra_fields: extra_fields)
|
128
128
|
end
|
129
|
-
cache_method :tasks_from_project, SHORT_CACHE_TIME
|
130
129
|
|
131
130
|
# Pull task objects from a project identified by a gid
|
132
131
|
#
|
@@ -144,7 +143,7 @@ module Checkoff
|
|
144
143
|
options[:options][:fields] += extra_fields
|
145
144
|
client.tasks.find_all(**options)
|
146
145
|
end
|
147
|
-
cache_method :tasks_from_project_gid,
|
146
|
+
cache_method :tasks_from_project_gid, REALLY_LONG_CACHE_TIME
|
148
147
|
|
149
148
|
# @param [String] workspace_name
|
150
149
|
# @param [Array<String>] extra_fields
|
data/lib/checkoff/sections.rb
CHANGED
@@ -13,6 +13,8 @@ module Checkoff
|
|
13
13
|
# extend CacheMethod::ClassMethods
|
14
14
|
|
15
15
|
MINUTE = 60
|
16
|
+
HOUR = MINUTE * 60
|
17
|
+
REALLY_LONG_CACHE_TIME = HOUR * 1
|
16
18
|
LONG_CACHE_TIME = MINUTE * 15
|
17
19
|
SHORT_CACHE_TIME = MINUTE * 5
|
18
20
|
|
@@ -130,7 +132,7 @@ module Checkoff
|
|
130
132
|
client.tasks.get_tasks(section: section.gid,
|
131
133
|
**options)
|
132
134
|
end
|
133
|
-
cache_method :tasks,
|
135
|
+
cache_method :tasks, REALLY_LONG_CACHE_TIME
|
134
136
|
|
135
137
|
# Pulls just names of tasks from a given section.
|
136
138
|
# @param workspace_name [String]
|
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.167.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:
|
11
|
+
date: 2024-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|