checkoff 0.186.0 → 0.188.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: ab93a442000f1d706e304c5d574a9266c19dcff4be222107dc943f6c1d3ecd3f
4
- data.tar.gz: 373ce95b10e181827c2423bfce1a0a37f43a12b32ebebd79ea5b8e98dcc0787f
3
+ metadata.gz: 6adfa7e1e576e5fe7d462404260037f351d1995cfdbcac89f1292b3baf71aa69
4
+ data.tar.gz: a2bd18068eddd8f0844390dc22002710e7338d73c85b33733d3f4f426a223c1b
5
5
  SHA512:
6
- metadata.gz: b4f7267e3254bb4d22593bca64557ec58641b69ff95ceb7890c34a5c87512b27a5dda4fecf7db78ee5088692dbcc8c5380f673459a9df3c1edd744746215d364
7
- data.tar.gz: '0680cf901961be8001249375c81ceaa77ed903e0acb2f06ecc3b62093a110d7d4bcc225e706d46b31838a50d08d0f8811f4e636166715f5d48b73e33a940f521'
6
+ metadata.gz: 64c3cb55f53d9fd2904a5e29327f3ae42a3b2e52ee3a891e3730245f1edd32af2815ae1e80bbbb0cb838b21e79dca8f10edf6a0f8594cc00fce492a55276ca47
7
+ data.tar.gz: 830d6ac25e2d4f638eec6258cd6ea8d4ccc40f1d51e05d0f96be7ac831ff7eddf5c76f2da0f6b5dc16d1b4b041623634b1c7450a20513b3041c30140d9bd299e
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.186.0)
15
+ checkoff (0.188.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -180,7 +180,7 @@ 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.34.4)
183
+ rubocop-minitest (0.34.5)
184
184
  rubocop (>= 1.39, < 2.0)
185
185
  rubocop-ast (>= 1.30.0, < 2.0)
186
186
  rubocop-rake (0.6.0)
@@ -262,4 +262,4 @@ DEPENDENCIES
262
262
  yard
263
263
 
264
264
  BUNDLED WITH
265
- 2.4.22
265
+ 2.5.5
@@ -2,6 +2,14 @@
2
2
  #
3
3
  # rubocop:disable Layout/LineLength
4
4
  # @!parse
5
+ # module OpenSSL
6
+ # module SSL
7
+ # # @type [Integer]
8
+ # VERIFY_PEER = 1
9
+ # # @type [Integer]
10
+ # VERIFY_NONE = 0
11
+ # end
12
+ # end
5
13
  # class Time
6
14
  # class << self
7
15
  # # @param time [String]
data/fix.sh CHANGED
@@ -146,18 +146,23 @@ ensure_bundle() {
146
146
  # Version <2.2.22 of bundler isn't compatible with Ruby 3.3:
147
147
  #
148
148
  # https://stackoverflow.com/questions/70800753/rails-calling-didyoumeanspell-checkers-mergeerror-name-spell-checker-h
149
+ #
150
+ #
151
+ # Version 2.5.5 fixed an issue in 2.2.22 with the 'bump' gem:
152
+ #
153
+ # https://app.circleci.com/pipelines/github/apiology/checkoff/1281/workflows/f667f909-c3fc-4ae2-8593-dde2b588a7a7/jobs/2491
149
154
  need_better_bundler=false
150
155
  if [ "${bundler_version_major}" -lt 2 ]
151
156
  then
152
157
  need_better_bundler=true
153
158
  elif [ "${bundler_version_major}" -eq 2 ]
154
159
  then
155
- if [ "${bundler_version_minor}" -lt 2 ]
160
+ if [ "${bundler_version_minor}" -lt 5 ]
156
161
  then
157
162
  need_better_bundler=true
158
- elif [ "${bundler_version_minor}" -eq 2 ]
163
+ elif [ "${bundler_version_minor}" -eq 5 ]
159
164
  then
160
- if [ "${bundler_version_patch}" -lt 23 ]
165
+ if [ "${bundler_version_patch}" -lt 5 ]
161
166
  then
162
167
  need_better_bundler=true
163
168
  fi
@@ -165,9 +170,12 @@ ensure_bundle() {
165
170
  fi
166
171
  if [ "${need_better_bundler}" = true ]
167
172
  then
173
+ >&2 echo "Original bundler version: ${bundler_version}"
168
174
  # need to do this first before 'bundle update --bundler' will work
169
175
  make bundle_install
170
176
  bundle update --bundler
177
+ gem install bundler:2.5.5
178
+ >&2 echo "Updated bundler version: $(bundle --version)"
171
179
  # ensure next step installs fresh bundle
172
180
  rm -f Gemfile.lock.installed
173
181
  fi
@@ -9,6 +9,7 @@ require 'mime/types'
9
9
  require 'net/http'
10
10
  require 'net/http/response'
11
11
  require 'net/http/responses'
12
+ require 'openssl'
12
13
  require 'tempfile'
13
14
  require_relative 'internal/config_loader'
14
15
  require_relative 'internal/logging'
@@ -55,16 +56,19 @@ module Checkoff
55
56
  # @param resource [Asana::Resources::Resource]
56
57
  # @param attachment_name [String,nil]
57
58
  # @param just_the_url [Boolean]
59
+ # @param verify_mode [Integer<OpenSSL::SSL::VERIFY_NONE,OpenSSL::SSL::VERIFY_PEER>]
58
60
  #
59
61
  # @return [Asana::Resources::Attachment]
60
62
  def create_attachment_from_url!(url,
61
63
  resource,
62
64
  attachment_name: nil,
65
+ verify_mode: OpenSSL::SSL::VERIFY_PEER,
63
66
  just_the_url: false)
64
67
  if just_the_url
65
68
  create_attachment_from_url_alone!(url, resource, attachment_name: attachment_name)
66
69
  else
67
- create_attachment_from_downloaded_url!(url, resource, attachment_name: attachment_name)
70
+ create_attachment_from_downloaded_url!(url, resource, attachment_name: attachment_name,
71
+ verify_mode: verify_mode)
68
72
  end
69
73
  end
70
74
 
@@ -75,25 +79,23 @@ module Checkoff
75
79
  # not succesful
76
80
  #
77
81
  # @param uri [URI]
82
+ # @param verify_mode [OpenSSL::SSL::VERIFY_NONE,OpenSSL::SSL::VERIFY_PEER]
78
83
  #
79
84
  # @return [Object]
80
85
  # @sg-ignore
81
- def download_uri(uri, &block)
86
+ def download_uri(uri, verify_mode: OpenSSL::SSL::VERIFY_PEER, &block)
82
87
  out = nil
83
- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
88
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https', verify_mode: verify_mode) do |http|
84
89
  # @sg-ignore
85
- request = Net::HTTP::Get.new(uri)
86
- http.request(request) do |response|
87
- # use a block to ensure the file is closed after we're done with it
90
+ http.request(Net::HTTP::Get.new(uri)) do |response|
88
91
  raise("Unexpected response code: #{response.code}") unless response.code == '200'
89
92
 
90
- write_tempfile_from_response(response) do |tempfile|
91
- out = block.yield tempfile
92
- end
93
+ write_tempfile_from_response(response) { |tempfile| out = block.yield tempfile }
93
94
  end
94
95
  end
95
96
  out
96
97
  rescue StandardError => e
98
+ debug { e }
97
99
  raise "Error downloading #{uri}: #{e}"
98
100
  end
99
101
 
@@ -119,12 +121,14 @@ module Checkoff
119
121
  # @param url [String]
120
122
  # @param resource [Asana::Resources::Resource]
121
123
  # @param attachment_name [String,nil]
124
+ # @param verify_mode [Integer<OpenSSL::SSL::VERIFY_NONE,OpenSSL::SSL::VERIFY_PEER>]
122
125
  #
123
126
  # @return [Asana::Resources::Attachment]
124
- def create_attachment_from_downloaded_url!(url, resource, attachment_name:)
127
+ def create_attachment_from_downloaded_url!(url, resource, attachment_name:,
128
+ verify_mode: OpenSSL::SSL::VERIFY_PEER)
125
129
  uri = URI(url)
126
130
  attachment_name ||= File.basename(uri.path)
127
- download_uri(uri) do |tempfile|
131
+ download_uri(uri, verify_mode: verify_mode) do |tempfile|
128
132
  content_type ||= content_type_from_filename(attachment_name)
129
133
  content_type ||= content_type_from_filename(uri.path)
130
134
 
@@ -100,6 +100,26 @@ module Checkoff
100
100
  end
101
101
  end
102
102
 
103
+ # :in_portfolio_more_than_once? function
104
+ class InPortfolioMoreThanOncePFunctionEvaluator < FunctionEvaluator
105
+ def matches?
106
+ fn?(selector, :in_portfolio_more_than_once?)
107
+ end
108
+
109
+ # @param _index [Integer]
110
+ def evaluate_arg?(_index)
111
+ false
112
+ end
113
+
114
+ # @sg-ignore
115
+ # @param task [Asana::Resources::Task]
116
+ # @param portfolio_name [String]
117
+ # @return [Boolean]
118
+ def evaluate(task, portfolio_name)
119
+ @tasks.in_portfolio_more_than_once?(task, portfolio_name)
120
+ end
121
+ end
122
+
103
123
  # :tag? function
104
124
  class TagPFunctionEvaluator < FunctionEvaluator
105
125
  def matches?
@@ -242,10 +242,11 @@ module Checkoff
242
242
  only_uncompleted: true,
243
243
  extra_fields: ['dependents'] + extra_task_fields)
244
244
  debug { "#{task.name} has dependent task #{dependent_task.name}" }
245
- unless dependent_task.nil?
246
- dependent_tasks << dependent_task
247
- dependent_tasks += all_dependent_tasks(dependent_task)
248
- end
245
+ next if dependent_task.nil?
246
+
247
+ dependent_tasks << dependent_task
248
+ dependent_tasks += all_dependent_tasks(dependent_task,
249
+ extra_task_fields: extra_task_fields)
249
250
  end
250
251
  dependent_tasks
251
252
  end
@@ -292,6 +293,27 @@ module Checkoff
292
293
  end
293
294
  end
294
295
 
296
+ # True if the task is in a project which is in the given portfolio
297
+ #
298
+ # @param task [Asana::Resources::Task]
299
+ # @param portfolio_name [String]
300
+ # @param workspace_name [String]
301
+ def in_portfolio_more_than_once?(task,
302
+ portfolio_name,
303
+ workspace_name: @workspaces.default_workspace.name)
304
+ portfolio_projects = @portfolios.projects_in_portfolio(workspace_name, portfolio_name)
305
+ portfolio_project_gids = portfolio_projects.map(&:gid)
306
+ seen = false
307
+ task.memberships.each do |membership|
308
+ project_gid = membership.fetch('project').fetch('gid')
309
+ next unless portfolio_project_gids.include?(project_gid)
310
+ return true if seen
311
+
312
+ seen = true
313
+ end
314
+ false
315
+ end
316
+
295
317
  # @return [Hash]
296
318
  def as_cache_key
297
319
  {}
@@ -107,6 +107,8 @@ module Checkoff
107
107
  next true unless limit_to_projects.map(&:gid).include? project_gid
108
108
  end
109
109
 
110
+ # do this once, but lazily, so we don't have to do it if all
111
+ # projects are excluded
110
112
  all_dependent_milestones ||=
111
113
  @tasks.all_dependent_tasks(task,
112
114
  extra_task_fields: ['resource_subtype',
@@ -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.186.0'
6
+ VERSION = '0.188.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.186.0
4
+ version: 0.188.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: 2024-01-27 00:00:00.000000000 Z
11
+ date: 2024-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport