forked from whomwah/rqrcode
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update gem layout to include gemspec etc
- Loading branch information
Showing
9 changed files
with
121 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source 'http://rubygems.org' | ||
gemspec |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
* rQRCode, Encode QRCodes | ||
|
||
** Overview | ||
|
||
rQRCode is a library for encoding QR Codes in Ruby. It has a simple interface with all the standard qrcode options. It was adapted from the Javascript library by Kazuhiko Arase. | ||
|
||
Let's clear up some rQRCode stuff. | ||
|
||
# rQRCode is a *standalone library*. It requires no other libraries. Just Ruby! | ||
# It is an encoding library. You can't decode QR codes with it. | ||
# The interface is simple and assumes you just want to encode a string into a QR code | ||
# QR code is trademarked by Denso Wave inc | ||
|
||
** Resources | ||
|
||
- wikipedia:: http://en.wikipedia.org/wiki/QR_Code | ||
- Denso-Wave website:: http://www.denso-wave.com/qrcode/index-e.html | ||
- kaywa:: http://qrcode.kaywa.com | ||
|
||
** Installing | ||
|
||
You may get the latest stable version from Rubygems. | ||
|
||
: $ gem install rqrcode | ||
|
||
You can also get the source from http://github.com/whomwah/rqrcode | ||
|
||
: $ git clone git://github.com/whomwah/rqrcode.git | ||
|
||
** Loading rQRCode Itself | ||
|
||
You have installed the gem already, yeah? | ||
|
||
: require 'rubygems' | ||
: require 'rqrcode' | ||
|
||
** Simple QRCode generation to screen | ||
|
||
: qr = RQRCode::QRCode.new( 'my string to generate', :size => 4, :level => :h ) | ||
: puts qr.to_s | ||
: # | ||
: # Prints: | ||
: # xxxxxxx x x x x x xx xxxxxxx | ||
: # x x xxx xxxxxx xxx x x | ||
: # x xxx x xxxxx x xx x xxx x | ||
: # ... etc | ||
|
||
** Simple QRCode generation to template (RubyOnRails) | ||
|
||
: # Controller | ||
: @qr = RQRCode::QRCode.new( 'my string to generate', :size => 4, :level => :h ) | ||
: | ||
: # View: (minimal styling added) | ||
: <style type="text/css"> | ||
: table { | ||
: border-width: 0; | ||
: border-style: none; | ||
: border-color: #0000ff; | ||
: border-collapse: collapse; | ||
: } | ||
: td { | ||
: border-width: 0; | ||
: border-style: none; | ||
: border-color: #0000ff; | ||
: border-collapse: collapse; | ||
: padding: 0; | ||
: margin: 0; | ||
: width: 10px; | ||
: height: 10px; | ||
: } | ||
: td.black { background-color: #000; } | ||
: td.white { background-color: #fff; } | ||
: </style> | ||
: | ||
: <table> | ||
: <% @qr.modules.each_index do |x| %> | ||
: <tr> | ||
: <% @qr.modules.each_index do |y| %> | ||
: <% if @qr.dark?(x,y) %> | ||
: <td class="black"/> | ||
: <% else %> | ||
: <td class="white"/> | ||
: <% end %> | ||
: <% end %> | ||
: </tr> | ||
: <% end %> | ||
: </table> | ||
|
||
** Authors | ||
|
||
Original author: Duncan Robertson | ||
|
||
Special thanks to the following people for submitting patches: | ||
|
||
- Gioele Barabucci | ||
- Rob la Lau | ||
- Chris Mowforth | ||
- Tore Darell | ||
- Vladislav Gorodetskiy | ||
|
||
** Copyright | ||
|
||
MIT Licence (http://www.opensource.org/licenses/mit-license.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,14 @@ | ||
require 'rubygems' | ||
require 'rake' | ||
require 'rake/clean' | ||
require 'rake/gempackagetask' | ||
require 'rake/rdoctask' | ||
require 'rake/testtask' | ||
require 'bundler' | ||
|
||
NAME = "rqrcode" | ||
VERS = "0.3.4" | ||
CLEAN.include ['pkg', 'rdoc'] | ||
Bundler::GemHelper.install_tasks | ||
|
||
spec = Gem::Specification.new do |s| | ||
s.name = NAME | ||
s.version = VERS | ||
s.author = "Duncan Robertson" | ||
s.email = "[email protected]" | ||
s.homepage = "http://whomwah.github.com/rqrcode/" | ||
s.platform = Gem::Platform::RUBY | ||
s.summary = "A library to encode QR Codes" | ||
s.rubyforge_project = NAME | ||
s.description = <<EOF | ||
rQRCode is a library for encoding QR Codes. The simple | ||
interface allows you to create QR Code data structures | ||
ready to be displayed in the way you choose. | ||
EOF | ||
s.files = FileList["lib/**/*", "test/*"].exclude("rdoc").to_a | ||
s.require_path = "lib" | ||
s.has_rdoc = true | ||
s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"] | ||
s.test_file = "test/runtest.rb" | ||
end | ||
|
||
task :build_package => [:repackage] | ||
Rake::GemPackageTask.new(spec) do |pkg| | ||
#pkg.need_zip = true | ||
#pkg.need_tar = true | ||
pkg.gem_spec = spec | ||
end | ||
|
||
desc "Default: run unit tests." | ||
task :default => :test | ||
|
||
desc "Run all the tests" | ||
Rake::TestTask.new(:test) do |t| | ||
desc "Run tests" | ||
Rake::TestTask.new do |t| | ||
t.libs << "lib" | ||
t.pattern = "test/runtest.rb" | ||
t.libs << "test" | ||
t.test_files = FileList['test/test_*.rb'] | ||
t.verbose = true | ||
end | ||
|
||
desc "Generate documentation for the library" | ||
Rake::RDocTask.new("rdoc") { |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = "rQRCode Documentation" | ||
rdoc.template = "~/bin/jamis.rb" | ||
rdoc.options << '--line-numbers' << '--inline-source' | ||
rdoc.main = "README" | ||
rdoc.rdoc_files.include("README", "CHANGELOG", "COPYING", 'lib/**/*.rb') | ||
} | ||
|
||
desc "rdoc to rubyforge" | ||
task :rubyforge => [:rdoc] do | ||
sh %{/usr/bin/scp -r -p rdoc/* rubyforge:/var/www/gforge-projects/rqrcode} | ||
end | ||
task :default => [:test] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module RQRCode | ||
VERSION = "0.4.0" | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters