checkoff 0.20.0 → 0.22.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: ca8acc9a67554659cd34a8a9a60f539e834088bc896ef6e3bb7761e75183ac8a
4
- data.tar.gz: ff10088e95968a73ccb5590b316a4b6e3f9ff49572ab87271f710bc9a02f25b3
3
+ metadata.gz: '084d67648e9668ace7b8d103e4e1f9ec1d8d66bb0048cc1f8c7d652dd115397c'
4
+ data.tar.gz: e1cf9b3f5639841462290ac1a5228fa5ca3dba3d4e70c62d84644184e63e6b89
5
5
  SHA512:
6
- metadata.gz: a80da7607358f742d06fec48be66df5b53d41832ecbc16bdaae3a023c9a929d3cfff0a983ccbbdb381d1079187589c0e3c367ade5b8f7b92fe36fcd5025bfc65
7
- data.tar.gz: dc9126b9a3366626c81f1eef2f32c517f9b978e5ec07052cc2194bf718e2e9c778da2fe2b09b6a1d07213437b7bf3265d636dcd071bb7ca01d822819883d1087
6
+ metadata.gz: f49cd3bded68cdcc502b26ac03fe6b7e073aaa93294c4104b36c7bfb014fbbc9e3a792fb85d712e39251ec13ce1e7430e067c06a3075120bb37bcf23de457672
7
+ data.tar.gz: a4886b2dabc6332688434e0bce0009c1bf1db10b97588f857dc729320b5f840e4f8368afaf03ea78bdbf2e1025c1f4fa9d23839d19d0df8fa2650839226915f0
data/.gitignore CHANGED
@@ -57,8 +57,7 @@ requirements_dev.txt.installed
57
57
  /pkg/
58
58
  /spec/reports/
59
59
  /tmp/
