documinty 0.3.1 โ 0.3.2
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 +4 -4
- data/lib/documinty/cli.rb +45 -11
- data/lib/documinty/store.rb +31 -2
- data/lib/documinty/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e847137dcc7a46903f7339d096678c5a07c32413e8877830ba496c6e1325e9e7
|
|
4
|
+
data.tar.gz: 5672e3ce3188e413bbc292bfe457deb90af10ba22a3ec8b8a9dbeb28635b2aba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0859bd3be39d71225c6a04577062a93b5d3411fb237a6c1de93467e78dc74b8b27fefba48908914a52d92385efbc11086479580ed9c2de51a7e23e1579264c83'
|
|
7
|
+
data.tar.gz: 4f55d997b8b3a5a1261985830c169b7fb0bf8bdf9c42346c3f5482c492bde72ac0ccc3c7ad6f6deff1b5ea5a0a6cf819b61776db2ed0a68a8aa7f31b21f4623f
|
data/lib/documinty/cli.rb
CHANGED
|
@@ -221,10 +221,15 @@ module Documinty
|
|
|
221
221
|
end
|
|
222
222
|
end
|
|
223
223
|
|
|
224
|
-
desc "
|
|
225
|
-
option :feature, aliases: '-f', required: true, desc:
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
desc "methods FILE", "Prompt for removing or adding methods to a tagged file pass add or remove as the action"
|
|
225
|
+
option :feature, aliases: '-f', required: true, desc: 'Feature name to group under'
|
|
226
|
+
option :action, aliases: '-a', required: true, desc: 'Node/type label'
|
|
227
|
+
def methods(path)
|
|
228
|
+
if options[:action] != 'add' && options[:action] != 'remove'
|
|
229
|
+
say "โ Action not supported must be 'add' OR 'remove'", :red
|
|
230
|
+
exit(1)
|
|
231
|
+
end
|
|
232
|
+
|
|
228
233
|
methods_input = ask("Enter comma-separated methods to add to this node๐ ๏ธ:")
|
|
229
234
|
method_syms = methods_input
|
|
230
235
|
.split(",")
|
|
@@ -233,10 +238,11 @@ module Documinty
|
|
|
233
238
|
.map(&:to_sym)
|
|
234
239
|
|
|
235
240
|
begin
|
|
236
|
-
entry = store.
|
|
241
|
+
entry = store.methods(
|
|
237
242
|
path: path,
|
|
238
243
|
feature: options[:feature],
|
|
239
|
-
new_methods: method_syms
|
|
244
|
+
new_methods: method_syms,
|
|
245
|
+
action: options[:action].to_sym
|
|
240
246
|
)
|
|
241
247
|
say "โ
Updated methods for #{entry['path']} under '#{entry['feature']}': #{Array(entry['methods']).join(', ')}", :green
|
|
242
248
|
rescue Error => e
|
|
@@ -265,18 +271,46 @@ module Documinty
|
|
|
265
271
|
end
|
|
266
272
|
|
|
267
273
|
entries.each do |e|
|
|
268
|
-
|
|
269
|
-
|
|
274
|
+
desc_text = e['description'].to_s.strip
|
|
275
|
+
|
|
276
|
+
if desc_text.empty?
|
|
270
277
|
say "โน๏ธ No description provided for '#{path}' under '#{e['feature']}'", :yellow
|
|
271
278
|
else
|
|
272
|
-
|
|
273
|
-
|
|
279
|
+
if options[:feature]
|
|
280
|
+
# Only one feature context
|
|
281
|
+
say "๐ #{path}", :cyan
|
|
282
|
+
else
|
|
283
|
+
# Show which feature this description belongs to
|
|
284
|
+
say(
|
|
285
|
+
set_color("๐ #{path} ๏ธ", :cyan) +
|
|
286
|
+
": " +
|
|
287
|
+
set_color("(FEATURE: #{e['feature']})", :magenta)
|
|
288
|
+
)
|
|
289
|
+
end
|
|
290
|
+
say "--โ #{desc_text}", :green
|
|
274
291
|
end
|
|
275
292
|
end
|
|
276
293
|
end
|
|
277
294
|
|
|
278
|
-
|
|
295
|
+
desc "update-description FILE", "Prompt for and update description for FILE under a feature"
|
|
296
|
+
option :feature, aliases: '-f', required: true, desc: 'Feature name'
|
|
297
|
+
def update_description(path)
|
|
298
|
+
begin
|
|
299
|
+
new_desc = ask("Enter a new description for '#{path}' under '#{options[:feature]}':")
|
|
300
|
+
entry = store.update_description(
|
|
301
|
+
path: path,
|
|
302
|
+
feature: options[:feature],
|
|
303
|
+
new_description: new_desc
|
|
304
|
+
)
|
|
305
|
+
say "โ
Description updated for #{entry['path']} under '#{entry['feature']}':", :green
|
|
306
|
+
say " #{entry['description']}", :green
|
|
307
|
+
rescue Error => e
|
|
308
|
+
say "โ #{e.message}", :red
|
|
309
|
+
exit(1)
|
|
310
|
+
end
|
|
311
|
+
end
|
|
279
312
|
|
|
313
|
+
private
|
|
280
314
|
|
|
281
315
|
def truncate(text)
|
|
282
316
|
return "" unless text
|
data/lib/documinty/store.rb
CHANGED
|
@@ -108,7 +108,7 @@ module Documinty
|
|
|
108
108
|
# @param feature [String] feature name (must already exist on that entry)
|
|
109
109
|
# @param new_methods [Array<Symbol>] list of symbols to add
|
|
110
110
|
# @return [Hash] the updated entry
|
|
111
|
-
def
|
|
111
|
+
def methods(path:, feature:, new_methods:, action:)
|
|
112
112
|
file = feature_file(feature)
|
|
113
113
|
raise Error, "Feature '#{feature}' does not exist" unless File.exist?(file)
|
|
114
114
|
|
|
@@ -123,13 +123,42 @@ module Documinty
|
|
|
123
123
|
|
|
124
124
|
# Merge existing methods (strings) with new ones, avoid duplicates
|
|
125
125
|
existing = Array(entry['methods']).map(&:to_s)
|
|
126
|
-
|
|
126
|
+
if action == :add
|
|
127
|
+
merged = (existing + new_methods.map(&:to_s)).uniq
|
|
128
|
+
else
|
|
129
|
+
merged = (existing - new_methods.map(&:to_s)).uniq
|
|
130
|
+
end
|
|
127
131
|
entry['methods'] = merged
|
|
128
132
|
|
|
129
133
|
File.write(file, data.to_yaml)
|
|
130
134
|
entry
|
|
131
135
|
end
|
|
132
136
|
|
|
137
|
+
# Update the description for a documented file under a given feature
|
|
138
|
+
# @param path [String] relative file path
|
|
139
|
+
# @param feature [String] feature name
|
|
140
|
+
# @param new_description [String]
|
|
141
|
+
# @return [Hash] the updated entry
|
|
142
|
+
def update_description(path:, feature:, new_description:)
|
|
143
|
+
file = feature_file(feature)
|
|
144
|
+
unless File.exist?(file)
|
|
145
|
+
raise Error, "Feature '#{feature}' does not exist"
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
data = YAML.load_file(file) || {}
|
|
149
|
+
entries = data['entries'] ||= []
|
|
150
|
+
|
|
151
|
+
entry = entries.find { |e| e['path'] == path && e['feature'] == feature }
|
|
152
|
+
unless entry
|
|
153
|
+
raise Error, "No documentation found for '#{path}' under feature '#{feature}'"
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
entry['description'] = new_description.to_s.strip
|
|
157
|
+
File.write(file, data.to_yaml)
|
|
158
|
+
|
|
159
|
+
entry
|
|
160
|
+
end
|
|
161
|
+
|
|
133
162
|
private
|
|
134
163
|
|
|
135
164
|
# Build the path to a featureโs YAML file
|
data/lib/documinty/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: documinty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcel Carrero Pedre
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-06-
|
|
10
|
+
date: 2025-06-08 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: thor
|