barcodeservice 1.0.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gems CHANGED
@@ -1,2 +1,2 @@
1
1
  gbarcode
2
-
2
+ sinatra
data/README.markdown CHANGED
@@ -16,7 +16,7 @@ You can embed barcodes into your web pages simply by using an <img> tag
16
16
 
17
17
  <img src="http://my-barcode-server.heroku.com/999999999999999.png?type=ISBN" />
18
18
  <img src="http://my-barcode-server.heroku.com/ABCDEF1232333.png?type=code93" />
19
- <img src="http://my-barcode-server.heroku.com/ABC123.png?type=code93&width=50&height=30&x=4&y=200&scale=2" />
19
+ <img src="http://my-barcode-server.heroku.com/ABC123.png?width=50&height=30&x=4&y=200&scale=1" />
20
20
 
21
21
 
22
22
  Patches welcome, forks celebrated.
data/Rakefile CHANGED
@@ -8,6 +8,8 @@ begin
8
8
  gem.homepage = "http://github.com/JackDanger/barcodeservice"
9
9
  gem.authors = ["Jack Danger Canty"]
10
10
  gem.add_development_dependency "shoulda", ">= 0"
11
+ gem.add_dependency "sinatra"
12
+ gem.add_dependency "gbarcode"
11
13
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
12
14
  end
13
15
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.2.1
@@ -0,0 +1,54 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{barcodeservice}
8
+ s.version = "1.2.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jack Danger Canty"]
12
+ s.date = %q{2010-10-02}
13
+ s.description = %q{Run your own barcode image generator for free on Heroku.com}
14
+ s.email = %q{gitcommit@6brand.com}
15
+ s.extra_rdoc_files = [
16
+ "README.markdown"
17
+ ]
18
+ s.files = [
19
+ ".gems",
20
+ "README.markdown",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "barcodeservice.gemspec",
24
+ "config.ru",
25
+ "lib/barcode_service.rb",
26
+ "lib/barcodeservice.rb",
27
+ "test.rb"
28
+ ]
29
+ s.homepage = %q{http://github.com/JackDanger/barcodeservice}
30
+ s.rdoc_options = ["--charset=UTF-8"]
31
+ s.require_paths = ["lib"]
32
+ s.rubygems_version = %q{1.3.7}
33
+ s.summary = %q{lightwight barcode image server running on Heroku.com}
34
+
35
+ if s.respond_to? :specification_version then
36
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
37
+ s.specification_version = 3
38
+
39
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
40
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
41
+ s.add_runtime_dependency(%q<sinatra>, [">= 0"])
42
+ s.add_runtime_dependency(%q<gbarcode>, [">= 0"])
43
+ else
44
+ s.add_dependency(%q<shoulda>, [">= 0"])
45
+ s.add_dependency(%q<sinatra>, [">= 0"])
46
+ s.add_dependency(%q<gbarcode>, [">= 0"])
47
+ end
48
+ else
49
+ s.add_dependency(%q<shoulda>, [">= 0"])
50
+ s.add_dependency(%q<sinatra>, [">= 0"])
51
+ s.add_dependency(%q<gbarcode>, [">= 0"])
52
+ end
53
+ end
54
+
data/config.ru CHANGED
@@ -1,4 +1,4 @@
1
- require 'lib/barcode_service_server'
1
+ require 'lib/barcode_service'
2
2
 
3
3
  ## There is no need to set directories here anymore;
4
4
  ## Just run the application
@@ -28,9 +28,9 @@ get '/' do
28
28
  %Q{
29
29
  <body style='line-height: 1.8em; font-family: Archer, Museo, Helvetica, Georgia; font-size 25px; text-align: center; padding-top: 20%;'>
30
30
  Get a barcode image by crafting a url at this domain.
31
- <pre style='font-family: Iconsolata, monospace;background-color:#EEE'><img src="http://#{request.host}/12345632323.jpg?type=isbn</pre>
31
+ <pre style='font-family: Iconsolata, monospace;background-color:#EEE'>&lt;img src="http://#{request.host}/12345632323.png" /&gt;</pre>
32
32
  <br />
33
- Also, try <a href='http://github.com/JackDanger/barcodeservice'>the official Ruby client</a>
33
+ <img src="http://#{request.host}/12345632323.png" />
34
34
  </body
35
35
  }
36
36
  end
@@ -39,18 +39,19 @@ end
39
39
 
40
40
  def default_options
41
41
  {
42
- :type => '93',
43
- :output => 'png',
44
- :width => 100,
45
- :height => 50,
46
- :x => 0,
47
- :y => 0,
48
- :margin => 0,
49
- :scale => 0
42
+ 'type' => 'any',
43
+ 'output' => 'png',
44
+ 'width' => 100,
45
+ 'height' => 50,
46
+ 'x' => 0,
47
+ 'y' => 0,
48
+ 'margin' => 0,
49
+ 'scale' => 0
50
50
  }
51
51
  end
52
52
 
53
53
  TYPES = {
54
+ 'any' => 'BARCODE_ANY',
54
55
  'ean' => 'BARCODE_EAN',
55
56
  'upc' => 'BARCODE_UPC',
56
57
  'isbn' => 'BARCODE_ISBN',
@@ -73,7 +74,13 @@ module Converter
73
74
  require 'stringio'
74
75
 
75
76
  barcode = barcode_create(code)
76
- barcode_encode barcode, BARCODE_NO_CHECKSUM | const_get(TYPES[options[:type]])
77
+ barcode.width = options['width'].to_i
78
+ barcode.height = options['height'].to_i
79
+ barcode.xoff = options['x'].to_i
80
+ barcode.yoff = options['y'].to_i
81
+ barcode.scalef = options['scale'].to_i
82
+ barcode_encode barcode, BARCODE_NO_CHECKSUM | const_get(TYPES[options['type']])
83
+
77
84
  file = Tempfile.new('barcode')
78
85
  File.open(file.path, 'w') do |f|
79
86
  barcode_print(barcode, f, BARCODE_OUT_EPS)
data/test.rb CHANGED
@@ -48,7 +48,7 @@ class BarcodeServiceTest < Test::Unit::TestCase
48
48
  end
49
49
  end
50
50
 
51
- TYPES.each do |type|
51
+ TYPES.each do |type,_|
52
52
  context "on GET with code and #{type} barcode" do
53
53
  setup {
54
54
  get "/1234322.png?type=#{type}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barcodeservice
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
8
+ - 2
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jack Danger Canty
@@ -32,6 +32,34 @@ dependencies:
32
32
  version: "0"
33
33
  type: :development
34
34
  version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: sinatra
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: gbarcode
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
35
63
  description: Run your own barcode image generator for free on Heroku.com
36
64
  email: gitcommit@6brand.com
37
65
  executables: []
@@ -45,6 +73,7 @@ files:
45
73
  - README.markdown
46
74
  - Rakefile
47
75
  - VERSION
76
+ - barcodeservice.gemspec
48
77
  - config.ru
49
78
  - lib/barcode_service.rb
50
79
  - lib/barcodeservice.rb