rqrcode 2.1.0 → 2.2.0
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/.github/workflows/ruby.yml +2 -2
- data/CHANGELOG.md +31 -1
- data/Gemfile.lock +36 -32
- data/README.md +9 -9
- data/lib/rqrcode/export/png.rb +4 -5
- data/lib/rqrcode/export/svg.rb +11 -3
- data/lib/rqrcode/qrcode/qrcode.rb +1 -1
- data/lib/rqrcode/version.rb +1 -1
- data/rqrcode.gemspec +1 -1
- metadata +7 -8
- data/bin/setup +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46c752f56b2f26a71997009f105896a93874304e47b5453f6d399790ec5d67ee
|
|
4
|
+
data.tar.gz: 3a32e1b77c24d1118510084ad0b0f700ff54c8605c5e5cf77aca2c5efc782438
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28ae604413d674f2c8fe6aac337aab7253874357d6d0e4e656c7e3cf743c8a65d102a5eeb8790601678d4c65172bbdd882cf1a51766d23df99b4253f0801a11d
|
|
7
|
+
data.tar.gz: 34fbe27e846970fe5b8571c446d6bee7327d46c3b645aaf07b141cf96d98c7beb918f6cc929408fd612940d260a0258c5656937f7283acbcf6cab0d00e09c082
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -14,10 +14,10 @@ jobs:
|
|
|
14
14
|
fail-fast: false
|
|
15
15
|
matrix:
|
|
16
16
|
os: [ubuntu-latest, macos-latest]
|
|
17
|
-
ruby: [2.
|
|
17
|
+
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2']
|
|
18
18
|
runs-on: ${{ matrix.os }}
|
|
19
19
|
steps:
|
|
20
|
-
- uses: actions/checkout@
|
|
20
|
+
- uses: actions/checkout@v3
|
|
21
21
|
- uses: ruby/setup-ruby@v1
|
|
22
22
|
with:
|
|
23
23
|
ruby-version: ${{ matrix.ruby }}
|
data/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.2.0] - 2023-06-17
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
* Allow all ChunkyPNG::Color options to be passed into `fill` and `color` on `as_png` [#135]
|
|
15
|
+
* Add 3.2 to CI [@petergoldstein](https://github.com/petergoldstein) [#133]
|
|
16
|
+
* Development dependency upgrades. Minimum Ruby change [#130]
|
|
17
|
+
* README updates
|
|
18
|
+
|
|
19
|
+
## [2.1.2] - 2022-07-26
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
* Remove setup script as it just calls bundle install [#128]
|
|
24
|
+
* Change inline styles to the fill property to allow for strict CSP style-src directive [#127]
|
|
25
|
+
|
|
26
|
+
## [2.1.1] - 2022-02-11
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Added in a handler for when color arguments are passed in as symbols e.g `color: :yellow`. This also allows for the use of the `:currentColor` keyword. [#122]
|
|
31
|
+
|
|
10
32
|
## [2.1.0] - 2021-08-26
|
|
11
33
|
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
12
36
|
- Sync Gemfile.lock with `rqrcode_core.1.2.0` [Adds Multimode Support](https://github.com/whomwah/rqrcode_core#multiple-encoding-support)
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
13
40
|
- Add badge for Standard linting
|
|
14
41
|
|
|
15
42
|
### Changed
|
|
@@ -43,7 +70,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
43
70
|
- bump dependencies
|
|
44
71
|
- fix `required_ruby_version` for Ruby 3 support
|
|
45
72
|
|
|
46
|
-
[unreleased]: https://github.com/whomwah/rqrcode/compare/v2.
|
|
73
|
+
[unreleased]: https://github.com/whomwah/rqrcode/compare/v2.2.0...HEAD
|
|
74
|
+
[2.2.0]: https://github.com/whomwah/rqrcode/compare/v2.1.2...v2.2.0
|
|
75
|
+
[2.1.2]: https://github.com/whomwah/rqrcode/compare/v2.1.1...v2.1.2
|
|
76
|
+
[2.1.1]: https://github.com/whomwah/rqrcode/compare/v2.1.0...v2.1.1
|
|
47
77
|
[2.1.0]: https://github.com/whomwah/rqrcode/compare/v2.0.0...v2.1.0
|
|
48
78
|
[2.0.0]: https://github.com/whomwah/rqrcode/compare/v1.2.0...v2.0.0
|
|
49
79
|
[1.2.0]: https://github.com/whomwah/rqrcode/compare/v1.1.1...v1.2.0
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rqrcode (2.
|
|
4
|
+
rqrcode (2.2.0)
|
|
5
5
|
chunky_png (~> 1.0)
|
|
6
6
|
rqrcode_core (~> 1.0)
|
|
7
7
|
|
|
@@ -10,49 +10,53 @@ GEM
|
|
|
10
10
|
specs:
|
|
11
11
|
ast (2.4.2)
|
|
12
12
|
chunky_png (1.4.0)
|
|
13
|
-
diff-lcs (1.
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
diff-lcs (1.5.0)
|
|
14
|
+
json (2.6.3)
|
|
15
|
+
language_server-protocol (3.17.0.2)
|
|
16
|
+
parallel (1.22.1)
|
|
17
|
+
parser (3.1.3.0)
|
|
16
18
|
ast (~> 2.4.1)
|
|
17
|
-
rainbow (3.
|
|
18
|
-
rake (13.0.
|
|
19
|
-
regexp_parser (2.
|
|
19
|
+
rainbow (3.1.1)
|
|
20
|
+
rake (13.0.6)
|
|
21
|
+
regexp_parser (2.6.1)
|
|
20
22
|
rexml (3.2.5)
|
|
21
23
|
rqrcode_core (1.2.0)
|
|
22
|
-
rspec (3.
|
|
23
|
-
rspec-core (~> 3.
|
|
24
|
-
rspec-expectations (~> 3.
|
|
25
|
-
rspec-mocks (~> 3.
|
|
26
|
-
rspec-core (3.
|
|
27
|
-
rspec-support (~> 3.
|
|
28
|
-
rspec-expectations (3.
|
|
24
|
+
rspec (3.12.0)
|
|
25
|
+
rspec-core (~> 3.12.0)
|
|
26
|
+
rspec-expectations (~> 3.12.0)
|
|
27
|
+
rspec-mocks (~> 3.12.0)
|
|
28
|
+
rspec-core (3.12.0)
|
|
29
|
+
rspec-support (~> 3.12.0)
|
|
30
|
+
rspec-expectations (3.12.1)
|
|
29
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
30
|
-
rspec-support (~> 3.
|
|
31
|
-
rspec-mocks (3.
|
|
32
|
+
rspec-support (~> 3.12.0)
|
|
33
|
+
rspec-mocks (3.12.1)
|
|
32
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
33
|
-
rspec-support (~> 3.
|
|
34
|
-
rspec-support (3.
|
|
35
|
-
rubocop (1.
|
|
35
|
+
rspec-support (~> 3.12.0)
|
|
36
|
+
rspec-support (3.12.0)
|
|
37
|
+
rubocop (1.40.0)
|
|
38
|
+
json (~> 2.3)
|
|
36
39
|
parallel (~> 1.10)
|
|
37
|
-
parser (>= 3.
|
|
40
|
+
parser (>= 3.1.2.1)
|
|
38
41
|
rainbow (>= 2.2.2, < 4.0)
|
|
39
42
|
regexp_parser (>= 1.8, < 3.0)
|
|
40
|
-
rexml
|
|
41
|
-
rubocop-ast (>= 1.
|
|
43
|
+
rexml (>= 3.2.5, < 4.0)
|
|
44
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
|
42
45
|
ruby-progressbar (~> 1.7)
|
|
43
46
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
44
|
-
rubocop-ast (1.
|
|
45
|
-
parser (>=
|
|
46
|
-
rubocop-performance (1.
|
|
47
|
-
rubocop (>=
|
|
47
|
+
rubocop-ast (1.24.0)
|
|
48
|
+
parser (>= 3.1.1.0)
|
|
49
|
+
rubocop-performance (1.15.1)
|
|
50
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
48
51
|
rubocop-ast (>= 0.4.0)
|
|
49
52
|
ruby-progressbar (1.11.0)
|
|
50
|
-
standard (1.0
|
|
51
|
-
|
|
52
|
-
rubocop
|
|
53
|
-
|
|
53
|
+
standard (1.20.0)
|
|
54
|
+
language_server-protocol (~> 3.17.0.2)
|
|
55
|
+
rubocop (= 1.40.0)
|
|
56
|
+
rubocop-performance (= 1.15.1)
|
|
57
|
+
standardrb (1.0.1)
|
|
54
58
|
standard
|
|
55
|
-
unicode-display_width (2.
|
|
59
|
+
unicode-display_width (2.3.0)
|
|
56
60
|
|
|
57
61
|
PLATFORMS
|
|
58
62
|
ruby
|
|
@@ -65,4 +69,4 @@ DEPENDENCIES
|
|
|
65
69
|
standardrb (~> 1.0)
|
|
66
70
|
|
|
67
71
|
BUNDLED WITH
|
|
68
|
-
2.
|
|
72
|
+
2.3.26
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[RQRCode](https://github.com/whomwah/rqrcode) is a library for creating and rendering QR codes into various formats. It has a simple interface with all the standard QR code options. It was adapted from the Javascript library by Kazuhiko Arase.
|
|
8
8
|
|
|
9
9
|
* QR code is trademarked by Denso Wave inc
|
|
10
|
-
* Minimum Ruby version is `>= 2.
|
|
10
|
+
* Minimum Ruby version is `>= 2.6`
|
|
11
11
|
* For `rqrcode` releases `< 2.0.0` please use [this README](https://github.com/whomwah/rqrcode/blob/v1.2.0/README.md)
|
|
12
12
|
* For `rqrcode` releases `< 1.0.0` please use [this README](https://github.com/whomwah/rqrcode/blob/v0.9.0/README.md)
|
|
13
13
|
|
|
@@ -99,9 +99,9 @@ Options:
|
|
|
99
99
|
|
|
100
100
|
offset - Padding around the QR Code in pixels
|
|
101
101
|
(default 0)
|
|
102
|
-
fill - Background color e.g "ffffff" or :white
|
|
102
|
+
fill - Background color e.g "ffffff" or :white or :currentColor
|
|
103
103
|
(default none)
|
|
104
|
-
color - Foreground color e.g "000" or :black
|
|
104
|
+
color - Foreground color e.g "000" or :black or :currentColor
|
|
105
105
|
(default "000")
|
|
106
106
|
module_size - The Pixel size of each module
|
|
107
107
|
(defaults 11)
|
|
@@ -109,8 +109,8 @@ shape_rendering - SVG Attribute: auto | optimizeSpeed | crispEdges | geometricPr
|
|
|
109
109
|
(defaults crispEdges)
|
|
110
110
|
standalone - Whether to make this a full SVG file, or only an svg to embed in other svg
|
|
111
111
|
(default true)
|
|
112
|
-
use_path - Use <path> to render SVG rather than <rect> to significantly reduce size
|
|
113
|
-
|
|
112
|
+
use_path - Use <path> to render SVG rather than <rect> to significantly reduce size.
|
|
113
|
+
This will become the default in future versions.
|
|
114
114
|
(default false)
|
|
115
115
|
viewbox - Replace the `svg.width` and `svg.height` attribute with `svg.viewBox` to
|
|
116
116
|
allow CSS scaling
|
|
@@ -143,8 +143,8 @@ The will produce a PNG using the [ChunkyPNG gem](https://github.com/wvanbergen/c
|
|
|
143
143
|
```
|
|
144
144
|
Options:
|
|
145
145
|
|
|
146
|
-
fill - Background ChunkyPNG::Color
|
|
147
|
-
color - Foreground ChunkyPNG::Color
|
|
146
|
+
fill - Background <ChunkyPNG::Color>, defaults to 'white'. Use [] for multi args
|
|
147
|
+
color - Foreground <ChunkyPNG::Color>, defaults to 'black'. Use [] for multi args
|
|
148
148
|
|
|
149
149
|
When option :file is supplied you can use the following ChunkyPNG constraints:
|
|
150
150
|
|
|
@@ -251,7 +251,7 @@ svg = qrcode.as_ansi(
|
|
|
251
251
|
You can run the test suite using:
|
|
252
252
|
|
|
253
253
|
```
|
|
254
|
-
$
|
|
254
|
+
$ bundle install
|
|
255
255
|
$ rake # runs specs and standard:fix
|
|
256
256
|
$ rake spec # just runs the specs
|
|
257
257
|
```
|
|
@@ -267,7 +267,7 @@ $ ./bin/console
|
|
|
267
267
|
The project uses [standardrb](https://github.com/testdouble/standard) and can be used with:
|
|
268
268
|
|
|
269
269
|
```
|
|
270
|
-
$
|
|
270
|
+
$ bundle install
|
|
271
271
|
$ rake standard # checks
|
|
272
272
|
$ rake standard:fix # fixes
|
|
273
273
|
```
|
data/lib/rqrcode/export/png.rb
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
require "chunky_png"
|
|
4
4
|
|
|
5
5
|
# This class creates PNG files.
|
|
6
|
-
# Code from: https://github.com/DCarper/rqrcode
|
|
7
6
|
module RQRCode
|
|
8
7
|
module Export
|
|
9
8
|
module PNG
|
|
10
9
|
# Render the PNG from the QR Code.
|
|
11
10
|
#
|
|
12
11
|
# Options:
|
|
13
|
-
# fill - Background ChunkyPNG::Color, defaults to 'white'
|
|
14
|
-
# color - Foreground ChunkyPNG::Color, defaults to 'black'
|
|
12
|
+
# fill - Background ChunkyPNG::Color, defaults to 'white'.
|
|
13
|
+
# color - Foreground ChunkyPNG::Color, defaults to 'black'.
|
|
15
14
|
#
|
|
16
15
|
# When option :file is supplied you can use the following ChunkyPNG constraints
|
|
17
16
|
# color_mode - The color mode to use. Use one of the ChunkyPNG::COLOR_* constants.
|
|
@@ -62,8 +61,8 @@ module RQRCode
|
|
|
62
61
|
|
|
63
62
|
googleis = options.length == 0 || !options[:size].nil?
|
|
64
63
|
options = default_img_options.merge(options) # reverse_merge
|
|
65
|
-
fill = ChunkyPNG::Color(options[:fill])
|
|
66
|
-
color = ChunkyPNG::Color(options[:color])
|
|
64
|
+
fill = ChunkyPNG::Color(*(options[:fill].is_a?(Array) ? options[:fill] : [options[:fill]]))
|
|
65
|
+
color = ChunkyPNG::Color(*(options[:color].is_a?(Array) ? options[:color] : [options[:color]]))
|
|
67
66
|
output_file = options[:file]
|
|
68
67
|
module_px_size = nil
|
|
69
68
|
border_px = nil
|
data/lib/rqrcode/export/svg.rb
CHANGED
|
@@ -76,12 +76,18 @@ module RQRCode
|
|
|
76
76
|
path << edge_loop_string
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
# Prefix hexadecimal colors unless using a named color (symbol)
|
|
80
|
+
color = "##{color}" unless color.is_a?(Symbol)
|
|
81
|
+
|
|
82
|
+
@result << %{<path d="#{path.join}" fill="#{color}" transform="translate(#{offset},#{offset}) scale(#{module_size})"/>}
|
|
80
83
|
end
|
|
81
84
|
end
|
|
82
85
|
|
|
83
86
|
class Rect < BaseOutputSVG
|
|
84
87
|
def build(module_size, offset, color)
|
|
88
|
+
# Prefix hexadecimal colors unless using a named color (symbol)
|
|
89
|
+
color = "##{color}" unless color.is_a?(Symbol)
|
|
90
|
+
|
|
85
91
|
@qrcode.modules.each_index do |c|
|
|
86
92
|
tmp = []
|
|
87
93
|
@qrcode.modules.each_index do |r|
|
|
@@ -89,7 +95,7 @@ module RQRCode
|
|
|
89
95
|
x = r * module_size + offset
|
|
90
96
|
|
|
91
97
|
next unless @qrcode.checked?(c, r)
|
|
92
|
-
tmp << %(<rect width="#{module_size}" height="#{module_size}" x="#{x}" y="#{y}"
|
|
98
|
+
tmp << %(<rect width="#{module_size}" height="#{module_size}" x="#{x}" y="#{y}" fill="#{color}"/>)
|
|
93
99
|
end
|
|
94
100
|
|
|
95
101
|
@result << tmp.join
|
|
@@ -184,7 +190,9 @@ module RQRCode
|
|
|
184
190
|
output_tag.build(module_size, offset, color)
|
|
185
191
|
|
|
186
192
|
if fill
|
|
187
|
-
|
|
193
|
+
# Prefix hexadecimal colors unless using a named color (symbol)
|
|
194
|
+
fill = "##{fill}" unless fill.is_a?(Symbol)
|
|
195
|
+
output_tag.result.unshift %(<rect width="#{dimension}" height="#{dimension}" x="0" y="0" fill="#{fill}"/>)
|
|
188
196
|
end
|
|
189
197
|
|
|
190
198
|
if standalone
|
data/lib/rqrcode/version.rb
CHANGED
data/rqrcode.gemspec
CHANGED
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
30
30
|
spec.require_paths = ["lib"]
|
|
31
31
|
|
|
32
|
-
spec.required_ruby_version = ">= 2.
|
|
32
|
+
spec.required_ruby_version = ">= 2.6"
|
|
33
33
|
spec.add_dependency "rqrcode_core", "~> 1.0"
|
|
34
34
|
spec.add_dependency "chunky_png", "~> 1.0"
|
|
35
35
|
spec.add_development_dependency "bundler", "~> 2.0"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rqrcode
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Duncan Robertson
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-05-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rqrcode_core
|
|
@@ -115,7 +115,6 @@ files:
|
|
|
115
115
|
- Rakefile
|
|
116
116
|
- _config.yml
|
|
117
117
|
- bin/console
|
|
118
|
-
- bin/setup
|
|
119
118
|
- images/ansi-screen-shot.png
|
|
120
119
|
- images/github-qrcode.png
|
|
121
120
|
- images/github-qrcode.svg
|
|
@@ -135,7 +134,7 @@ licenses:
|
|
|
135
134
|
metadata:
|
|
136
135
|
bug_tracker_uri: https://github.com/whomwah/rqrcode/issues
|
|
137
136
|
changelog_uri: https://github.com/whomwah/rqrcode/blob/master/CHANGELOG.md
|
|
138
|
-
post_install_message:
|
|
137
|
+
post_install_message:
|
|
139
138
|
rdoc_options: []
|
|
140
139
|
require_paths:
|
|
141
140
|
- lib
|
|
@@ -143,15 +142,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
143
142
|
requirements:
|
|
144
143
|
- - ">="
|
|
145
144
|
- !ruby/object:Gem::Version
|
|
146
|
-
version: '2.
|
|
145
|
+
version: '2.6'
|
|
147
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
147
|
requirements:
|
|
149
148
|
- - ">="
|
|
150
149
|
- !ruby/object:Gem::Version
|
|
151
150
|
version: '0'
|
|
152
151
|
requirements: []
|
|
153
|
-
rubygems_version: 3.
|
|
154
|
-
signing_key:
|
|
152
|
+
rubygems_version: 3.4.6
|
|
153
|
+
signing_key:
|
|
155
154
|
specification_version: 4
|
|
156
155
|
summary: A library to encode QR Codes
|
|
157
156
|
test_files: []
|