checkoff 0.30.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56b8922e030c6770a830b116c1b436f31621670e1a80617e01bf35c5756688fd
4
- data.tar.gz: efa9bbbf45f71ef73df1ec5e1ebc0501915ae6c92b43d6246e48d9866b76da57
3
+ metadata.gz: 318fa6ab4d3237eb9eaf57d752ba2ef13e0082a4d2d7656069fb58b1b2011165
4
+ data.tar.gz: 0c7f23448c07873c281a1b6cc93719df9d0e3ef952d5b43f6bc947ad5a0ca491
5
5
  SHA512:
6
- metadata.gz: 9b09f82050f2a5b15fc15c8b34ef70093cc7502e64cc5a59d90bc475fce7cdd957dfe4e00d5223ab7c185c2b7f5ddaddc27f1830264c70b3b2279389032c114a
7
- data.tar.gz: 05627d4fc018a5eae0bf06a226dccf0819ac836a297f56c221b69b5b255f74e2e3501ab8f3e99bfffd4c65984d712e667c9c2e0332fba407fb00f95f7c27a582
6
+ metadata.gz: 1bd96a96a0306d78c0b88f37aaa705a8d0d9c9552f35159bd70d2a3bfcbd84308903ce772c92c399d229cad9b21165ad751bfab269f6539bd3435a3ccfa20640
7
+ data.tar.gz: 1de9712b43b014a0c0103af61807c6ecf9d17df2ed961b12577ec5b9df6d4e486801f73a302563648da6b1deb42923bbffb59c11def81ea371782e66ffa55a64
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.30.0)
15
+ checkoff (0.32.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -38,7 +38,7 @@ GEM
38
38
  cache (>= 0.2.1)
39
39
  chef-utils (17.10.0)
40
40
  concurrent-ruby
41
- childprocess (4.0.0)
41
+ childprocess (4.1.0)
42
42
  coderay (1.1.3)
43
43
  concurrent-ruby (1.1.10)
44
44
  crack (0.4.5)
@@ -111,7 +111,7 @@ GEM
111
111
  multi_json (~> 1.3)
112
112
  multi_xml (~> 0.5)
113
113
  rack (>= 1.2, < 4)
114
- overcommit (0.58.0)
114
+ overcommit (0.60.0)
115
115
  childprocess (>= 0.6.3, < 5)
116
116
  iniparse (~> 1.4)
117
117
  rexml (~> 3.2)
@@ -185,6 +185,7 @@ PLATFORMS
185
185
  x86_64-darwin-20
186
186
  x86_64-darwin-21
187
187
  x86_64-linux
188
+ x86_64-linux-musl
188
189
 
189
190
  DEPENDENCIES
190
191
  asana!
@@ -196,11 +197,11 @@ DEPENDENCIES
196
197
  minitest-profile
197
198
  minitest-reporters
198
199
  mocha (~> 2.0.0.alpha.1)
199
- overcommit (>= 0.58.0)
200
+ overcommit (>= 0.60.0, < 0.61.0)
200
201
  pry
201
202
  rake (~> 13.0)
202
203
  rspec (>= 3.4)
203
- rubocop (~> 1.36)
204
+ rubocop (~> 1.36, < 1.44)
204
205
  rubocop-minitest
205
206
  rubocop-rake
206
207
  simplecov (>= 0.18.0)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2016-2022, Vince Broz
3
+ Copyright (c) 2016-2023, Vince Broz
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/bin/rubocop ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("rubocop", "rubocop")
data/checkoff.gemspec CHANGED
@@ -40,11 +40,13 @@ Gem::Specification.new do |spec|
40
40
  # 0.58.0 and 0.57.0 don't seem super compatible with signatures, and
41
41
  # magit doesn't seem to want to use the bundled version at the moment,
42
42
  # so let's favor the more recent version...
43
- spec.add_development_dependency 'overcommit', ['>=0.58.0']
43
+ spec.add_development_dependency 'overcommit', ['>=0.60.0', '<0.61.0']
44
44
  spec.add_development_dependency 'pry'
45
45
  spec.add_development_dependency 'rake', '~> 13.0'
46
46
  spec.add_development_dependency 'rspec', '>=3.4'
47
- spec.add_development_dependency 'rubocop', ['~> 1.36']
47
+ # I haven't adapted things to Gemspec/DevelopmentDependencies yet,
48
+ # which arrives in 1.44
49
+ spec.add_development_dependency 'rubocop', ['~> 1.36', '<1.44']
48
50
  spec.add_development_dependency 'rubocop-minitest'
49
51
  spec.add_development_dependency 'rubocop-rake'
50
52
  # ensure version with branch coverage
@@ -1,4 +1,5 @@
1
1
  {
2
+ "_output_dir": "/Users/broz/src/checkoff/.git/cookiecutter",
2
3
  "_template": "https://github.com/apiology/cookiecutter-gem",
3
4
  "email": "vince@broz.cc",
4
5
  "full_name": "Vince Broz",
data/fix.sh CHANGED
@@ -100,6 +100,7 @@ ensure_ruby_build_requirements() {
100
100
  ensure_dev_library readline/readline.h readline libreadline-dev
101
101
  ensure_dev_library zlib.h zlib zlib1g-dev
102
102
  ensure_dev_library openssl/ssl.h openssl libssl-dev
103
+ ensure_dev_library yaml.h libyaml libyaml-dev
103
104
  }
104
105
 
105
106
  ensure_latest_ruby_build_definitions() {
@@ -188,7 +189,7 @@ ensure_bundle() {
188
189
  #
189
190
  # This affects nokogiri, which will try to reinstall itself in
190
191
  # Docker builds where it's already installed if this is not run.
191
- for platform in x86_64-darwin-21 x86_64-linux
192
+ for platform in x86_64-darwin-21 x86_64-linux x86_64-linux-musl
192
193
  do
193
194
  grep "${platform:?}" Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform "${platform:?}"
194
195
  done
@@ -284,7 +285,7 @@ ensure_python_build_requirements() {
284
285
  ensure_python_versions() {
285
286
  # You can find out which feature versions are still supported / have
286
287
  # been release here: https://www.python.org/downloads/
287
- python_versions="$(latest_python_version 3.10)"
288
+ python_versions="$(latest_python_version 3.11)"
288
289
 
289
290
  echo "Latest Python versions: ${python_versions}"
290
291
 
@@ -125,6 +125,17 @@ module Checkoff
125
125
  end
126
126
  end
127
127
 
128
+ # :due_date_set function
129
+ class DueDateSetPFunctionEvaluator < FunctionEvaluator
130
+ def matches?
131
+ fn?(task_selector, :due_date_set)
132
+ end
133
+
134
+ def evaluate(task)
135
+ !task.due_at.nil? || !task.due_on.nil?
136
+ end
137
+ end
138
+
128
139
  # :custom_field_value function
129
140
  class CustomFieldValueFunctionEvaluator < FunctionEvaluator
130
141
  def matches?
@@ -220,6 +231,7 @@ module Checkoff
220
231
  CustomFieldGidValueContainsAllGidsFunctionEvaluator,
221
232
  AndFunctionEvaluator,
222
233
  DuePFunctionEvaluator,
234
+ DueDateSetPFunctionEvaluator,
223
235
  ].freeze
224
236
 
225
237
  def evaluate(task_selector)
@@ -15,8 +15,11 @@ module Checkoff
15
15
  attr_reader :projects
16
16
 
17
17
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
18
- projects: Checkoff::Projects.new(config: config))
18
+ client: Checkoff::Clients.new(config: config).client,
19
+ projects: Checkoff::Projects.new(config: config,
20
+ client: client))
19
21
  @config = config
22
+ @client = client
20
23
  @projects = projects
21
24
  end
22
25
 
@@ -27,20 +30,32 @@ module Checkoff
27
30
  raw_tasks = projects.tasks_from_project(project,
28
31
  extra_fields: extra_fields + ['assignee_section.name'])
29
32
  active_tasks = projects.active_tasks(raw_tasks)
30
- by_my_tasks_section(active_tasks)
33
+ by_my_tasks_section(active_tasks, project.gid)
34
+ end
35
+
36
+ def section_key(name)
37
+ return nil if name == 'Recently assigned'
38
+
39
+ name
31
40
  end
32
41
 
33
42
  # Given a list of tasks in 'My Tasks', pull a Hash of tasks with
34
43
  # section name -> task list
35
- def by_my_tasks_section(tasks)
44
+ def by_my_tasks_section(tasks, project_gid)
36
45
  by_section = {}
46
+ sections = client.sections.get_sections_for_project(project_gid: project_gid)
47
+ sections.each { |section| by_section[section_key(section.name)] = [] }
37
48
  tasks.each do |task|
38
49
  assignee_section = task.assignee_section
39
- current_section = assignee_section.name
50
+ current_section = section_key(assignee_section.name)
40
51
  by_section[current_section] ||= []
41
52
  by_section[current_section] << task
42
53
  end
43
54
  by_section
44
55
  end
56
+
57
+ private
58
+
59
+ attr_reader :client
45
60
  end
46
61
  end
@@ -26,7 +26,7 @@ module Checkoff
26
26
  time: Time)
27
27
  @projects = projects
28
28
  @workspaces = workspaces
29
- @my_tasks = Checkoff::MyTasks.new(config: config, projects: projects)
29
+ @my_tasks = Checkoff::MyTasks.new(config: config, projects: projects, client: client)
30
30
  @client = client
31
31
  @time = time
32
32
  end
@@ -89,19 +89,24 @@ module Checkoff
89
89
  # Given a project object, pull all tasks, then provide a Hash of
90
90
  # tasks with section name -> task list of the uncompleted tasks
91
91
  def tasks_by_section_for_project(project, extra_fields: [])
92
- # print("project: #{project}")
93
92
  raw_tasks = projects.tasks_from_project(project, extra_fields: extra_fields)
94
- # print("raw_tasks[0]: #{raw_tasks[0]}")
95
93
  active_tasks = projects.active_tasks(raw_tasks)
96
94
  by_section(active_tasks, project.gid)
97
95
  end
98
96
 
97
+ def section_key(name)
98
+ inbox_section_names = ['(no section)', 'Untitled section', 'Inbox']
99
+ return nil if inbox_section_names.include?(name)
100
+
101
+ name
102
+ end
103
+
99
104
  # Given a list of tasks, pull a Hash of tasks with section name -> task list
100
105
  def by_section(tasks, project_gid)
101
106
  by_section = {}
102
- tasks.each do |task|
103
- file_task_by_section(by_section, task, project_gid)
104
- end
107
+ sections = client.sections.get_sections_for_project(project_gid: project_gid)
108
+ sections.each { |section| by_section[section_key(section.name)] = [] }
109
+ tasks.each { |task| file_task_by_section(by_section, task, project_gid) }
105
110
  by_section
106
111
  end
107
112
  cache_method :by_section, LONG_CACHE_TIME
@@ -110,11 +115,9 @@ module Checkoff
110
115
  membership = task.memberships.find { |m| m['project']['gid'] == project_gid }
111
116
  raise "Could not find task in project_gid #{project_gid}: #{task}" if membership.nil?
112
117
 
113
- current_section = membership['section']['name']
114
- inbox_section_names = ['(no section)', 'Untitled section', 'Inbox']
115
- current_section = nil if inbox_section_names.include?(current_section)
116
- by_section[current_section] ||= []
117
- by_section[current_section] << task
118
+ current_section = section_key(membership['section']['name'])
119
+
120
+ by_section.fetch(current_section) << task
118
121
  end
119
122
 
120
123
  def project_or_raise(workspace_name, project_name)
@@ -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.30.0'
6
+ VERSION = '0.32.0'
7
7
  end
data/requirements_dev.txt CHANGED
@@ -1,2 +1,2 @@
1
- pip==21.1
2
- yamllint==1.26.0
1
+ pip==21.1.3
2
+ yamllint==1.29.0
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.30.0
4
+ version: 0.32.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-02-26 00:00:00.000000000 Z
11
+ date: 2023-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -184,14 +184,20 @@ dependencies:
184
184
  requirements:
185
185
  - - ">="
186
186
  - !ruby/object:Gem::Version
187
- version: 0.58.0
187
+ version: 0.60.0
188
+ - - "<"
189
+ - !ruby/object:Gem::Version
190
+ version: 0.61.0
188
191
  type: :development
189
192
  prerelease: false
190
193
  version_requirements: !ruby/object:Gem::Requirement
191
194
  requirements:
192
195
  - - ">="
193
196
  - !ruby/object:Gem::Version
194
- version: 0.58.0
197
+ version: 0.60.0
198
+ - - "<"
199
+ - !ruby/object:Gem::Version
200
+ version: 0.61.0
195
201
  - !ruby/object:Gem::Dependency
196
202
  name: pry
197
203
  requirement: !ruby/object:Gem::Requirement
@@ -241,6 +247,9 @@ dependencies:
241
247
  - - "~>"
242
248
  - !ruby/object:Gem::Version
243
249
  version: '1.36'
250
+ - - "<"
251
+ - !ruby/object:Gem::Version
252
+ version: '1.44'
244
253
  type: :development
245
254
  prerelease: false
246
255
  version_requirements: !ruby/object:Gem::Requirement
@@ -248,6 +257,9 @@ dependencies:
248
257
  - - "~>"
249
258
  - !ruby/object:Gem::Version
250
259
  version: '1.36'
260
+ - - "<"
261
+ - !ruby/object:Gem::Version
262
+ version: '1.44'
251
263
  - !ruby/object:Gem::Dependency
252
264
  name: rubocop-minitest
253
265
  requirement: !ruby/object:Gem::Requirement
@@ -363,6 +375,7 @@ files:
363
375
  - bin/console
364
376
  - bin/overcommit
365
377
  - bin/rake
378
+ - bin/rubocop
366
379
  - bin/setup
367
380
  - checkoff.gemspec
368
381
  - docs/cookiecutter_input.json