diff --git a/CHANGELOG b/CHANGELOG
index e698edb7..39ad654f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+*0.4.0* (Aug 13th, 2011)
+
+* Code optimization: 30% speedup [https://github.com/gioele]
+* refactor gem layout
+
*0.3.4* (May 23rd, 2011)
* add the more Rubyish QRCode#dark? alias for #is_dark [https://github.com/dasch]
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 00000000..817f62a8
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,2 @@
+source 'http://rubygems.org'
+gemspec
diff --git a/COPYING b/LICENSE
similarity index 100%
rename from COPYING
rename to LICENSE
diff --git a/README b/README
deleted file mode 100644
index 1cd54aea..00000000
--- a/README
+++ /dev/null
@@ -1,96 +0,0 @@
-== rQRCode, Encode QRCodes
-
-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.
-
-== An Overview
-
-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 Rubyforge.
-
- $ gem install rqrcode
-
-You can also get the source from http://github.com/whomwah/rqrcode/tree/master
-
- $ 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 view (RubyOnRails)
-
-Controller:
- @qr = RQRCode::QRCode.new( 'my string to generate', :size => 4, :level => :h )
-
-View: (minimal styling added)
-
-
-
- <% @qr.modules.each_index do |x| %>
-
- <% @qr.modules.each_index do |y| %>
- <% if @qr.dark?(x,y) %>
- |
- <% else %>
- |
- <% end %>
- <% end %>
-
- <% end %>
-
-
-== Contact
-
-Author:: Duncan Robertson
-Email:: duncan@whomwah.com
-Home Page:: http://whomwah.com
-License:: MIT Licence (http://www.opensource.org/licenses/mit-license.html)
diff --git a/README.org b/README.org
new file mode 100644
index 00000000..75a0b2d6
--- /dev/null
+++ b/README.org
@@ -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)
+:
+:
+:
+: <% @qr.modules.each_index do |x| %>
+:
+: <% @qr.modules.each_index do |y| %>
+: <% if @qr.dark?(x,y) %>
+: |
+: <% else %>
+: |
+: <% end %>
+: <% end %>
+:
+: <% end %>
+:
+
+** 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)
diff --git a/Rakefile b/Rakefile
index fbd92fa5..e9aa9204 100644
--- a/Rakefile
+++ b/Rakefile
@@ -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 = "duncan@whomwah.com"
- 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 = < [: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]
diff --git a/lib/rqrcode/version.rb b/lib/rqrcode/version.rb
new file mode 100644
index 00000000..b5f2949e
--- /dev/null
+++ b/lib/rqrcode/version.rb
@@ -0,0 +1,3 @@
+module RQRCode
+ VERSION = "0.4.0"
+end
diff --git a/test/test_data.rb b/test/data.rb
similarity index 100%
rename from test/test_data.rb
rename to test/data.rb
diff --git a/test/runtest.rb b/test/test_rqrcode.rb
similarity index 99%
rename from test/runtest.rb
rename to test/test_rqrcode.rb
index 2d40d117..1efea471 100644
--- a/test/runtest.rb
+++ b/test/test_rqrcode.rb
@@ -2,7 +2,7 @@
require "lib/rqrcode"
class QRCodeTest < Test::Unit::TestCase
- require "test/test_data"
+ require "test/data"
def test_no_data_given
assert_raise(RQRCode::QRCodeArgumentError) {