60
- /coverage/.resultset.json
61
- /coverage/.resultset.json.lock
62
- /coverage/assets/
63
- /coverage/index.html
64
- /coverage/lcov/
60
+ /coverage/
61
+
62
+ # direnv
63
+ /.envrc
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.20.0)
15
+ checkoff (0.22.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -27,6 +27,8 @@ GEM
27
27
  i18n (>= 1.6, < 2)
28
28
  minitest (>= 5.1)
29
29
  tzinfo (~> 2.0)
30
+ addressable (2.8.1)
31
+ public_suffix (>= 2.0.2, < 6.0)
30
32
  ansi (1.5.0)
31
33
  ast (2.4.2)
32
34
  builder (3.2.4)
@@ -39,7 +41,9 @@ GEM
39
41
  childprocess (4.0.0)
40
42
  coderay (1.1.3)
41
43
  concurrent-ruby (1.1.10)
42
- dalli (3.2.2)
44
+ crack (0.4.5)
45
+ rexml
46
+ dalli (3.2.3)
43
47
  diff-lcs (1.5.0)
44
48
  docile (1.4.0)
45
49
  fakeweb (1.3.0)
@@ -66,6 +70,7 @@ GEM
66
70
  faraday_middleware
67
71
  multi_json
68
72
  gli (2.21.0)
73
+ hashdiff (1.0.1)
69
74
  i18n (1.12.0)
70
75
  concurrent-ruby (~> 1.0)
71
76
  imagen (0.1.8)
@@ -116,6 +121,7 @@ GEM
116
121
  pry (0.14.1)
117
122
  coderay (~> 1.1)
118
123
  method_source (~> 1.0)
124
+ public_suffix (5.0.0)
119
125
  rack (2.2.4)
120
126
  rainbow (3.1.1)
121
127
  rake (13.0.3)
@@ -168,11 +174,16 @@ GEM
168
174
  rainbow (>= 2.1, < 4.0)
169
175
  rugged (>= 0.27, < 1.6)
170
176
  unicode-display_width (2.3.0)
177
+ webmock (3.18.1)
178
+ addressable (>= 2.8.0)
179
+ crack (>= 0.3.2)
180
+ hashdiff (>= 0.4.0, < 2.0.0)
171
181
 
172
182
  PLATFORMS
173
183
  ruby
174
184
  x86_64-darwin-19
175
185
  x86_64-darwin-20
186
+ x86_64-darwin-21
176
187
  x86_64-linux
177
188
 
178
189
  DEPENDENCIES
@@ -195,6 +206,7 @@ DEPENDENCIES
195
206
  simplecov (>= 0.18.0)
196
207
  simplecov-lcov
197
208
  undercover
209
+ webmock
198
210
 
199
211
  BUNDLED WITH
200
- 2.3.23
212
+ 2.3.26
data/Makefile CHANGED
@@ -15,7 +15,17 @@ export PRINT_HELP_PYSCRIPT
15
15
  help:
16
16
  @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
17
17
 
18
- default: clean-coverage test coverage quality ## run default typechecking, tests and quality
18
+ default: clean-coverage test coverage clean-typecoverage typecheck typecoverage quality ## run default typechecking, tests and quality
19
+
20
+ typecheck: ## validate types in code and configuration
21
+
22
+ citypecheck: typecheck ## Run type check from CircleCI
23
+
24
+ typecoverage: typecheck ## Run type checking and then ratchet coverage in metrics/
25
+
26
+ clean-typecoverage: ## Clean out type-related coverage previous results to avoid flaky results
27
+
28
+ citypecoverage: typecoverage ## Run type checking, ratchet coverage, and then complain if ratchet needs to be committed
19
29
 
20
30
  requirements_dev.txt.installed: requirements_dev.txt
21
31
  pip install -q --disable-pip-version-check -r requirements_dev.txt
@@ -42,8 +52,6 @@ clean: clear_metrics ## remove all built artifacts
42
52
 
43
53
  citest: test ## Run unit tests from CircleCI
44
54
 
45
- typecheck: ## validate types in code and configuration
46
-
47
55
  overcommit: ## run precommit quality checks
48
56
  bundle exec overcommit --run
49
57
 
@@ -66,17 +74,7 @@ coverage: test report-coverage ## check code coverage
66
74
 
67
75
  report-coverage: test ## Report summary of coverage to stdout, and generate HTML, XML coverage report
68
76
 
69
- report-coverage-to-codecov: report-coverage ## use codecov.io for PR-scoped code coverage reports
70
- @curl -Os https://uploader.codecov.io/latest/linux/codecov
71
- @chmod +x codecov
72
- @./codecov --file coverage/lcov/checkoff.lcov --nonZero
73
-
74
- # https://github.com/bluelabsio/records-mover/blob/master/Makefile#L25
75
- cicoverage: report-coverage-to-codecov ## check code coverage, then report to codecov
76
- @echo "Looking for un-checked-in unit test coverage metrics..."
77
- @git status --porcelain coverage/.last_run.json
78
- @git diff coverage/.last_run.json
79
- @test -z "$(git status --porcelain coverage/.last_run.json)"
77
+ cicoverage: coverage ## check code coverage
80
78
 
81
79
  update_from_cookiecutter: ## Bring in changes from template project used to create this repo
82
80
  bundle exec overcommit --uninstall
data/checkoff.gemspec CHANGED
@@ -51,6 +51,7 @@ Gem::Specification.new do |spec|
51
51
  spec.add_development_dependency 'simplecov', ['>=0.18.0']
52
52
  spec.add_development_dependency 'simplecov-lcov'
53
53
  spec.add_development_dependency 'undercover'
54
+ spec.add_development_dependency 'webmock'
54
55
  spec.metadata = {
55
56
  'rubygems_mfa_required' => 'true',
56
57
  }
data/fix.sh CHANGED
@@ -188,7 +188,7 @@ ensure_bundle() {
188
188
  #
189
189
  # This affects nokogiri, which will try to reinstall itself in
190
190
  # Docker builds where it's already installed if this is not run.
191
- for platform in x86_64-darwin-20 x86_64-linux
191
+ for platform in x86_64-darwin-21 x86_64-linux
192
192
  do
193
193
  grep "${platform:?}" Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform "${platform:?}"
194
194
  done
@@ -18,7 +18,7 @@ module Checkoff
18
18
  config_value = @config[key]
19
19
  return config_value unless config_value.nil?
20
20
 
21
- ENV[envvar_name(key)]
21
+ ENV.fetch(envvar_name(key), nil)
22
22
  end
23
23
 
24
24
  def fetch(key)
@@ -11,7 +11,9 @@ module Checkoff
11
11
  # Parse Asana search URLs into parameters suitable to pass into
12
12
  # the /workspaces/{workspace_gid}/tasks/search endpoint
13
13
  class Parser
14
- def initialize(_deps = {}); end
14
+ def initialize(_deps = {})
15
+ # allow dependencies to be passed in by tests
16
+ end
15
17
 
16
18
  def convert_params(url)
17
19
  url_params = CGI.parse(URI.parse(url).query)
@@ -5,32 +5,69 @@ require_relative 'custom_field_param_converter'
5
5
  module Checkoff
6
6
  module Internal
7
7
  module SearchUrl
8
+ # See
9
+ # https://developers.asana.com/docs/search-tasks-in-a-workspace
10
+ # for the return value of 'convert' here:
8
11
  module SimpleParam
9
12
  # base class for handling different types of search url params
10
13
  class SimpleParam
11
- def initialize(values:)
14
+ def initialize(key:, values:)
15
+ @key = key
12
16
  @values = values
13
17
  end
14
18
 
15
19
  private
16
20
 
17
- attr_reader :values
21
+ def single_value
22
+ @single_value ||= begin
23
+ raise "Teach me how to handle #{key} = #{values}" if values.length != 1
24
+
25
+ values.fetch(0)
26
+ end
27
+ end
28
+
29
+ attr_reader :key, :values
18
30
  end
19
31
 
20
32
  # Handle 'any_projects.ids' search url param
21
33
  class AnyProjectsIds < SimpleParam
34
+ def projects
35
+ @projects ||= []
36
+ end
37
+
38
+ def sections
39
+ @sections ||= []
40
+ end
41
+
42
+ def parse!
43
+ # Inputs:
44
+ # 123_column_456 means "abc" project, "def" section
45
+ # 123 means "abc" project
46
+ # 123~456 means "abc" and "def" projects
47
+ project_section_pairs = single_value.split('~')
48
+ project_section_pairs.each do |project_section_pair|
49
+ project, section = project_section_pair.split('_column_')
50
+ if section.nil?
51
+ projects << project
52
+ else
53
+ sections << section
54
+ end
55
+ end
56
+ end
57
+
22
58
  def convert
23
- ['projects.any', values.join(',')]
59
+ parse!
60
+ out = {}
61
+ out['projects.any'] = projects.join(',') unless projects.empty?
62
+ out['sections.any'] = sections.join(',') unless sections.empty?
63
+ out.to_a.flatten
24
64
  end
25
65
  end
26
66
 
27
67
  # Handle 'completion' search url param
28
68
  class Completion < SimpleParam
29
69
  def convert
30
- raise "Teach me how to handle #{key} = #{values}" if values.length != 1
31
-
32
- value = values.fetch(0)
33
- raise "Teach me how to handle #{key} = #{values}" if value != 'incomplete'
70
+ raise "Teach me how to handle #{key} = #{values}" if single_value != 'incomplete'
34
71
 
35
72
  ['completed', false]
36
73
  end
@@ -39,13 +76,27 @@ module Checkoff
39
76
  # Handle 'not_tags.ids' search url param
40
77
  class NotTagsIds < SimpleParam
41
78
  def convert
42
- raise "Teach me how to handle #{key} = #{values}" if values.length != 1
43
-
44
- value = values.fetch(0)
45
- tag_ids = value.split('~')
79
+ tag_ids = single_value.split('~')
46
80
  ['tags.not', tag_ids.join(',')]
47
81
  end
48
82
  end
83
+
84
+ # handle 'subtask' search url param
85
+ class Subtask < SimpleParam
86
+ def convert
87
+ return ['is_subtask', false] if single_value == 'is_not_subtask'
88
+
89
+ raise "Teach me how to handle #{key} = #{values}"
90
+ end
91
+ end
92
+
93
+ # Handle 'any_tags.ids' search url param
94
+ class AnyTagsIds < SimpleParam
95
+ def convert
96
+ tag_ids = single_value.split('~')
97
+ ['tags.any', tag_ids.join(',')]
98
+ end
99
+ end
49
100
  end
50
101
 
51
102
  # Convert simple parameters - ones where the param name itself
@@ -56,9 +107,9 @@ module Checkoff
56
107
  end
57
108
 
58
109
  def convert
59
- simple_url_params.to_a.to_h do |key, values|
60
- convert_arg(key, values)
61
- end
110
+ simple_url_params.to_a.flat_map do |key, values|
111
+ convert_arg(key, values).each_slice(2).to_a
112
+ end.to_h
62
113
  end
63
114
 
64
115
  private
@@ -67,12 +118,14 @@ module Checkoff
67
118
  'any_projects.ids' => SimpleParam::AnyProjectsIds,
68
119
  'completion' => SimpleParam::Completion,
69
120
  'not_tags.ids' => SimpleParam::NotTagsIds,
121
+ 'any_tags.ids' => SimpleParam::AnyTagsIds,
122
+ 'subtask' => SimpleParam::Subtask,
70
123
  }.freeze
71
124
 
72
125
  # https://developers.asana.com/docs/search-tasks-in-a-workspace
73
126
  def convert_arg(key, values)
74
127
  clazz = ARGS.fetch(key)
75
- clazz.new(values: values).convert
128
+ clazz.new(key: key, values: values).convert
76
129
  end
77
130
 
78
131
  attr_reader :simple_url_params
@@ -110,7 +110,8 @@ module Checkoff
110
110
  raise "Could not find task in project_gid #{project_gid}: #{task}" if membership.nil?
111
111
 
112
112
  current_section = membership['section']['name']
113
- current_section = nil if ['(no section)', 'Untitled section'].include?(current_section)
113
+ inbox_section_names = ['(no section)', 'Untitled section', 'Inbox']
114
+ current_section = nil if inbox_section_names.include?(current_section)
114
115
  by_section[current_section] ||= []
115
116
  by_section[current_section] << task
116
117
  end
@@ -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.20.0'
6
+ VERSION = '0.22.0'
7
7
  end
@@ -3,15 +3,7 @@
3
3
  desc 'Ensure that any locally ratcheted coverage metrics are cleared back ' \
4
4
  'to git baseline'
5
5
  task :clear_metrics do |_t|
6
- ret =
7
- system('git checkout coverage/.last_run.json')
8
- raise unless ret
9
-
10
6
  # Without this old lines which are removed are still counted,
11
7
  # leading to inconsistent coverage percentages between runs.
12
- #
13
- # need to save coverage/.last_run.json
14
- ret =
15
- system('rm -fr coverage/assets coverage/.*.json.lock coverage/lcov/* coverage/index.html coverage/.resultset.json')
16
- raise unless ret
8
+ raise unless system('rm -fr coverage/')
17
9
  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.20.0
4
+ version: 0.22.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: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2023-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -318,6 +318,20 @@ dependencies:
318
318
  - - ">="
319
319
  - !ruby/object:Gem::Version
320
320
  version: '0'
321
+ - !ruby/object:Gem::Dependency
322
+ name: webmock
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - ">="
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
328
+ type: :development
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - ">="
333
+ - !ruby/object:Gem::Version
334
+ version: '0'
321
335
  description:
322
336
  email:
323
337
  - vince@broz.cc
@@ -327,7 +341,6 @@ extensions: []
327
341
  extra_rdoc_files: []
328
342
  files:
329
343
  - ".circleci/config.yml"
330
- - ".envrc"
331
344
  - ".git-hooks/pre_commit/circle_ci.rb"
332
345
  - ".gitattributes"
333
346
  - ".gitignore"
@@ -352,7 +365,6 @@ files:
352
365
  - bin/rake
353
366
  - bin/setup
354
367
  - checkoff.gemspec
355
- - coverage/.last_run.json
356
368
  - docs/cookiecutter_input.json
357
369
  - docs/example_project.png
358
370
  - exe/checkoff
@@ -429,7 +441,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
429
441
  - !ruby/object:Gem::Version
430
442
  version: '0'
431
443
  requirements: []
432
- rubygems_version: 3.2.33
444
+ rubygems_version: 3.1.6
433
445
  signing_key:
434
446
  specification_version: 4
435
447
  summary: Command-line and gem client for Asana (unofficial)
data/.envrc DELETED
@@ -1,4 +0,0 @@
1
- # shellcheck shell=bash
2
- PATH_add bin
3
- export ASANA__PERSONAL_ACCESS_TOKEN="op://Private/Asana access token - VLD read-write/token" ASANA__DEFAULT_ASSIGNEE_GID="op://Private/Asana access token - VLD read-write/default_workspace_gid" ASANA__DEFAULT_WORKSPACE_GID="op://Private/Asana access token - VLD read-write/default_workspace_gid"
4
- direnv_load with-op op run --cache -- direnv dump
@@ -1,6 +0,0 @@
1
- {
2
- "result": {
3
- "line": 99.62,
4
- "branch": 86.42
5
- }
6
- }