Skip to content

Commit 5ad7954

Browse files
committedFeb 16, 2014
[Fix] #1 Example no workie
Fix main property of package.json
1 parent 94dc979 commit 5ad7954

File tree

7 files changed

+120
-6
lines changed

7 files changed

+120
-6
lines changed
 

‎Gruntfile.js

+26
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,31 @@ module.exports = function (grunt) {
158158
src: ['test/**/*.js']
159159
}
160160
},
161+
bump: {
162+
options: {
163+
files: ['package.json', 'bower.json'],
164+
updateConfigs: ['pkg'],
165+
commit: true,
166+
commitMessage: 'Release v%VERSION%',
167+
commitFiles: ['-a'], //['package.json', 'bower.json'], // '-a' for all files
168+
createTag: true,
169+
tagName: 'v%VERSION%',
170+
tagMessage: 'Version %VERSION%',
171+
push: true,
172+
pushTo: 'upstream',
173+
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
174+
}
175+
},
176+
replace: {
177+
'bump-gem': {
178+
src: ['lib/bwip/version.rb'],
179+
overwrite: true, // overwrite matched source files
180+
replacements: [{
181+
from: /VERSION = \"\S*\"/,
182+
to: "VERSION = \"<%= pkg.version %>\""
183+
}]
184+
}
185+
},
161186
watch: {
162187
gruntfile: {
163188
files: '<%= jshint.gruntfile.src %>',
@@ -182,6 +207,7 @@ module.exports = function (grunt) {
182207
}
183208
});
184209

210+
grunt.registerTask('bumpup', ['bump-only', 'replace:bump-gem'])
185211
grunt.registerTask('build', ['concat:build', 'uglify:build', 'copy:rails'])
186212

187213
// Default task.

‎bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bwip",
33
"main": "bwip-min.js",
4-
"version": "0.6.6",
4+
"version": "0.6.7",
55
"authors": [
66
"heartyoh <heartyoh@gmail.com>"
77
],

‎bwip.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! bwip - v0.6.6 - 2014-02-11
1+
/*! bwip - v0.6.7 - 2014-02-16
22
* https://github.com/heartyoh/bwip
33
* Copyright (c) 2014 Hearty, Oh.; Licensed MIT */
44
// file: bwip.js

‎example/node-barcode-server.js

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// file: node-barcode-server
2+
//
3+
// ----------------------------------------------------------------------
4+
// Node-js server using bwip.
5+
//
6+
// Usage :
7+
//
8+
// 1. Start Barcode Server
9+
//
10+
// $ node example/node-barcode-server.js
11+
//
12+
// 2. Request Barcode Image from your browser (type URL like below examples)
13+
//
14+
// http://127.0.0.1:3030/?bcid=code128&text=^FNC1011234567890&scale=4&rotate=L&parsefnc&alttext=(01)01234567890
15+
// http://127.0.0.1:3030/?text=1234567890&scale=4&rotate=L&parsefnc&alttext=1234567890&bcid=code39
16+
// http://127.0.0.1:3030/?text=http://www.abc.com/xyz&scale=4&rotate=L&parsefnc&bcid=qrcode
17+
//
18+
//
19+
// Possible values to specify in the query string are:
20+
//
21+
// `bcid' is the name of the bwip-js barcode rendering function e.g.
22+
//
23+
// bcid=code128
24+
//
25+
// `text' is the text to be bar coded.
26+
//
27+
// `scale' is an integer value from 1 .. 10. Default is 2.
28+
//
29+
// `rotate' takes the values:
30+
// N normal, unrotated (the default)
31+
// R clockwise, 90 rotation
32+
// L counter-clockwise, 90 rotation
33+
// I inverted, 180 rotation
34+
//
35+
// Plus any of the bar code options defined in the BWIPP documentation.
36+
//
37+
// For example:
38+
//
39+
// http://127.0.0.1:3030/?bcid=code128&text=^FNC1011234567890&scale=4&
40+
// rotate=L&parsefnc&alttext=(01)01234567890
41+
//
42+
// A complete list of the bcid's can be determined from the bwipp directory.
43+
// Valid bcid's are the same as the names of the files, minus the .js
44+
// extension. For example:
45+
//
46+
// bcid=code128 --> bwipp/code128.js
47+
//
48+
// Omit the file names beginning with 'ren'; they contain the postscript
49+
// rendering logic.
50+
//
51+
var url = require('url');
52+
var http = require('http');
53+
var bwip = require('../src/bwip-node');
54+
55+
function error(res, status, message) {
56+
res.writeHead(status, { 'Content-Type':'text/plain' });
57+
res.end(message, 'ascii');
58+
}
59+
60+
http.createServer(function(req, res) {
61+
62+
var args = url.parse(req.url, true).query;
63+
64+
// Set the defaults
65+
var scale = parseInt(args.scale, 10) || 2;
66+
var rotate = args.rotate || 'N';
67+
var bcid = args.bcid;
68+
var text = args.text;
69+
70+
if (!text)
71+
return error(res, 400, 'Bar code text not specified.\r\n');
72+
if (!bcid)
73+
return error(res, 400, 'Bar code type not specified.\r\n');
74+
75+
// Remove the non-BWIPP options
76+
delete args.scale;
77+
delete args.rotate;
78+
delete args.text;
79+
delete args.bcid;
80+
81+
// Return a PNG-encoded image
82+
var png = bwip.png(bcid, text, scale, rotate, args);
83+
84+
res.writeHead(200, { 'Content-Type':'image/png' });
85+
res.end(png, 'binary');
86+
}).listen(3030);

‎lib/bwip/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module Bwip
2-
VERSION = "0.6.6"
2+
VERSION = "0.6.7"
33
BWIP_BUILD_ON = "20130125"
44
end

‎package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bwip",
3-
"version": "0.6.6",
4-
"main": "bwip-min.js",
3+
"version": "0.6.7",
4+
"main": "src/bwip-node.js",
55
"description": "BWIP for node-js",
66
"homepage": "https://github.com/heartyoh/bwip",
77
"bugs": "https://github.com/heartyoh/bwip/issues",
@@ -31,6 +31,8 @@
3131
"grunt-contrib-concat": "~0.3.0",
3232
"grunt-contrib-uglify": "~0.2.7",
3333
"grunt-contrib-copy": "~0.5.0",
34+
"grunt-bump": "0.0.13",
35+
"grunt-text-replace": "~0.3.11",
3436
"grunt-mocha": "~0.4.10",
3537
"mocha": "~1.17.1",
3638
"chai": "~1.9.0"

‎vendor/assets/javascripts/bwip.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! bwip - v0.6.6 - 2014-02-11
1+
/*! bwip - v0.6.7 - 2014-02-16
22
* https://github.com/heartyoh/bwip
33
* Copyright (c) 2014 Hearty, Oh.; Licensed MIT */
44
// file: bwip.js

0 commit comments

Comments
 (0)
Please sign in to comment.