brainiac-fizzy 0.0.43 → 0.0.44

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: 7a31ac01cdee77c3025a92097cece2c0f86d1fea3c479abcdeac306b09d7ef23
4
- data.tar.gz: 8efaa4aa4338bbc2f731986507a305850b507883fb8169b78fdc8333c97589f1
3
+ metadata.gz: 8c290f711243211d67abdd35bf34d3abd9676461f81bfd104b03f6b53e243328
4
+ data.tar.gz: 72e650801901d0c6150f231ac16104124ceff67df87ffc39cbd3abf09b915e30
5
5
  SHA512:
6
- metadata.gz: e3fced8d93c21f0c9600619fdb9f1fa996bbc98fb393695d1d0c6b39c66ba6a74a1f4c032f575e4416ffe5cfa0f1fd80f9be4df7bf237794cbbdd53c6f56d862
7
- data.tar.gz: c69760d16a0f0039a1eaab9daa1e30fd8346f43ce824ee031d6a1b2229ea636d3c01b46a3af987c0bd24ed6034bbddf0ea9ecc2a1afc312d5e75d36a4de68c7e
6
+ metadata.gz: 5e03a9c0438cbb058848b27bc9f66af30392eca388212740a6eb1a7f0c82f7c257c2b8d09dfde839d9a37feee4549f484546f2e4da77af417c1b4202f686bf6c
7
+ data.tar.gz: 185febcad0410ecb6a75020887d1d04e00ef753e6dd3d9193b8cfecb21eaf24d6df226ba3a7b608e85673ef655cb4cde4baad62a7bb1e582db27e6453a23c010
@@ -245,22 +245,24 @@ module Brainiac
245
245
  tags = ctx[:tags] || []
246
246
  assign_to = ctx[:assign_to]
247
247
 
248
- # Resolve tag IDs
249
248
  agent_env = agent_env_for("Threepio")
250
249
  spawn_env = agent_env.empty? ? {} : agent_env
251
- tag_ids = resolve_tag_ids(tags, spawn_env)
252
250
 
253
- cmd = ["fizzy", "card", "create", "--board", board_id, "--title", title, "--description", description]
254
- cmd.push("--tag-ids", tag_ids.join(",")) unless tag_ids.empty?
255
-
256
- output, status = Open3.capture2e(spawn_env, *cmd)
257
- next nil unless status.success?
251
+ # fizzy 4 has no tag flag on create, so tags go on afterwards
252
+ output, status = Open3.capture2e(spawn_env, "fizzy", "card", "create", "--board", board_id,
253
+ "--title", title, "--description", description)
254
+ unless status.success?
255
+ LOG.error "[Fizzy] fizzy card create failed: #{output.strip[0, 300]}" if defined?(LOG)
256
+ next nil
257
+ end
258
258
 
259
259
  card_data = JSON.parse(output)
260
260
  card_number = card_data.dig("data", "number")
261
261
 
262
- # Assign if requested
263
- assign_card(card_number, assign_to, spawn_env) if card_number && assign_to
262
+ if card_number
263
+ tag_card(card_number, tags, spawn_env)
264
+ assign_card(card_number, assign_to, spawn_env) if assign_to
265
+ end
264
266
 
265
267
  { number: card_number, url: card_data.dig("data", "url"), title: title }
266
268
  rescue StandardError => e
@@ -416,17 +418,12 @@ module Brainiac
416
418
  closed
417
419
  end
418
420
 
419
- def resolve_tag_ids(tag_names, spawn_env)
420
- output, status = Open3.capture2e(spawn_env, "fizzy", "tag", "list", "--all")
421
- return [] unless status.success?
422
-
423
- all_tags = JSON.parse(output)["data"] || []
424
- tag_names.filter_map do |name|
425
- tag = all_tags.find { |t| t["title"].downcase == name.downcase }
426
- tag&.dig("id")
421
+ # `fizzy card tag` toggles, which is safe on a card that was just created.
422
+ def tag_card(card_number, tag_names, spawn_env)
423
+ tag_names.each do |name|
424
+ output, status = Open3.capture2e(spawn_env, "fizzy", "card", "tag", card_number.to_s, "--tag", name)
425
+ LOG.warn "[Fizzy] Couldn't tag card ##{card_number} #{name}: #{output.strip[0, 200]}" if !status.success? && defined?(LOG)
427
426
  end
428
- rescue StandardError
429
- []
430
427
  end
431
428
 
432
429
  def assign_card(card_number, agent_name, spawn_env)
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Fizzy
6
- VERSION = "0.0.43"
6
+ VERSION = "0.0.44"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-fizzy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis