gnubarcode 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .rvmrc
5
+ Gemfile.lock
@@ -0,0 +1,3 @@
1
+ 0.1.0 [Wed Jan 5 2011]
2
+
3
+ * First release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in soundex.gemspec
4
+ gemspec
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Gabriel Sobrinho
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,9 @@
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.pattern = 'test/**/*_test.rb'
9
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "gnubarcode/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "gnubarcode"
7
+ s.version = GnuBarcode::Version::STRING
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Gabriel Sobrinho"]
10
+ s.email = ["gabriel.sobrinho@gmail.com"]
11
+ s.homepage = "http://github.com/sobrinho/gnubarcode"
12
+ s.summary = %q{}
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+ s.add_dependency(%q<activesupport>, [">= 3.0.0"])
18
+ end
@@ -0,0 +1,21 @@
1
+ require 'active_support/core_ext/class/attribute'
2
+
3
+ class GnuBarcode
4
+ attr_accessor :barcode
5
+
6
+ def initialize(barcode)
7
+ self.barcode = barcode
8
+ end
9
+
10
+ def to_image
11
+ %x(barcode -b #{barcode} | convert -trim +repage ps:- jpg:-)
12
+ end
13
+
14
+ def inspect
15
+ "#<GnuBarcode barcode: #{barcode.inspect}>"
16
+ end
17
+
18
+ def to_s
19
+ barcode.to_s
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ class GnuBarcode
2
+ module Version #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 1
5
+ TINY = 0
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ class GnuBarcodeTest < ActiveSupport::TestCase
4
+ setup do
5
+ @barcode = GnuBarcode.new('20110105qer472')
6
+ end
7
+
8
+ test 'to_image' do
9
+ assert_equal File.read('test/fixtures/20110105qer472.jpg'), @barcode.to_image
10
+ end
11
+
12
+ test 'to_s' do
13
+ assert_equal '20110105qer472', @barcode.to_s
14
+ end
15
+
16
+ test 'inspect' do
17
+ assert_equal '#<GnuBarcode barcode: "20110105qer472">', @barcode.inspect
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'gnubarcode'
4
+ require 'test/unit'
5
+ require 'active_support/test_case'
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gnubarcode
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Gabriel Sobrinho
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-05 00:00:00 -02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activesupport
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
34
+ version: 3.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description:
38
+ email:
39
+ - gabriel.sobrinho@gmail.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - CHANGELOG
49
+ - Gemfile
50
+ - MIT-LICENSE
51
+ - Rakefile
52
+ - gnubarcode.gemspec
53
+ - lib/gnubarcode.rb
54
+ - lib/gnubarcode/version.rb
55
+ - test/fixtures/20110105qer472.jpg
56
+ - test/gnubarcode_test.rb
57
+ - test/test_helper.rb
58
+ has_rdoc: true
59
+ homepage: http://github.com/sobrinho/gnubarcode
60
+ licenses: []
61
+
62
+ post_install_message:
63
+ rdoc_options: []
64
+
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: 3
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ requirements: []
86
+
87
+ rubyforge_project:
88
+ rubygems_version: 1.4.1
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: ""
92
+ test_files:
93
+ - test/fixtures/20110105qer472.jpg
94
+ - test/gnubarcode_test.rb
95
+ - test/test_helper.rb