html_to 1.1.1 → 1.1.3

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: cc490495133d2799e907b246a839a9645e81d0097a10006a851cbb8af8343a61
4
- data.tar.gz: 46f2beb5850fe8975354763abdce67ea53b0f06bc65a6ed19d9c179cb329f547
3
+ metadata.gz: 4ceac4dec6528406e6321819377493c1b18f9cebbadd3455fd307b4babfe3e2f
4
+ data.tar.gz: 97890c3c9aaceb21cb39a8cdedf111a67e9302cff993583335e7ade6ae373081
5
5
  SHA512:
6
- metadata.gz: daeaa75cc74b90d4ff4883c5475559d7b886fb81dcbdea084ae96d1b5fd159e962e1dcf442ad95dabdc3d0298f4f82b2f2bc2d2ac8e10bb70094f2cd0f40abbc
7
- data.tar.gz: 9ab97a704bcc78d2274948916e8b382e7cb97a64775a37747ce7abe866564b5126e06cd09f1e56db53c9996c471ddfb1d1b82fead1a8ecf8d3583596b01fe3ba
6
+ metadata.gz: a63d7c78827ff4e2d9de2fb3aca915e9af25789e682986ccbebfa71f4918443cdf7b76af881a39fb802ccf3cb1c30e70ab0451fdf5cd1fd0f047ae4168571060
7
+ data.tar.gz: 1458eb7e8ca497b7c7ac9317de7149d4fd80d8b736be49c211b58eb4caf29b6cec2f5289b1dae185b9a86b0ac3121914dab54e847e9b5261b62b9e1ed1c99520
data/README.md CHANGED
@@ -15,7 +15,7 @@ HtmlTo is a gem for Rails that allows you to generate images from an HTML file.
15
15
 
16
16
  ## Installation
17
17
 
18
- You need to have Chrome or Chromium installed 🛠️
18
+ You need to have Chrome or Chromium installed 🛠️ And active-storage is required
19
19
 
20
20
 
21
21
  Ubuntu:
@@ -44,6 +44,8 @@ HtmlTo::Configuration.config do |config|
44
44
  end
45
45
  ```
46
46
 
47
+ to optimize attached images add `gem 'image_processing'`
48
+
47
49
  ## Basic usage
48
50
  Add to your model 📖
49
51
 
@@ -9,7 +9,7 @@ module HtmlTo
9
9
  end
10
10
 
11
11
  path = if /darwin/.match?(RbConfig::CONFIG['host_os'])
12
- "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
12
+ '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
13
13
  elsif /linux/.match?(RbConfig::CONFIG['host_os'])
14
14
  release = %x(lsb_release -i -s)
15
15
  %x(which chromium-browser)
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
  require_relative 'chromium'
3
3
  require 'erb'
4
-
4
+ require 'shellwords'
5
5
  class HtmlTo::ImageGenerate
6
6
  include HtmlTo::Chromium
7
7
  def call(record, serializer, options)
@@ -26,7 +26,7 @@ class HtmlTo::ImageGenerate
26
26
 
27
27
  def take_screenshot(width, height)
28
28
  cmd = <<~BASH.chomp
29
- #{HtmlTo::Chromium.execute_path} \
29
+ #{HtmlTo::Chromium.execute_path.shellescape} \
30
30
  --headless \
31
31
  --screenshot=#{screenshot_file_path} \
32
32
  --window-size=#{width},#{height} \
@@ -1,4 +1,4 @@
1
1
  module HtmlTo
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.3'.freeze
3
3
  public_constant :VERSION
4
4
  end
data/lib/html_to.rb CHANGED
@@ -104,7 +104,7 @@ module HtmlTo
104
104
  base.instance_eval do
105
105
  alias_method :create_meta_image!, :html_to_create_meta_image! unless method_defined? :create_meta_images!
106
106
  end
107
- base.after_commit :html_to_create_meta_image!, unless: :html_to_skip_meta_image_generate
107
+ base.after_save_commit :html_to_create_meta_image!, unless: :html_to_skip_meta_image_generate
108
108
  end
109
109
 
110
110
  def html_to_create_meta_image!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chekryzhov Viktor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-16 00:00:00.000000000 Z
11
+ date: 2023-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob