checkoff 0.58.1 → 0.59.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@
5
5
  require 'forwardable'
6
6
  require 'cache_method'
7
7
  require_relative 'internal/config_loader'
8
+ require_relative 'internal/project_selector_evaluator'
8
9
  require_relative 'workspaces'
9
10
  require_relative 'clients'
10
11
 
@@ -22,13 +23,16 @@ module Checkoff
22
23
 
23
24
  # @param config [Hash<Symbol, Object>]
24
25
  # @param workspaces [Checkoff::Workspaces]
26
+ # @param projects [Checkoff::Projects]
25
27
  # @param clients [Checkoff::Clients]
26
28
  # @param client [Asana::Client]
27
29
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
28
30
  workspaces: Checkoff::Workspaces.new(config: config),
31
+ projects: Checkoff::Projects.new(config: config),
29
32
  clients: Checkoff::Clients.new(config: config),
30
33
  client: clients.client)
31
34
  @workspaces = workspaces
35
+ @projects = projects
32
36
  @client = client
33
37
  end
34
38
 
@@ -37,21 +41,8 @@ module Checkoff
37
41
  # project details. Examples: [:tag, 'foo'] [:not, [:tag, 'foo']] [:tag, 'foo']
38
42
  # @return [Boolean]
39
43
  def filter_via_project_selector(project, project_selector)
40
- if project_selector == [:custom_field_values_contain_any_value, 'Project attributes', ['timeline']]
41
- custom_field = project.custom_fields.find { |field| field.fetch('name') == 'Project attributes' }
42
-
43
- return false if custom_field.nil?
44
-
45
- # @sg-ignore
46
- # @type [Hash, nil]
47
- timeline = custom_field.fetch('multi_enum_values').find do |multi_enum_value|
48
- multi_enum_value.fetch('name') == 'timeline'
49
- end
50
-
51
- return !timeline.nil?
52
- end
53
-
54
- raise "Teach me how to evaluate #{project} against #{project_selector}"
44
+ evaluator = ProjectSelectorEvaluator.new(project: project, projects: projects)
45
+ evaluator.evaluate(project_selector)
55
46
  end
56
47
 
57
48
  private
@@ -59,6 +50,9 @@ module Checkoff
59
50
  # @return [Checkoff::Workspaces]
60
51
  attr_reader :workspaces
61
52
 
53
+ # @return [Checkoff::Projects]
54
+ attr_reader :projects
55
+
62
56
  # @return [Asana::Client]
63
57
  attr_reader :client
64
58
 
@@ -119,6 +119,9 @@ module Checkoff
119
119
  dependencies = task.dependencies.map { |dependency| { 'gid' => dependency.gid } } if dependencies.nil?
120
120
 
121
121
  dependencies.any? do |parent_task_info|
122
+ # the real bummer though is that asana doesn't let you fetch
123
+ # the completion status of dependencies, so we need to do this
124
+ # regardless:
122
125
  parent_task_gid = parent_task_info.fetch('gid')
123
126
  parent_task = @asana_task.find_by_id(client, parent_task_gid,
124
127
  options: { fields: ['completed'] })
@@ -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.58.1'
6
+ VERSION = '0.59.0'
7
7
  end
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.58.1
4
+ version: 0.59.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-01 00:00:00.000000000 Z
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -132,6 +132,7 @@ files:
132
132
  - lib/checkoff/custom_fields.rb
133
133
  - lib/checkoff/internal/config_loader.rb
134
134
  - lib/checkoff/internal/create-class.sh
135
+ - lib/checkoff/internal/project_selector_evaluator.rb
135
136
  - lib/checkoff/internal/search_url.rb
136
137
  - lib/checkoff/internal/search_url/custom_field_param_converter.rb
137
138
  - lib/checkoff/internal/search_url/custom_field_variant.rb
@@ -139,6 +140,14 @@ files:
139
140
  - lib/checkoff/internal/search_url/parser.rb
140
141
  - lib/checkoff/internal/search_url/results_merger.rb
141
142
  - lib/checkoff/internal/search_url/simple_param_converter.rb
143
+ - lib/checkoff/internal/selector_classes/common.rb
144
+ - lib/checkoff/internal/selector_classes/common/function_evaluator.rb
145
+ - lib/checkoff/internal/selector_classes/function_evaluator.rb
146
+ - lib/checkoff/internal/selector_classes/project.rb
147
+ - lib/checkoff/internal/selector_classes/project/function_evaluator.rb
148
+ - lib/checkoff/internal/selector_classes/task.rb
149
+ - lib/checkoff/internal/selector_classes/task/function_evaluator.rb
150
+ - lib/checkoff/internal/selector_evaluator.rb
142
151
  - lib/checkoff/internal/task_selector_evaluator.rb
143
152
  - lib/checkoff/my_tasks.rb
144
153
  - lib/checkoff/project_selectors.rb