trello_tool 0.2.0 → 0.3.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: d4cfb13afc59a0bbc26ff8d073ec8205a8be3186078586626f2b1d1a6678534b
4
- data.tar.gz: 24100d779e70261e15fd631cf8cc8c6e15bbfe52b4c14e020759244c10ac91f2
3
+ metadata.gz: 6285e864995998fa87994fef2bc12d24aa75b9e041a021c694a441ef66f2ee6f
4
+ data.tar.gz: 0f4513bd8adb2690cc7b3fa6f8f3e18bbd3646e1f0cdad4ffdecf686953e2007
5
5
  SHA512:
6
- metadata.gz: 0645b48ad54aea192469652a91a4d809c502cd32a97a440dbde72a40992ad365ba948c465d8c8e8705b424367f80783111cd36bf13530ad289f8515611a9d34e
7
- data.tar.gz: a1a50a0449d75ddd376931d32caf80f057ca973d5825a003d4bee9b5ded2d89aea22501ae235cedebc78e40d89314b972773e701ffb330261aae5dbc314d633b
6
+ metadata.gz: d69e46335a0ce78842525b55bf821e3af32ffc72eaaee6c4de4da144827b91fd5f21df905d5ffa52ebc21e8b5ec972f5bb62ecd8c5f179138ffe427ad4174143
7
+ data.tar.gz: 5fe44e4a578ea926056e8617a8e1080dd30df28fca91c03733ce175e80066a3881f23e466a3c77700e9452c43d6b43f20850d7eb73c0099bdd2a3256ae7f8628
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2026-09-04
4
+
5
+ * added `summarize_as_md_long`
6
+
3
7
  ## [0.2.0] - 2022-05-21
4
8
 
5
9
  * added `summarize_as_md_long`
@@ -3,7 +3,11 @@
3
3
  module TrelloTool
4
4
  # Health analysis of a board
5
5
  class Health
6
- attr_reader :board, :configuration, :symbols_and_colours, :unexpected, :expected_lists
6
+ # @return [Trello::Board]
7
+ attr_reader :board
8
+ # @return [TrelloTool::Configuration]
9
+ attr_reader :configuration
10
+ attr_reader :symbols_and_colours, :unexpected, :expected_lists
7
11
 
8
12
  def initialize(board, configuration)
9
13
  @board = board
@@ -54,6 +54,12 @@ module TrelloTool
54
54
  end
55
55
  end
56
56
 
57
+ # @param card_id [String]
58
+ # @return [Trello::Card]
59
+ def find_card(card_id)
60
+ client.find(:cards, card_id)
61
+ end
62
+
57
63
  def next_version_list
58
64
  @next_version_list ||= find_list_by_list_name(main_board, configuration.next_version_list_name)
59
65
  end
@@ -14,6 +14,13 @@ module TrelloTool
14
14
  match_data[1]
15
15
  end
16
16
 
17
+ # @param card_id_or_url [String] a card id or a https://trello.com/c/ID/description url
18
+ # @return [String] the card id
19
+ def extract_card_id(card_id_or_url)
20
+ match_data = %r{\Ahttps://trello.com/c/([a-zA-Z0-9]+)/?.*}.match(card_id_or_url)
21
+ match_data ? match_data[1] : card_id_or_url
22
+ end
23
+
17
24
  # @param board [Trello::Board]
18
25
  # @param list_name [String]
19
26
  # @return [Trello::List]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrelloTool
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "json"
3
4
  require "thor"
4
5
  require "trello_tool/configuration"
5
6
  require "trello_tool/health"
@@ -89,6 +90,14 @@ class TrelloToolThor < Thor
89
90
  end
90
91
  end
91
92
 
93
+ desc "card CARD_ID_OR_URL",
94
+ "prints out a card as json (title, description, url, checklists, attachment urls)"
95
+
96
+ def card(card_id_or_url)
97
+ card = client.find_card(extract_card_id(card_id_or_url))
98
+ say JSON.pretty_generate(card_as_hash(card))
99
+ end
100
+
92
101
  desc "release (VERSION)",
93
102
  "rename next_version to VERSION and create next_version. If VERSION isn't specified use whatever is in ./.RELEASE_NEW_VERSION"
94
103
 
@@ -167,5 +176,28 @@ class TrelloToolThor < Thor
167
176
  def client
168
177
  TrelloTool::TrelloClient.new(configuration)
169
178
  end
179
+
180
+ # @param card [Trello::Card]
181
+ # @return [Hash]
182
+ def card_as_hash(card)
183
+ {
184
+ title: card.name,
185
+ description: card.desc,
186
+ url: card.url,
187
+ checklists: card.checklists.map { |checklist| checklist_as_hash(checklist) },
188
+ attachment_urls: card.attachments.map(&:url)
189
+ }
190
+ end
191
+
192
+ # @param checklist [Trello::Checklist]
193
+ # @return [Hash]
194
+ def checklist_as_hash(checklist)
195
+ {
196
+ name: checklist.name,
197
+ items: checklist.check_items.map do |item|
198
+ { name: item["name"], complete: item["state"] == "complete" }
199
+ end
200
+ }
201
+ end
170
202
  end
171
203
  # rubocop:enable Metrics/ClassLength
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Diggins
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-09-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ruby-trello
@@ -38,7 +37,6 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
- description:
42
40
  email:
43
41
  - tim@red56.uk
44
42
  executables:
@@ -73,7 +71,6 @@ metadata:
73
71
  source_code_uri: https://github.com/timdiggins/trello_tool
74
72
  changelog_uri: https://github.com/timdiggins/trello_tool/blob/main/CHANGELOG.md
75
73
  rubygems_mfa_required: 'true'
76
- post_install_message:
77
74
  rdoc_options: []
78
75
  require_paths:
79
76
  - lib
@@ -88,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
85
  - !ruby/object:Gem::Version
89
86
  version: '0'
90
87
  requirements: []
91
- rubygems_version: 3.5.15
92
- signing_key:
88
+ rubygems_version: 4.0.14
93
89
  specification_version: 4
94
90
  summary: Tool for doing basic things to a dev trello using the api.
95
91
  test_files: []