tfhelps 0.1.3 → 0.1.4
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/bin/tfhelps +45 -8
- data/lib/tfhelps/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 42004c17cf81e02984fa216af7e75423275b42a2b94c04e7ae5b39b924cdb5ca
|
|
4
|
+
data.tar.gz: 14f669ae8053450a453e0afcb392dd355b72045457862ff2bec20b779361cbd4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36e5d569f3726603313683a0f0f15681b2d11c73206a43cd9cf819283ad6a96776c46394bb9c1010b52d2a86f759738f6811d9c621e7f64ebc74729d18fe0e32
|
|
7
|
+
data.tar.gz: 815497f7b9a6d4e61110cc57fd68b14565ef1299e5a73b17216d8903fcac265e04622bed79496a1b521aadd4d4bb344c81ff61c140182e12559104ce3e3757d6
|
data/bin/tfhelps
CHANGED
|
@@ -8,7 +8,7 @@ if ARGV.empty?
|
|
|
8
8
|
exit 1
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
input_path = ARGV.shift
|
|
12
12
|
api_key = ENV["GEMINI_API_KEY"]
|
|
13
13
|
|
|
14
14
|
if api_key.nil?
|
|
@@ -16,15 +16,52 @@ if api_key.nil?
|
|
|
16
16
|
exit 1
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
output_dir = "output"
|
|
20
|
+
if ARGV.include?("--output-dir")
|
|
21
|
+
index = ARGV.index("--output-dir")
|
|
22
|
+
output_dir = ARGV[index + 1]
|
|
23
|
+
ARGV.delete_at(index)
|
|
24
|
+
ARGV.delete_at(index)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def process_file(input_file, output_file, api_key)
|
|
28
|
+
input_text = File.read(input_file)
|
|
29
|
+
formatted_text = Tfhelps.format(input_text, api_key)
|
|
30
|
+
|
|
31
|
+
if formatted_text
|
|
32
|
+
File.write(output_file, formatted_text)
|
|
33
|
+
puts "Formatted text written to #{output_file}"
|
|
34
|
+
true
|
|
35
|
+
else
|
|
36
|
+
puts "Failed to format #{input_file}"
|
|
37
|
+
false
|
|
38
|
+
end
|
|
39
|
+
end
|
|
20
40
|
|
|
21
|
-
|
|
41
|
+
if File.directory?(input_path)
|
|
42
|
+
Dir.mkdir(output_dir) unless Dir.exist?(output_dir)
|
|
22
43
|
|
|
23
|
-
|
|
44
|
+
txt_files = Dir.glob(File.join(input_path, "*.txt"))
|
|
24
45
|
|
|
25
|
-
if
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
if txt_files.empty?
|
|
47
|
+
puts "No .txt files found in #{input_path}"
|
|
48
|
+
exit 1
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
puts "Processing #{txt_files.size} .txt files..."
|
|
52
|
+
|
|
53
|
+
txt_files.each do |input_file|
|
|
54
|
+
output_file = File.join(output_dir, File.basename(input_file))
|
|
55
|
+
process_file(input_file, output_file, api_key)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
puts "All files processed. Output saved in #{output_dir}/"
|
|
28
59
|
else
|
|
29
|
-
|
|
60
|
+
unless File.exist?(input_path)
|
|
61
|
+
puts "Input file does not exist: #{input_path}"
|
|
62
|
+
exit 1
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
output_file = File.basename(input_path)
|
|
66
|
+
process_file(input_path, output_file, api_key)
|
|
30
67
|
end
|
data/lib/tfhelps/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tfhelps
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wuletaw Wonte
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: |
|
|
13
13
|
The Helps Text Formatter gem is a command-line tool designed for Helps Ministries to clean up and format text files using the power of Google's Gemini API.
|
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
52
|
version: '0'
|
|
53
53
|
requirements: []
|
|
54
|
-
rubygems_version: 3.6.
|
|
54
|
+
rubygems_version: 3.6.8
|
|
55
55
|
specification_version: 4
|
|
56
56
|
summary: 'Helps Text Formatter: AI-powered text formatting for Helps Ministries.'
|
|
57
57
|
test_files: []
|