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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '06842e85669ce35ba5e03695a92bf5acaccf8519cbfa57d8f4803664757bcccd'
4
- data.tar.gz: d513b79b0691862d8f79df97a4fd3da02a61c56b5eacc027723a9a5515218efc
3
+ metadata.gz: c2944589a15452bdc9189df16529baf298e7db1d39898c6a127558dd8e55e58a
4
+ data.tar.gz: bc222d478d3c122f1bdba2e0f7a8b58893a9c0581ec86d06c2c8025410d36a20
5
5
  SHA512:
6
- metadata.gz: 7bfd336fccd12c9dfa437671c0e318fedc5ead6bae106ddd91a85d05e72dc2d1efabc00d098614fce7a3791a12a94db6668110f65a32ea7894cf15646f668d7e
7
- data.tar.gz: d32683900ac1e7136b5e8ef6b322acd75587dcd3c9a5aa62d08bddb5d45083137d42e19cdb02c6518c25f19cf9d704196c8dd86b0f8a2cbbd1fbd6f52c430bae
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
- bundle exec rake activestorage_ocr:install
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
- bundle exec rake activestorage_ocr:start
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
- bundle exec rake activestorage_ocr:install
96
+ bin/rails activestorage_ocr:install
97
97
 
98
98
  # Start the OCR server
99
- bundle exec rake activestorage_ocr:start
99
+ bin/rails activestorage_ocr:start
100
100
 
101
101
  # Check server health
102
- bundle exec rake activestorage_ocr:health
102
+ bin/rails activestorage_ocr:health
103
103
 
104
104
  # Show binary info (platform, path, version)
105
- bundle exec rake activestorage_ocr:info
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
- initializer "activestorage-ocr.add_analyzer" do
20
- config.after_initialize do
21
- # Prepend our analyzer so it runs before other analyzers
22
- if defined?(ActiveStorage) && ActiveStorage.respond_to?(:analyzers)
23
- ActiveStorage.analyzers.prepend(ActiveStorage::Ocr::Analyzer)
24
- end
25
- end
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
- host = config.server_host.gsub(%r{https?://}, "")
60
- port = config.server_port
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveStorage
4
4
  module Ocr
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage-ocr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Rispoli