qrcode-generator 0.0.2 → 0.0.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 +4 -4
- data/bin/qrcode-generator +6 -0
- data/lib/qrcode-generator/runner.rb +7 -1
- data/lib/qrcode-generator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c058e6e6e4e91dbac9da3348044deacd38140804
|
4
|
+
data.tar.gz: 8f9dc5dc495c7d7fa12c261b77c9ff99e1ff87a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3decbb4836ba97765dff239a9e3f6d623bdb59c7879cc97586fc2573bb6b6b45a3a55897a95bad9b7fa52bf76aaa0c57e9340a339ad72e6719af950472a45c7d
|
7
|
+
data.tar.gz: b558996dd8096e921acb93a5969c6701e73d6e45ef261612616b45326c235b44e497f75c39944584cc94b6816f0a1c03e838d9b70c502d243e0e7c8346b08acd
|
data/bin/qrcode-generator
CHANGED
@@ -25,6 +25,7 @@ usage: qrcode-generator <command> [options]
|
|
25
25
|
options[:level] = :h
|
26
26
|
options[:logo] = true
|
27
27
|
options[:logo_denominator] = 3
|
28
|
+
options[:tag] = nil
|
28
29
|
|
29
30
|
opts.on("--width=400", "chnage qrcode image width") do |n|
|
30
31
|
width = n.to_i
|
@@ -54,6 +55,11 @@ usage: qrcode-generator <command> [options]
|
|
54
55
|
options[:logo_denominator] = logo_denominator if logo_denominator > 0
|
55
56
|
end
|
56
57
|
|
58
|
+
opts.on("--tag=someString", "if set 'someString', will add '(someString)' to the end of filename") do |n|
|
59
|
+
tag = n.to_s.strip
|
60
|
+
options[:tag] = tag if !tag.empty?
|
61
|
+
end
|
62
|
+
|
57
63
|
end.parse!
|
58
64
|
|
59
65
|
command = ARGV[0]
|
@@ -29,6 +29,8 @@ module QrcodeGenerator
|
|
29
29
|
|
30
30
|
FileUtils.mkdir(destSpace) if !File.directory?(destSpace)
|
31
31
|
|
32
|
+
filename_tag = parse_filename_tag
|
33
|
+
|
32
34
|
File.readlines(txtPath).each do |line|
|
33
35
|
line = line.strip.chomp
|
34
36
|
next if line.empty?
|
@@ -45,12 +47,16 @@ module QrcodeGenerator
|
|
45
47
|
title = link
|
46
48
|
end
|
47
49
|
|
48
|
-
filename = sanitize_filename(title) + ".png"
|
50
|
+
filename = sanitize_filename(title) + filename_tag + ".png"
|
49
51
|
|
50
52
|
to_qrcode_file(link, filename)
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
56
|
+
def parse_filename_tag
|
57
|
+
options[:tag] ? "(#{options[:tag]})" : ""
|
58
|
+
end
|
59
|
+
|
54
60
|
def sanitize_filename(basename)
|
55
61
|
|
56
62
|
basename.strip.gsub(/[\:\*\"\<\>\|]/, '').gsub(/[\\\/\.\?]/, '_')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qrcode-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rqrcode
|