Skip to content

Commit

Permalink
go ahead and release it(?)
Browse files Browse the repository at this point in the history
  • Loading branch information
smparkes committed May 10, 2011
1 parent 6caec32 commit 76dd4ae
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -4,4 +4,4 @@
/lib/zxing/zxing.bundle
/lib/zxing/objc/zxing.bundle
/pkg
/bin/Zxd.app
/Gemfile.lock
16 changes: 16 additions & 0 deletions Gemfile
@@ -0,0 +1,16 @@
# -*- ruby -*-

java = RUBY_PLATFORM =~ /java/
macruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "macruby"

source :rubygems

if !java && !macruby
gem 'ffi'
end

if !java
gem 'rmagick'
end

gemspec
41 changes: 32 additions & 9 deletions README.rdoc
@@ -1,3 +1,18 @@
= THIS IS A REAL WORK IN PROGRESS

I use this stuff on a regular basis to test zxing but I haven't had
time to cleanup all the gem stuff in order to install it as a gem,
particularly with all the various VM stuff and dynamic linking. For
example, it currently uses scons to build the C++
directory. Translating that to ruby so as not not to require python
would be nice but seems tricky, at least for me.

If you have the time to contribute improvements in any of these (or
other areas), they're welcome.

I tried to make the interface compatible with the ecin's zxing gem but
I'm not sure how complete that is right now. I don't use it, so ...

= ZXing.rb

* http://github.com/smparkes/zxing.rb
Expand All @@ -9,7 +24,10 @@ ZXing.rb is a Ruby interface to the ZXing barcode library.
== FEATURES:

* Supports ZXing Java under jruby
* Supports ZXing C++ under ruby 1.8 (and maybe 1.9?)
* Supports ZXing C++ under ruby 1.8 and 1.9

I've played with MacRuby but it was a while ago and I don't think I
ever integrated that support with this (proto)gem.

== SUPPORT:

Expand All @@ -35,6 +53,9 @@ readers, luminance sources, binarizers, so you can mix and match your
own applications much as you would with a native Java or C++ app. See
+zxd+ and +test/vendor.rb+ for examples.

There is a proto-encoder (zxe) but I don't think it's hooked up. I
thought it was at some point, but ...

=== Using the ZXing module

require 'zxing'
Expand Down Expand Up @@ -84,30 +105,32 @@ own applications much as you would with a native Java or C++ app. See

== REQUIREMENTS:

* Ruby 1.8 (maybe 1.9) or jruby (tested on 1.5)
* Ruby 1.8, 1.9, or jruby
* rmagick on ruby 1.8/1.9

zxing.rb bundles a version of zxing.

== INSTALL:

gem install zxing
The gem packaging is incomplete. For now, you need to clone the repo,
get zxing as a submodule (git submodule update --init) and then you
can build and run the tests.

== DEVELOPMENT:

rake test && rake zxing:test

<tt>rake test</tt> runs the zxing.rb unit tests. <tt>rake zxing:test</tt> runs the
standard ZXing blackbox tests. You can give <tt>rake zxing:test</tt> a
parameter to only run matching tests (based on file globing). For
example, <tt>rake zxing:test[qrcode-2/1]</tt> will run the qrcode tests in
set 2 that start with 1 (1, 10, 11, etc.)
<tt>rake test</tt> runs the zxing.rb unit tests. <tt>rake
zxing:test</tt> runs the standard ZXing blackbox tests. You can give
<tt>rake zxing:test</tt> a parameter to only run matching tests (based
on file globing). For example, <tt>rake zxing:test[qrcode-2/1]</tt>
will run the qrcode tests in set 2 that start with 1 (1, 10, 11, etc.)

== LICENSE:

(The MIT License)

