da_funk 2.4.0 → 2.5.0

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: ecfefdd9f32ae72fab6bc9d9cbdf47a9c595b233
4
- data.tar.gz: 6c971e22e9a05fba418dc6fae68e964c6518fadb
3
+ metadata.gz: 2032799da050781996f22c8e836d952dcd4e8a4a
4
+ data.tar.gz: c49b3b3210886bf7c8820ce61c491dd0a15b3852
5
5
  SHA512:
6
- metadata.gz: bbd7fbc8a25e83c03f5e91fecefa746990ca609a151a0106dfbbcae8e099749152121fc803f016a326d15d6c8942fb06fe6f2758ab7223dc5b5add04d25f3265
7
- data.tar.gz: 2d6f5cc8f74dc7f9b4629738140bdae636616652fe7143680604e9a9134baededecdf35c5eaf7d36e3af8b2dadb2f989bdcc23a32e4a2f74f7b9e1b0607592b6
6
+ metadata.gz: 7c6360445482de2cd59ef6dfd01a183fcc91db4412faff67538c5d9dcc046a1e278fc4a322ee561862e0b9afb1d2446e516eeb70ee6986570f0d2382ee783925
7
+ data.tar.gz: af8b614fea0ce227284a7f01778f598ef87754a42991fc0ac5a05ce9914133f996d8405c20e545c37b13f54333c15dd91c6c76bffb0ae46175272af1790af90d
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.4
4
+ - ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- da_funk (2.4.0)
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.1)
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.11.0)
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
- 1.16.1
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
- ## What do I have here?
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 Projects
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 [here](http://github.com/da-funk/funky-cli)
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
- funky-cli new project
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!
@@ -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) 2016 CloudWalk, Inc.
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
@@ -1,5 +1,11 @@
1
1
  # DaFunk
2
2
 
3
+ ### 2.5.0 - 2019-02-05
4
+
5
+ - Bug fix EventHandler with slot configuration
6
+ - Fix timestamp when configuration has changed;
7
+ - Fix execution between boots.
8
+
3
9
  ### 2.4.0 - 2019-01-14
4
10
 
5
11
  - Support Device::Network.mac_address.
@@ -39,16 +39,32 @@ module DaFunk
39
39
  raise "slot or hours missing on EventHandler creation"
40
40
  end
41
41
 
42
- db = FileDb.new("main/schedule.dat")
43
- value = db[option[:slot]]
42
+ db = FileDb.new("main/schedule.dat")
43
+ string = db[option[:slot]]
44
+ config = parse_slot(string)
44
45
 
45
- if value.to_s.empty? || value.to_i <= Time.now.to_i
46
- hours = 60 * 60 * option[:hours].to_i
47
- hours = 99_999 if hours == 0
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
- value.to_i
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
 
@@ -1,4 +1,4 @@
1
1
  module DaFunk
2
- VERSION="2.4.0"
2
+ VERSION="2.5.0"
3
3
  end
4
4
 
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.0
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-01-14 00:00:00.000000000 Z
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