da_funk 0.4.9 → 0.4.10
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 +4 -4
- data/Gemfile.lock +5 -5
- data/RELEASE_NOTES.md +5 -0
- data/da_funk.gemspec +2 -3
- data/lib/device/application.rb +8 -0
- data/lib/device/helper.rb +7 -6
- data/lib/device/notification.rb +5 -2
- data/lib/device/params_dat.rb +1 -1
- data/lib/device/print.rb +18 -20
- data/lib/device/version.rb +1 -1
- data/test/unit/device/application_test.rb +31 -0
- data/utils/command_line_platform.rb +2 -1
- metadata +8 -8
- data/ext/da_funk/Makefile +0 -5
- data/ext/da_funk/extconf.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f38c6bd31e1923473ee9fb7e8a2586c580c84ad9
|
4
|
+
data.tar.gz: 3cb20a51106207f50205378c1a7190cf9ac6ee34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c789324ce787dd86505a0317ff57d84b115e814347e992fea088d842c139329485638655c1a1eb78c83b058dcb03654f25a4468f7f645799a09feed4b0d439d
|
7
|
+
data.tar.gz: facc5c84e2a207eb4897d0fe89aa7223d86e1f026efc7465334b2ce0b467a88570b1f9eea5868341c7a2a4e59fb43e3aba7578046a99ff63fe606bde436c6910
|
data/Gemfile.lock
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/scalone/walk-simplehttp-poc.git
|
3
|
-
revision:
|
3
|
+
revision: 5b1e7813e9b5653d3005f799a1a4bd3871596dd9
|
4
4
|
specs:
|
5
|
-
simplehttp (0.4.
|
5
|
+
simplehttp (0.4.1)
|
6
6
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
da_funk (0.4.
|
10
|
+
da_funk (0.4.10)
|
11
11
|
bundler (~> 1.7)
|
12
|
-
cloudwalk_handshake (~> 0.
|
12
|
+
cloudwalk_handshake (~> 0.4)
|
13
13
|
rake (~> 10.4)
|
14
14
|
yard (~> 0.8)
|
15
15
|
|
16
16
|
GEM
|
17
17
|
remote: https://rubygems.org/
|
18
18
|
specs:
|
19
|
-
cloudwalk_handshake (0.
|
19
|
+
cloudwalk_handshake (0.4.1)
|
20
20
|
rake (10.4.2)
|
21
21
|
yard (0.8.7.6)
|
22
22
|
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# DaFunk
|
2
2
|
|
3
|
+
### 0.4.10 - 2015-08-14 - Check CRC during App Update
|
4
|
+
- Update CloudwalkHandshake version.
|
5
|
+
- Support to check CRC during app update, avoiding unnecessary download.
|
6
|
+
- Fix Helper class Documentation.
|
7
|
+
|
3
8
|
### 0.4.9 - 2015-08-04 - CloudwalkHandshake loading fix
|
4
9
|
- Fixes problem to load CloudwalkHandshake.
|
5
10
|
|
data/da_funk.gemspec
CHANGED
@@ -17,8 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.homepage = "http://github.com/cloudwalkio/da_funk"
|
18
18
|
spec.license = "MIT"
|
19
19
|
|
20
|
-
spec.files = `git ls-files -z`.split("\x0")
|
21
|
-
spec.extensions = ["ext/da_funk/extconf.rb"]
|
20
|
+
spec.files = `git ls-files -z`.split("\x0") << "out/da_funk.mrb"
|
22
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
23
|
spec.require_paths = ["lib"]
|
@@ -28,5 +27,5 @@ Gem::Specification.new do |spec|
|
|
28
27
|
spec.add_dependency "rake", "~> 10.4"
|
29
28
|
spec.add_dependency "bundler", "~> 1.7"
|
30
29
|
spec.add_dependency "yard", "~> 0.8"
|
31
|
-
spec.add_dependency "cloudwalk_handshake", "~> 0.
|
30
|
+
spec.add_dependency "cloudwalk_handshake", "~> 0.4"
|
32
31
|
end
|
data/lib/device/application.rb
CHANGED
@@ -22,6 +22,14 @@ class Device
|
|
22
22
|
@zip ||= "#{file_no_ext}.zip"
|
23
23
|
end
|
24
24
|
|
25
|
+
def outdated?
|
26
|
+
return false unless File.exists?(@file_path)
|
27
|
+
file = File.open(@file_path)
|
28
|
+
Device::Crypto.crc16_hex(file.read) == @crc
|
29
|
+
ensure
|
30
|
+
file.close if file
|
31
|
+
end
|
32
|
+
|
25
33
|
def execute(json = "")
|
26
34
|
Device::Runtime.execute(file_no_ext, json)
|
27
35
|
end
|
data/lib/device/helper.rb
CHANGED
@@ -62,12 +62,13 @@ class Device
|
|
62
62
|
value
|
63
63
|
end
|
64
64
|
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# }
|
65
|
+
# @example
|
66
|
+
# {
|
67
|
+
# :default => {:detail => 10}, # default value to return if enter
|
68
|
+
# :number => true, # Add number to label or not
|
69
|
+
# "option X" => {:detail => 10},
|
70
|
+
# "option Y" => {:detail => 11}
|
71
|
+
# }
|
71
72
|
def menu(title, selection, options = {})
|
72
73
|
options[:number] = true if options[:number].nil?
|
73
74
|
|
data/lib/device/notification.rb
CHANGED
@@ -52,9 +52,12 @@ class Device
|
|
52
52
|
NotificationCallback.new "SYSTEM_UPDATE", :on => Proc.new { |file| }
|
53
53
|
NotificationCallback.new "CANCEL_SYSTEM_UPDATE", :on => Proc.new { }
|
54
54
|
NotificationCallback.new "TIMEZONE_UPDATE", :on => Proc.new { Device::Setting.cw_pos_timezone = "" }
|
55
|
-
NotificationCallback.new "SHOW_MESSAGE", :on => Proc.new { |message,datetime|
|
55
|
+
NotificationCallback.new "SHOW_MESSAGE", :on => Proc.new { |message, datetime|
|
56
56
|
Device::Display.clear
|
57
|
-
|
57
|
+
date = datetime.sub(" ", "-").split("-")
|
58
|
+
Device::Display.print_line("#{date[1]}/#{date[0]}/#{date[2]} #{date[3]}", 0)
|
59
|
+
Device::Display.print_line("#{message}", 2)
|
60
|
+
getc(0)
|
58
61
|
}
|
59
62
|
end
|
60
63
|
|
data/lib/device/params_dat.rb
CHANGED
@@ -78,7 +78,7 @@ class Device
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def self.update_app(application)
|
81
|
-
if attach && application
|
81
|
+
if attach && application && application.outdated?
|
82
82
|
Device::Display.clear
|
83
83
|
puts "Downloading #{application.file}..."
|
84
84
|
ret = Device::Transaction::Download.request_file(application.file, application.zip)
|
data/lib/device/print.rb
CHANGED
@@ -34,12 +34,11 @@ class Device
|
|
34
34
|
# @param multicode_height [Fixnum] The height control of multiple code font
|
35
35
|
# The value ranges from 12 to 64.
|
36
36
|
#
|
37
|
-
# @retval RET_OK Success.
|
38
|
-
# @retval ERR_FONT_NOT_EXIST Font does not exist.
|
39
|
-
# @retval ERR_INVALID_PARAM Invalid parameter.
|
40
|
-
# @retval ERR_DEV_BUSY Device is busy.
|
41
|
-
#
|
42
37
|
# @return [Fixnum] Return number.
|
38
|
+
# @return [Fixnum] RET_OK Success.
|
39
|
+
# @return [Fixnum] ERR_FONT_NOT_EXIST Font does not exist.
|
40
|
+
# @return [Fixnum] ERR_INVALID_PARAM Invalid parameter.
|
41
|
+
# @return [Fixnum] ERR_DEV_BUSY Device is busy.
|
43
42
|
def self.start(singlecode_width=DEFAULT_SINGLE_WIDTH,
|
44
43
|
singlecode_height=DEFAULT_SINGLE_HEIGHT,
|
45
44
|
multicode_width=DEFAULT_MULTI_WIDTH,
|
@@ -49,12 +48,11 @@ class Device
|
|
49
48
|
|
50
49
|
# Check printer status, useful for paper check.
|
51
50
|
#
|
52
|
-
# @retval RET_OK Success.
|
53
|
-
# @retval ERR_FONT_NOT_EXIST Font does not exist.
|
54
|
-
# @retval ERR_INVALID_PARAM Invalid parameter.
|
55
|
-
# @retval ERR_DEV_BUSY Device is busy.
|
56
|
-
#
|
57
51
|
# @return [Fixnum] Return number.
|
52
|
+
# @return [Fixnum] RET_OK Success.
|
53
|
+
# @return [Fixnum] ERR_FONT_NOT_EXIST Font does not exist.
|
54
|
+
# @return [Fixnum] ERR_INVALID_PARAM Invalid parameter.
|
55
|
+
# @return [Fixnum] ERR_DEV_BUSY Device is busy.
|
58
56
|
def self.open
|
59
57
|
self.adapter.open
|
60
58
|
end
|
@@ -75,11 +73,11 @@ class Device
|
|
75
73
|
|
76
74
|
# Selects print font.
|
77
75
|
#
|
78
|
-
# @param
|
76
|
+
# @param path [String] Font path.
|
79
77
|
#
|
80
|
-
# @
|
81
|
-
# @
|
82
|
-
# @
|
78
|
+
# @return [Fixnum] RET_OK Success.
|
79
|
+
# @return [Fixnum] ERR_FONT_NOT_EXIST Font does not exist.
|
80
|
+
# @return [Fixnum] ERR_INVALID_PARAM Invalid parameter.
|
83
81
|
def self.font=(path)
|
84
82
|
self.adapter.font = path
|
85
83
|
end
|
@@ -163,12 +161,12 @@ class Device
|
|
163
161
|
|
164
162
|
# Check printer status, useful for paper check.
|
165
163
|
#
|
166
|
-
# @
|
167
|
-
# @
|
168
|
-
# @
|
169
|
-
# @
|
170
|
-
# @
|
171
|
-
# @
|
164
|
+
# @return [Fixnum] RET_OK Success.
|
165
|
+
# @return [Fixnum] ERR_FONT_NOT_EXIST Font does not exist.
|
166
|
+
# @return [Fixnum] ERR_INVALID_PARAM Invalid parameter.
|
167
|
+
# @return [Fixnum] ERR_PRN_BUSY Printer is busy.
|
168
|
+
# @return [Fixnum] ERR_PRN_PAPEROUT Out of paper.
|
169
|
+
# @return [Fixnum] ERR_PRN_OVERHEAT Printer overheating.
|
172
170
|
def self.check
|
173
171
|
self._check
|
174
172
|
end
|
data/lib/device/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
class ApplicationTest < DaFunk::Test.case
|
3
|
+
def setup
|
4
|
+
@file_path = "./ttt"
|
5
|
+
@string = "12345678901234567890"
|
6
|
+
@file = File.open("./ttt", "w+")
|
7
|
+
@file.write(@string)
|
8
|
+
@file.close
|
9
|
+
@crc = Device::Crypto.crc16_hex(@string)
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_check_crc_true
|
14
|
+
application = Device::Application.new("TTT", @file_path, "ruby", @crc)
|
15
|
+
assert_equal true, application.outdated?
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_check_crc_false
|
19
|
+
application = Device::Application.new("TTT", @file_path, "ruby", "1111")
|
20
|
+
assert_equal false, application.outdated?
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_check_crc_non_file
|
24
|
+
application = Device::Application.new("TTT", "./non_exists", "ruby", "1111")
|
25
|
+
assert_equal false, application.outdated?
|
26
|
+
end
|
27
|
+
|
28
|
+
def teardown
|
29
|
+
File.delete(@file_path)
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: da_funk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thiago Scalone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -58,22 +58,21 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.4'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.4'
|
69
69
|
description: DaFunk is a Embedded System Framework optimized for programmer happiness
|
70
70
|
and sustainable productivity. It encourages beautiful code by favoring convention
|
71
71
|
over configuration.
|
72
72
|
email:
|
73
73
|
- thiago@cloudwalk.io
|
74
74
|
executables: []
|
75
|
-
extensions:
|
76
|
-
- ext/da_funk/extconf.rb
|
75
|
+
extensions: []
|
77
76
|
extra_rdoc_files: []
|
78
77
|
files:
|
79
78
|
- .gitignore
|
@@ -85,8 +84,6 @@ files:
|
|
85
84
|
- RELEASE_NOTES.md
|
86
85
|
- Rakefile
|
87
86
|
- da_funk.gemspec
|
88
|
-
- ext/da_funk/Makefile
|
89
|
-
- ext/da_funk/extconf.rb
|
90
87
|
- guides/sample_input_output.rb
|
91
88
|
- guides/sample_message_iso8583.rb
|
92
89
|
- guides/sample_network_gprs.rb
|
@@ -139,11 +136,13 @@ files:
|
|
139
136
|
- lib/serfx/exceptions.rb
|
140
137
|
- lib/serfx/response.rb
|
141
138
|
- lib/zip.rb
|
139
|
+
- out/da_funk.mrb
|
142
140
|
- test/integration/getc_test.rb
|
143
141
|
- test/integration/mrb_eval_test.rb
|
144
142
|
- test/integration/notification_test.rb
|
145
143
|
- test/integration/params_dat_test.rb
|
146
144
|
- test/test_helper.rb
|
145
|
+
- test/unit/device/application_test.rb
|
147
146
|
- test/unit/device/display_test.rb
|
148
147
|
- test/unit/device/helper_test.rb
|
149
148
|
- test/unit/device/notification_callback_test.rb
|
@@ -184,6 +183,7 @@ test_files:
|
|
184
183
|
- test/integration/notification_test.rb
|
185
184
|
- test/integration/params_dat_test.rb
|
186
185
|
- test/test_helper.rb
|
186
|
+
- test/unit/device/application_test.rb
|
187
187
|
- test/unit/device/display_test.rb
|
188
188
|
- test/unit/device/helper_test.rb
|
189
189
|
- test/unit/device/notification_callback_test.rb
|