activestorage-ocr 0.1.0 → 0.1.1
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/README.md +6 -6
- data/lib/activestorage/ocr/railtie.rb +11 -9
- data/lib/activestorage/ocr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c2944589a15452bdc9189df16529baf298e7db1d39898c6a127558dd8e55e58a
|
|
4
|
+
data.tar.gz: bc222d478d3c122f1bdba2e0f7a8b58893a9c0581ec86d06c2c8025410d36a20
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6569b0027e7976cb5afa6cf45294eb1680e7f6f769be27db98794f64cf5079f6254587f56b70adcb72a033b566bb6836879b7563fab18470b15ec7434b215b5
|
|
7
|
+
data.tar.gz: 45839fed9f4f618c50246c89f7acc3345a3c57d52a07c348fed17420bbb465ecf883f6d1b711f1b33ea57a35975995cdbe8ab26c1486ade6267778a34db8cf59
|
data/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Then install the OCR server binary:
|
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
44
|
bundle install
|
|
45
|
-
|
|
45
|
+
bin/rails activestorage_ocr:install
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
## Quick Start
|
|
@@ -50,7 +50,7 @@ bundle exec rake activestorage_ocr:install
|
|
|
50
50
|
1. **Start the OCR server:**
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
|
|
53
|
+
bin/rails activestorage_ocr:start
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
2. **Use the client in your Rails app:**
|
|
@@ -93,16 +93,16 @@ end
|
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
95
|
# Install the OCR server binary for your platform
|
|
96
|
-
|
|
96
|
+
bin/rails activestorage_ocr:install
|
|
97
97
|
|
|
98
98
|
# Start the OCR server
|
|
99
|
-
|
|
99
|
+
bin/rails activestorage_ocr:start
|
|
100
100
|
|
|
101
101
|
# Check server health
|
|
102
|
-
|
|
102
|
+
bin/rails activestorage_ocr:health
|
|
103
103
|
|
|
104
104
|
# Show binary info (platform, path, version)
|
|
105
|
-
|
|
105
|
+
bin/rails activestorage_ocr:info
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
## API Endpoints
|
|
@@ -16,13 +16,14 @@ module ActiveStorage
|
|
|
16
16
|
#
|
|
17
17
|
class Railtie < Rails::Railtie
|
|
18
18
|
# Registers the OCR analyzer with Active Storage.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
#
|
|
20
|
+
# We use an initializer that runs after Active Storage's engine is loaded
|
|
21
|
+
# to prepend our analyzer to the configuration's analyzers list.
|
|
22
|
+
# This ensures our analyzer runs before the default image analyzers.
|
|
23
|
+
initializer "activestorage-ocr.add_analyzer", after: "active_storage.configs" do |app|
|
|
24
|
+
# Prepend to the config's analyzers list, which ActiveStorage::Engine
|
|
25
|
+
# later copies to ActiveStorage.analyzers in its after_initialize
|
|
26
|
+
app.config.active_storage.analyzers.prepend(ActiveStorage::Ocr::Analyzer)
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
# Defines rake tasks for server management.
|
|
@@ -56,8 +57,9 @@ module ActiveStorage
|
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
config = ActiveStorage::Ocr.configuration
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
uri = URI.parse(config.server_url)
|
|
61
|
+
host = uri.host || "127.0.0.1"
|
|
62
|
+
port = uri.port || 9292
|
|
61
63
|
|
|
62
64
|
puts "Starting OCR server on #{host}:#{port}..."
|
|
63
65
|
exec(binary, "--host", host, "--port", port.to_s)
|