go-zxing-qrcode 0.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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +6 -0
- data/go-zxing-qrcode.gemspec +22 -0
- data/go/bindings.go +32 -0
- data/lib/go-zxing-qrcode.rb +3 -0
- data/lib/go-zxing-qrcode/encoder/encoder.rb +15 -0
- data/lib/go-zxing-qrcode/encoder/libgoqrencoder_x86_64_darwin.so +0 -0
- data/lib/go-zxing-qrcode/encoder/libgoqrencoder_x86_64_linux.so +0 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dc8d4b9b625b1b26527b7e2fa25b38e451e319e6
|
4
|
+
data.tar.gz: 01a22280cbb50fc96510546b55a8248b30654bca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ceea2151bcf544fbe934e0522998829d8c4082ebe6af39f74df505a6aa8e71e3169ce15355a55bafdfc31e68560bde6cba49ef682e0f97c12d272dcb003ac712
|
7
|
+
data.tar.gz: ffdecb71db2148c927570f6d3f5bcb42d6dcf14f8d3b709bfb8160a2d75670d99ed5be7661e4f35df6614d58e43ce689d80ccf48528a60f1fad5599088a2d141
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 hSATAC
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Go::Zxing::Qrcode
|
2
|
+
|
3
|
+
Go QR Code encoder Ruby wrapper.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'go-zxing-qrcode'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install go-zxing-qrcode
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
// Parameters: value, filepath, eclevel(0~3), gridSize
|
23
|
+
GoZXingQrcode::Encoder.generateQRCodeImage("string to encode", "image.png", 3,5)
|
24
|
+
````
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
1. Fork it ( http://github.com/<my-github-username>/go-zxing-qrcode/fork )
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
32
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "go-zxing-qrcode"
|
7
|
+
spec.version = "0.1"
|
8
|
+
spec.authors = ["hSATAC"]
|
9
|
+
spec.email = ["hsatac@gmail.com"]
|
10
|
+
spec.summary = %q{Go ZXing QR Code Encoder Ruby wrapper.}
|
11
|
+
spec.description = %q{Go ZXing QR Code Encoder Ruby wrapper.}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
data/go/bindings.go
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"C"
|
5
|
+
"github.com/hSATAC/go-zxing-qrencoder/qrencode"
|
6
|
+
"image/png"
|
7
|
+
"os"
|
8
|
+
)
|
9
|
+
|
10
|
+
func main() {
|
11
|
+
|
12
|
+
}
|
13
|
+
|
14
|
+
//export generateQRCodeImage
|
15
|
+
func generateQRCodeImage(rawValue *C.char, rawPath *C.char, rawECLevel int, gridSize int) {
|
16
|
+
str := C.GoString(rawValue)
|
17
|
+
path := C.GoString(rawPath)
|
18
|
+
ecLevel := qrencode.ECLevel(rawECLevel)
|
19
|
+
//ecLevel := qrencode.ECLevelQ
|
20
|
+
//gridSize := 5
|
21
|
+
|
22
|
+
grid, err := qrencode.Encode(str, ecLevel)
|
23
|
+
if err != nil {
|
24
|
+
return
|
25
|
+
}
|
26
|
+
f, err := os.Create(path)
|
27
|
+
if err != nil {
|
28
|
+
return
|
29
|
+
}
|
30
|
+
defer f.Close()
|
31
|
+
png.Encode(f, grid.Image(gridSize))
|
32
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
require 'singleton'
|
3
|
+
|
4
|
+
module GoZXingQRCode
|
5
|
+
class Encoder
|
6
|
+
include Singleton
|
7
|
+
extend FFI::Library
|
8
|
+
if RUBY_PLATFORM =~ /linux/
|
9
|
+
ffi_lib File.expand_path("./libgoqrencoder_x86_64_linux.so", File.dirname(__FILE__))
|
10
|
+
elsif RUBY_PLATFORM =~ /darwin/
|
11
|
+
ffi_lib File.expand_path("./libgoqrencoder_x86_64_darwin.so", File.dirname(__FILE__))
|
12
|
+
end
|
13
|
+
attach_function :generateQRCodeImage, [:string, :string, :int, :int], :void
|
14
|
+
end
|
15
|
+
end
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: go-zxing-qrcode
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- hSATAC
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Go ZXing QR Code Encoder Ruby wrapper.
|
42
|
+
email:
|
43
|
+
- hsatac@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- go-zxing-qrcode.gemspec
|
54
|
+
- go/bindings.go
|
55
|
+
- lib/go-zxing-qrcode.rb
|
56
|
+
- lib/go-zxing-qrcode/encoder/encoder.rb
|
57
|
+
- lib/go-zxing-qrcode/encoder/libgoqrencoder_x86_64_darwin.so
|
58
|
+
- lib/go-zxing-qrcode/encoder/libgoqrencoder_x86_64_linux.so
|
59
|
+
homepage: ''
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Go ZXing QR Code Encoder Ruby wrapper.
|
83
|
+
test_files: []
|