iboleto 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc6a36131090643aae14fd99b9b165d843f87b81
4
- data.tar.gz: d97791a3f91243ebdc88bf67f73e9c5e343d8079
3
+ metadata.gz: ebc892d6883bc1690b198f273aa3a9acc9fc87e7
4
+ data.tar.gz: 70a0c47793e2c10a20ff37f43597d7ba8791fbb0
5
5
  SHA512:
6
- metadata.gz: 221b4a6ea563c6db57284e38a589cf8b677333621cbf315758aeeb56f82909984b883a824d7d25cab029cb1a15a211ce7e3abdd0b4cd086f654b0fa701066c0d
7
- data.tar.gz: 52647eba7d6ac2fc2c8581aeca9345e929a9e3d70a790f5a7db10dfd3825068c0a5f9ef106c6d9a6325b81f424830bccb621aaa9b1a44458be6651cec55ba0b5
6
+ metadata.gz: a4337abd3a521d716ec30f922146175bcf2d9c2b625562f64b307b99333859f171ec7f5faccbab397be35f076d049aedcc98e28f922731faf466f9038f495230
7
+ data.tar.gz: e92f5274555c555d43fa705b592b3bc7c384a5299855e185dd6f017ac88a1c6669bc610c2b6561191b58bb6e4b0b016daac3e6299faf5b1f2ee31013eebab05f
data/README.en.md CHANGED
@@ -18,6 +18,12 @@ Add this line to your application's Gemfile:
18
18
 
19
19
  $ iboleto
20
20
 
21
+ ## GTK-2 copy/paste support
22
+ If you want iboleto to clipboard copy the read barcode, you just
23
+ need to install the __gtk2__ gem with the following command:
24
+
25
+ $ gem install gtk2
26
+
21
27
  ## Contributing
22
28
 
23
29
  1. Fork it ( https://github.com/[my-github-username]/iboleto/fork )
data/README.md CHANGED
@@ -16,6 +16,13 @@ Então você pode colar os números no seu **internet bank** para realizar o pag
16
16
 
17
17
  $ iboleto
18
18
 
19
+ ## Suporte à copiar/colar do GTK-2
20
+ Se você deseja que o iboleto automaticamente copie para
21
+ àrea de trabalho o código de barras lido, basta você instalar
22
+ a gem __gtk2__ com o comando abaixo
23
+
24
+ $ gem install gtk2
25
+
19
26
  ## Para contribuir
20
27
 
21
28
  1. Fork ( https://github.com/abinoam/iboleto/fork )
data/bin/iboleto CHANGED
@@ -3,7 +3,13 @@
3
3
 
4
4
  # Last updated at October, 06, 2014.
5
5
 
6
- require 'gtk2'
6
+ # Require gtk2 if available
7
+
8
+ begin
9
+ require 'gtk2'
10
+ rescue LoadError
11
+ end
12
+
7
13
  require 'socket'
8
14
 
9
15
  class ClientQuitError < RuntimeError; end
@@ -33,21 +39,29 @@ loop do
33
39
  begin
34
40
  while line = s.gets # read a line at a time
35
41
  if m = line.match(/POST \/iBoleto\?cod=(\d+)+&dec=(\d+)/)
36
- clip = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
37
-
38
42
  cod = m[1]
39
43
  dec = m[2]
40
44
 
41
45
  boleto_regexp = /\A(\w{5})(\w{5})(\w{5})(\w{6})(\w{5})(\w{6})(\w{1})(\w{14})\Z/
42
- boleto = dec.dup.sub!(boleto_regexp, '\1 2 \3 \4 \5 \6 \7 \8')
46
+ boleto = dec.dup.sub!(boleto_regexp, '\1 \2 \3 \4 \5 \6 \7 \8')
43
47
  boleto_with_tabs = dec.dup.sub!(boleto_regexp, "\\1\t\\2\t\\3\t\\4\t\\5\t\\6\t\\7\t\\8")
44
48
 
45
49
  conv_regexp = /\A(\d{12})(\d{12})(\d{12})(\d{12})\Z/
46
50
  conv = dec.dup.sub!(conv_regexp, '\1 \2 \3 \4')
47
51
  conv_with_tabs = dec.dup.sub!(conv_regexp, "\\1\t\\2\t\\3\t\\4")
48
52
 
49
- clip.set_text([cod, dec, boleto, boleto_with_tabs, conv, conv_with_tabs].compact.join("\n"))
50
- clip.store
53
+ boleto_info = [cod, dec, boleto, boleto_with_tabs, conv, conv_with_tabs].compact.join("\n")
54
+
55
+ puts
56
+ puts "Boleto Information (in more than one format/spacing):"
57
+ puts boleto_info
58
+ puts
59
+
60
+ if defined? Gtk
61
+ clip = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
62
+ clip.set_text(boleto_info)
63
+ clip.store
64
+ end
51
65
  end
52
66
 
53
67
  if ["\n\r", "\n", "\r\n"].include? line
data/iboleto.gemspec CHANGED
@@ -20,5 +20,4 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_runtime_dependency "gtk2"
24
23
  end
@@ -1,3 +1,3 @@
1
1
  module IBoleto
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iboleto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abinoam Praxedes Marques Jr.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: gtk2
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  description: Linux compatible CLI Ruby server for QuadriMind IBoleto android app -
56
42
  http://www.quadrimind.com/iBoleto/
57
43
  email:
@@ -91,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
77
  version: '0'
92
78
  requirements: []
93
79
  rubyforge_project:
94
- rubygems_version: 2.4.3
80
+ rubygems_version: 2.4.6
95
81
  signing_key:
96
82
  specification_version: 4
97
83
  summary: Linux compatible CLI Ruby server for IBoleto android app