Copyright (c) 2010 {Ecin Krispie}[http://github.com/ecin], {Steven Parkes}[http://github.com/smparkes]
Copyright (c) 2011 {Steven Parkes}[http://github.com/smparkes]

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
52 changes: 16 additions & 36 deletions Rakefile
@@ -1,43 +1,26 @@
# -*- mode:ruby -*-
# -*- ruby -*-

require 'rake/clean'

java = RUBY_PLATFORM =~ /java/
macruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "macruby"

require 'rubygems'

gem "hoe", "~> 2.5"
require 'hoe'

Hoe.plugin :debugging, :doofus, :git
Hoe.plugins.delete :rubyforge

HOE = Hoe.spec 'zxing' do
developer "Steven Parkes", "smparkes@smparkes.net"

self.extra_rdoc_files = FileList["*.rdoc"]
self.history_file = "CHANGELOG.rdoc"
self.readme_file = "README.rdoc"

self.spec_extras[:extensions] = %w(Rakefile)

extra_dev_deps << [ "shoulda", ">=0" ]

if java
clean_globs << "vendor/zxing/core/core.jar"
clean_globs << "vendor/zxing/javase/javase.jar"
else
clean_globs << "**/*.a"
clean_globs << "**/*.so"
clean_globs << "**/*.bundle"
clean_globs << "**/*.dylib"
clean_globs << "**/*.pyc"
clean_globs << "lib/zxing/Makefile"
clean_globs << "lib/zxing/zxing.o"
clean_globs << "**/.sconsign.dblite"
end
clean_globs << "**/build"

if java
CLEAN.concat Dir["vendor/zxing/core/core.jar"]
CLEAN.concat Dir["vendor/zxing/javase/javase.jar"]
else
CLEAN.concat Dir["**/*.a"]
CLEAN.concat Dir["**/*.so"]
CLEAN.concat Dir["**/*.bundle"]
CLEAN.concat Dir["**/*.dylib"]
CLEAN.concat Dir["**/*.pyc"]
CLEAN.concat Dir["lib/zxing/Makefile"]
CLEAN.concat Dir["lib/zxing/zxing.o"]
CLEAN.concat Dir["**/.sconsign.dblite"]
end
CLEAN.concat Dir["**/build"]

shared_ext = ".so"
Dir["lib/zxing/zxing.*"].each do |file|
Expand All @@ -54,9 +37,6 @@ end

task :compile => "vendor/zxing"

Hoe.plugin :debugging, :doofus, :git
Hoe.plugins.delete :rubyforge

task :clean do
if File.exist? "vendor/zxing/cpp/build"
Dir.chdir "vendor/zxing/cpp" do
Expand Down
1 change: 0 additions & 1 deletion lib/zxing/version.rb
Expand Up @@ -3,7 +3,6 @@ module ZXing

VERSION_INFO = {}
VERSION_INFO['warnings'] = []
VERSION_INFO['nokogiri'] = Nokogiri::VERSION
VERSION_INFO['ruby'] = {}
VERSION_INFO['ruby']['version'] = ::RUBY_VERSION
VERSION_INFO['ruby']['platform'] = ::RUBY_PLATFORM
Expand Down
7 changes: 6 additions & 1 deletion test/vendor.rb
Expand Up @@ -140,7 +140,12 @@ def add_image image
puts "Starting #{filename}"

image = Image.read filename
expected_text = IO.read filename.sub(%r{\.[^.]+$}, ".txt") if !driver[:negative]
if !driver[:negative]
expected_text = IO.read filename.sub(%r{\.[^.]+$}, ".txt")
if RUBY_VERSION !~ /^1.8/
expected_text.force_encoding "UTF-8"
end
end

expected_metadata = {}
Dir[filename.sub(%r{\.[^.]+$}, ".metadata.txt")].each do |metafile|
Expand Down
2 changes: 1 addition & 1 deletion vendor/zxing
Submodule zxing updated from 7a386f to 16e71b
25 changes: 25 additions & 0 deletions zxing.rb.gemspec
@@ -0,0 +1,25 @@
# -*- mode: ruby; encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)

require 'zxing/version'

Gem::Specification.new do |s|
s.name = "zxing.rb"
s.version = ZXing::VERSION

s.authors = ["Steven Parkes"]
s.email = ["smparkes@smparkes.net"]
s.description = "An interface to the zxing decoder libraries. Supports zxing java under jruby and zxing C++ under 1.8.7/1.9.2 (and macruby?)."

s.files = Dir.glob("{lib,spec}/**/*") + %w(README.rdoc CHANGELOG.rdoc)
s.extra_rdoc_files = ["README.rdoc"]

s.homepage = "http://github.com/smparkes/zxing.rb"
s.rdoc_options = ["--main", "README.rdoc"]
s.require_paths = ["lib"]
s.rubygems_version = "1.3.6"
s.summary = "Ruby interface to zxing.rb"

s.add_development_dependency("bundler", "~> 1.0")
end

0 comments on commit 76dd4ae

Please sign in to comment.