Skip to content

Commit

Permalink
part II of the mass code .. some working code at last
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge/var/svn/rqrcode/trunk@5 70f6ffcc-3070-48c7-8e95-2772f12856e8
  • Loading branch information
whomwah committed Feb 21, 2008
1 parent a40ea24 commit eed42fd
Show file tree
Hide file tree
Showing 12 changed files with 986 additions and 912 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*0.1.0* (Feb 21st, 2008)

* Initial Import [DR]
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
to be added .. I promise
46 changes: 46 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/testtask'

NAME = "rqrcode"
VERS = "0.1.0"
CLEAN.include ['pkg']

Gem::manage_gems

spec = Gem::Specification.new do |s|
s.name = NAME
s.version = VERS
s.author = "Duncan Robertson"
s.email = "duncan@whomwah.com"
s.homepage = "http://whomwah.com"
s.platform = Gem::Platform::RUBY
s.summary = "A lib to generation QRCodes"
s.description = s.summary
s.files = FileList["{test,lib}/**/*"].exclude("rdoc").to_a
s.require_path = "lib"
s.autorequire = "rqrcode"
s.test_files = Dir.glob('test/*_test.rb')
s.extra_rdoc_files = ["README","CHANGELOG"]
s.add_dependency("rake")
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|
t.libs << "lib"
t.pattern = "test/**/*_test.rb"
t.verbose = true
end
2 changes: 2 additions & 0 deletions lib/rqrcode.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require "rqrcode/core_ext"
require "rqrcode/qrcode"
5 changes: 5 additions & 0 deletions lib/rqrcode/core_ext.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].sort.each do |path|
filename = File.basename(path)
require "rqrcode/core_ext/#{filename}"
end

5 changes: 5 additions & 0 deletions lib/rqrcode/core_ext/hash.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rqrcode/core_ext/hash/behavior'

class Hash
include CoreExtensions::Hash::Behavior
end
12 changes: 12 additions & 0 deletions lib/rqrcode/core_ext/hash/behavior.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module CoreExtensions
module Hash
module Behavior
def stringify_keys
inject({}) do |options, (key, value)|
options[key.to_s] = value
options
end
end
end
end
end
5 changes: 5 additions & 0 deletions lib/rqrcode/core_ext/integer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rqrcode/core_ext/integer/bitwise'

class Integer
include CoreExtensions::Integer::Bitwise
end
11 changes: 11 additions & 0 deletions lib/rqrcode/core_ext/integer/bitwise.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module CoreExtensions
module Integer
module Bitwise
def rszf(count)
# zero fill right shift
(self >> count) & ((2 ** ((self.size * 8) - count))-1)
end
end
end
end

Loading

0 comments on commit eed42fd

Please sign in to comment.