da_funk 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Gemfile.lock +4 -4
- data/README.md +45 -13
- data/README_GUIDE.md +1 -1
- data/RELEASE_NOTES.md +6 -0
- data/lib/da_funk/event_handler.rb +43 -8
- data/lib/da_funk/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2032799da050781996f22c8e836d952dcd4e8a4a
|
4
|
+
data.tar.gz: c49b3b3210886bf7c8820ce61c491dd0a15b3852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c6360445482de2cd59ef6dfd01a183fcc91db4412faff67538c5d9dcc046a1e278fc4a322ee561862e0b9afb1d2446e516eeb70ee6986570f0d2382ee783925
|
7
|
+
data.tar.gz: af8b614fea0ce227284a7f01778f598ef87754a42991fc0ac5a05ce9914133f996d8405c20e545c37b13f54333c15dd91c6c76bffb0ae46175272af1790af90d
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
da_funk (2.
|
4
|
+
da_funk (2.5.0)
|
5
5
|
archive-zip (~> 0.5)
|
6
6
|
bundler
|
7
7
|
cloudwalk_handshake
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
bundler
|
20
20
|
rake
|
21
21
|
cloudwalk_handshake (0.13.2)
|
22
|
-
funky-emv (0.20.
|
22
|
+
funky-emv (0.20.2)
|
23
23
|
funky-tlv (~> 0.2)
|
24
24
|
funky-simplehttp (0.5.0)
|
25
25
|
funky-tlv (0.2.3)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
parallel (1.12.1)
|
29
29
|
parser (2.5.3.0)
|
30
30
|
ast (~> 2.4.0)
|
31
|
-
posxml_parser (2.
|
31
|
+
posxml_parser (2.12.0)
|
32
32
|
funky-emv (~> 0.3)
|
33
33
|
powerpack (0.1.2)
|
34
34
|
rainbow (3.0.0)
|
@@ -58,4 +58,4 @@ DEPENDENCIES
|
|
58
58
|
yard
|
59
59
|
|
60
60
|
BUNDLED WITH
|
61
|
-
|
61
|
+
2.0.1
|
data/README.md
CHANGED
@@ -2,27 +2,18 @@
|
|
2
2
|
|
3
3
|
DaFunk is a Embedded System Framework optimized for programmer happiness and sustainable productivity. It encourages modulatiry by adapter pattern an beautiful code by favoring convention over configuration.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
This repository contains a set of files and folder that compose the
|
8
|
-
**DaFunk API**. The structure goes as follows:
|
9
|
-
|
10
|
-
- The `guides` directory, which contains a group of files that are intended to instruct how to use our framework.
|
11
|
-
- An `imgs` directory, containing a picture that references the creative origins of this project.
|
12
|
-
- A `lib` directory, which holds the main source code of our Framework API.
|
13
|
-
- An `out`directory, which has a previous generated binary of this project. All builds target this directory.
|
14
|
-
- A `test` directory with example test cases. Tests are divided by _integration_ tests and _unit_ tests.
|
5
|
+
This project was created to run on top of [mruby runtime](https://github.com/mruby/mruby), and it's part of bigger ecosystem created by CloudWalk to help embedded delopers, to undertand better why CloudWalk creat it, check the [DaFunk Ecosystem session](https://github.com/cloudwalkio/da_funk#dafunk-ecosystem).
|
15
6
|
|
16
7
|
## How do I use DaFunk?
|
17
8
|
|
18
|
-
### Embedded
|
9
|
+
### Embedded Devices Engine
|
19
10
|
|
20
|
-
DaFunk is a gem to be used in MRuby environment, to provide the environment we created a CLI that is able to create, compile, run and test DaFunk Apps. You can check [
|
11
|
+
DaFunk is a gem to be used in MRuby environment, to provide the environment we created a CLI that is able to create, compile, run and test DaFunk Apps. You can check [CloudWalk Runtime Setup Page](https://docs.cloudwalk.io/pt-BR/cli/setup)
|
21
12
|
|
22
13
|
Project creation flow in Ruby environment:
|
23
14
|
|
24
15
|
```
|
25
|
-
|
16
|
+
cloudwalk new project
|
26
17
|
cd project
|
27
18
|
bundle install
|
28
19
|
bundle exec rake test:unit
|
@@ -36,8 +27,49 @@ For more advanced users only wanting to use the `iso8583` module, here's how you
|
|
36
27
|
require 'da_funk/iso8583'
|
37
28
|
```
|
38
29
|
|
30
|
+
## DaFunk Ecosystem
|
31
|
+
|
32
|
+
Using mruby we have created some projects that are the basis of the CloudWalk ecosystem of developing payment applications for POS terminals.
|
33
|
+
|
34
|
+
### DaFunk API Architecture
|
35
|
+
|
36
|
+
![DaFunkMap](https://github.com/cloudwalkio/around_the_world/blob/master/imgs/apps.jpg?raw=true)
|
37
|
+
|
38
|
+
|
39
|
+
### Platform
|
40
|
+
|
41
|
+
[mruby-cloudwalk-platform](https://github.com/cloudwalkio/mruby-cloudwalk-platform) is the project responsible for the homologation/support of new devices, using mruby's toolkit this repository provides support for cross-compilation of new platforms, and the minimal and modular API between the device (in C) and the da_funk framework (in Ruby).
|
42
|
+
|
43
|
+
For more informations check the mruby-cloudwalk-platform [wiki page](https://github.com/cloudwalkio/mruby-cloudwalk-platform/wiki) and [mruby page](https://github.com/mruby/mruby).
|
44
|
+
|
45
|
+
### DaFunk
|
46
|
+
|
47
|
+
[da_funk] (https://github.com/cloudwalkio/da_funk) is an embedded system framework optimized for programmer happiness and productivity in a sustainable environment, it encourages, modularity using Adapter Pattern, and a beautiful code using convention on configuration.
|
48
|
+
|
49
|
+
### Apps
|
50
|
+
|
51
|
+
[cloudwalk cli](https://github.com/cloudwalkio/cloudwalk) is the project responsible to create, execute, test and deploy the application.
|
52
|
+
|
53
|
+
### Motivation
|
54
|
+
|
55
|
+
Check CloudWalk blog post about the motiviations create the this, [here.](https://www-staging.cloudwalk.io/en/blog/how-to-delivery-payment-applications-in-ruby)
|
56
|
+
|
57
|
+
|
39
58
|
## I would like to contribute
|
40
59
|
|
60
|
+
### What do I have here?
|
61
|
+
|
62
|
+
This repository contains a set of files and folder that compose the
|
63
|
+
**DaFunk API**. The structure goes as follows:
|
64
|
+
|
65
|
+
- The `guides` directory, which contains a group of files that are intended to instruct how to use our framework.
|
66
|
+
- An `imgs` directory, containing a picture that references the creative origins of this project.
|
67
|
+
- A `lib` directory, which holds the main source code of our Framework API.
|
68
|
+
- `lib/da_funk` - DaFunk API, Helpers, Communication, Froms everything not related to a Device in order to help the developer.
|
69
|
+
- `lib/device` - Interface between DaFunk API and homologate device
|
70
|
+
- An `out`directory, which has a previous generated binary of this project. All builds target this directory.
|
71
|
+
- A `test` directory with example test cases. Tests are divided by _integration_ tests and _unit_ tests.
|
72
|
+
|
41
73
|
Please follow the instructions:
|
42
74
|
|
43
75
|
1. Fork it under your github account!
|
data/README_GUIDE.md
CHANGED
@@ -50,7 +50,7 @@ Check test samples [here](da_funk/Guide.html).
|
|
50
50
|
```
|
51
51
|
The MIT License (MIT)
|
52
52
|
|
53
|
-
Copyright (c)
|
53
|
+
Copyright (c) 2019 CloudWalk, Inc.
|
54
54
|
|
55
55
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
56
56
|
of this software and associated documentation files (the "Software"), to deal
|
data/RELEASE_NOTES.md
CHANGED
@@ -39,16 +39,32 @@ module DaFunk
|
|
39
39
|
raise "slot or hours missing on EventHandler creation"
|
40
40
|
end
|
41
41
|
|
42
|
-
db
|
43
|
-
|
42
|
+
db = FileDb.new("main/schedule.dat")
|
43
|
+
string = db[option[:slot]]
|
44
|
+
config = parse_slot(string)
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
value = (Time.now.to_i + hours)
|
49
|
-
db[option[:slot]] = value
|
46
|
+
unless config
|
47
|
+
# configure from scrath
|
48
|
+
config = {"timestamp" => nil, "interval" => stringify_hours(option)}
|
50
49
|
end
|
51
|
-
|
50
|
+
|
51
|
+
unless config["timestamp"]
|
52
|
+
config["timestamp"] = hours2seconds(option["interval"])
|
53
|
+
else
|
54
|
+
if config["interval"]["hours"].to_s != option[:hours].to_s
|
55
|
+
config["timestamp"] = hours2seconds(option[:hours])
|
56
|
+
config["interval"]["hours"] = option[:hours].to_s
|
57
|
+
else
|
58
|
+
if self.timer && self.timer.to_i < Time.now.to_i
|
59
|
+
config["timestamp"] = hours2seconds(option[:hours])
|
60
|
+
config["interval"]["hours"] = option[:hours].to_s
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
db[option[:slot]] = config.to_json
|
66
|
+
|
67
|
+
config["timestamp"].to_i
|
52
68
|
end
|
53
69
|
|
54
70
|
def execute?
|
@@ -59,6 +75,25 @@ module DaFunk
|
|
59
75
|
! self.timer
|
60
76
|
end
|
61
77
|
end
|
78
|
+
|
79
|
+
private
|
80
|
+
def stringify_hours(options)
|
81
|
+
{"hours" => options[:hours]}
|
82
|
+
end
|
83
|
+
|
84
|
+
def hours2seconds(interval)
|
85
|
+
hours = 60 * 60 * interval.to_i
|
86
|
+
hours = 99_999 if hours == 0
|
87
|
+
(Time.now.to_i + hours)
|
88
|
+
end
|
89
|
+
|
90
|
+
def parse_slot(string)
|
91
|
+
unless string.to_s.empty?
|
92
|
+
JSON.parse(string)
|
93
|
+
end
|
94
|
+
rescue # old format slot=<fixnum>
|
95
|
+
nil
|
96
|
+
end
|
62
97
|
end
|
63
98
|
end
|
64
99
|
|
data/lib/da_funk/version.rb
CHANGED
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: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thiago Scalone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -132,6 +132,7 @@ extensions: []
|
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
134
|
- ".gitignore"
|
135
|
+
- ".travis.yml"
|
135
136
|
- ".yardopts"
|
136
137
|
- Gemfile
|
137
138
|
- Gemfile.lock
|