ladder_drive 0.6.4 → 0.6.8

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
- SHA1:
3
- metadata.gz: 78f994329616c81aa08af6f821851a9cfa302382
4
- data.tar.gz: cdd5b03d754155febbc0e0b77f4e23a09910a447
2
+ SHA256:
3
+ metadata.gz: fadb0c39709c720b91a91ed6b977a7583abd7dc6962dc4805a700c8dfef0c0b4
4
+ data.tar.gz: cee86c1d967c1198bd3bedeb215b7ace6f417e6757e84f65d92e6950851bb31e
5
5
  SHA512:
6
- metadata.gz: c92d94494040f7d972110d07d116df9fdea309c979fde59a58da644e4f9d41a775ec680c16a8e82be9267705f6dae9f6ca7967b4c595c03dcbf1cbd41158081f
7
- data.tar.gz: d5343de39d9760831bda75adb6dfc7e6f30cb485f7c6f137a67dcd651583ecc517c415de040963cbe6cab29f5a968d1fdd7a9837fc9ebdc69ace1dfedbc8b07d
6
+ metadata.gz: 3bfd5997a940904d6aa25b87e6bfa5765cb408cea83c840a04da5ddd426eb8d793863e205a0b2681d504d2122a84496d35db46a0f41f333494c1ee7b7391fba7
7
+ data.tar.gz: abbfb718c68c7088e97cc33a35b91e929e1b33ac243e3b65b144d7402192f9b61434eb94e58d6dc1413c4def5e522a218c80a7583c81814be1ddee5da91f5b6d
data/Gemfile CHANGED
@@ -6,7 +6,6 @@ gemspec
6
6
  group :test do
7
7
  gem "test-unit"
8
8
  gem "test-unit-rr"
9
- #gem "test-unit-notify"
10
9
  end
11
10
 
12
11
  gem "activesupport", '>= 4.0'
@@ -18,3 +17,4 @@ gem 'serialport'
18
17
  gem 'google_drive'
19
18
  gem "ruby-trello"
20
19
  gem 'ambient_iot', ">= 0.1.1"
20
+ gem 'dotenv'
data/Gemfile.lock CHANGED
@@ -1,135 +1,168 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ladder_drive (0.6.4)
5
- activesupport (~> 5.0)
6
- ffi (~> 1.9.24, >= 1.9.24)
7
- google_drive (~> 3.0)
4
+ ladder_drive (0.6.7)
5
+ activesupport (~> 6.0)
6
+ ambient_iot (~> 0.1, >= 0.1.1)
7
+ dotenv (~> 2.1)
8
+ ffi (~> 1.9, >= 1.9.24)
9
+ google_drive (~> 3.0, >= 3.0.3)
8
10
  pi_piper (~> 2.0, >= 2.0.0)
9
11
  ruby-trello (~> 2.1)
10
- serialport
12
+ serialport (~> 1.3, >= 1.3.1)
11
13
  thor (~> 0)
12
14
 
13
15
  GEM
14
16
  remote: https://rubygems.org/
15
17
  specs:
16
- activemodel (5.2.3)
17
- activesupport (= 5.2.3)
18
- activesupport (5.2.3)
18
+ activemodel (6.1.4.1)
19
+ activesupport (= 6.1.4.1)
20
+ activesupport (6.1.4.1)
19
21
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
- i18n (>= 0.7, < 2)
21
- minitest (~> 5.1)
22
- tzinfo (~> 1.1)
23
- addressable (2.6.0)
24
- public_suffix (>= 2.0.2, < 4.0)
22
+ i18n (>= 1.6, < 2)
23
+ minitest (>= 5.1)
24
+ tzinfo (~> 2.0)
25
+ zeitwerk (~> 2.3)
26
+ addressable (2.8.0)
27
+ public_suffix (>= 2.0.2, < 5.0)
25
28
  ambient_iot (0.1.1)
26
- concurrent-ruby (1.1.5)
27
- declarative (0.0.10)
28
- declarative-option (0.1.0)
29
+ concurrent-ruby (1.1.9)
30
+ declarative (0.0.20)
29
31
  domain_name (0.5.20190701)
30
32
  unf (>= 0.0.5, < 1.0.0)
33
+ dotenv (2.7.6)
31
34
  eventmachine (1.0.9)
32
- faraday (0.15.4)
35
+ faraday (1.7.0)
36
+ faraday-em_http (~> 1.0)
37
+ faraday-em_synchrony (~> 1.0)
38
+ faraday-excon (~> 1.1)
39
+ faraday-httpclient (~> 1.0.1)
40
+ faraday-net_http (~> 1.0)
41
+ faraday-net_http_persistent (~> 1.1)
42
+ faraday-patron (~> 1.0)
43
+ faraday-rack (~> 1.0)
33
44
  multipart-post (>= 1.2, < 3)
45
+ ruby2_keywords (>= 0.0.4)
46
+ faraday-em_http (1.0.0)
47
+ faraday-em_synchrony (1.0.0)
48
+ faraday-excon (1.1.0)
49
+ faraday-httpclient (1.0.1)
50
+ faraday-net_http (1.0.1)
51
+ faraday-net_http_persistent (1.2.0)
52
+ faraday-patron (1.0.0)
53
+ faraday-rack (1.0.0)
34
54
  ffi (1.9.25)
35
- google-api-client (0.30.7)
55
+ google-apis-core (0.4.1)
36
56
  addressable (~> 2.5, >= 2.5.1)
37
- googleauth (>= 0.5, < 0.10.0)
38
- httpclient (>= 2.8.1, < 3.0)
57
+ googleauth (>= 0.16.2, < 2.a)
58
+ httpclient (>= 2.8.1, < 3.a)
39
59
  mini_mime (~> 1.0)
40
60
  representable (~> 3.0)
41
- retriable (>= 2.0, < 4.0)
42
- signet (~> 0.10)
43
- google_drive (3.0.3)
44
- google-api-client (>= 0.11.0, < 0.31.0)
61
+ retriable (>= 2.0, < 4.a)
62
+ rexml
63
+ webrick
64
+ google-apis-drive_v3 (0.13.0)
65
+ google-apis-core (>= 0.4, < 2.a)
66
+ google-apis-sheets_v4 (0.9.0)
67
+ google-apis-core (>= 0.4, < 2.a)
68
+ google_drive (3.0.7)
69
+ google-apis-drive_v3 (>= 0.5.0, < 1.0.0)
70
+ google-apis-sheets_v4 (>= 0.4.0, < 1.0.0)
45
71
  googleauth (>= 0.5.0, < 1.0.0)
46
72
  nokogiri (>= 1.5.3, < 2.0.0)
47
- googleauth (0.8.1)
48
- faraday (~> 0.12)
73
+ googleauth (0.17.0)
74
+ faraday (>= 0.17.3, < 2.0)
49
75
  jwt (>= 1.4, < 3.0)
50
76
  memoist (~> 0.16)
51
77
  multi_json (~> 1.11)
52
78
  os (>= 0.9, < 2.0)
53
- signet (~> 0.7)
54
- http-cookie (1.0.3)
79
+ signet (~> 0.14)
80
+ http-accept (1.7.0)
81
+ http-cookie (1.0.4)
55
82
  domain_name (~> 0.5)
56
83
  httpclient (2.8.3)
57
- i18n (1.6.0)
84
+ i18n (1.8.10)
58
85
  concurrent-ruby (~> 1.0)
59
- json (2.2.0)
60
- jwt (2.2.1)
61
- memoist (0.16.0)
62
- mime-types (3.2.2)
86
+ json (2.5.1)
87
+ jwt (2.2.3)
88
+ memoist (0.16.2)
89
+ mime-types (3.3.1)
63
90
  mime-types-data (~> 3.2015)
64
- mime-types-data (3.2019.0331)
65
- mini_mime (1.0.2)
66
- mini_portile2 (2.4.0)
67
- minitest (5.11.3)
68
- multi_json (1.13.1)
91
+ mime-types-data (3.2021.0704)
92
+ mini_mime (1.1.1)
93
+ minitest (5.14.4)
94
+ multi_json (1.15.0)
69
95
  multipart-post (2.1.1)
70
96
  netrc (0.11.0)
71
- nokogiri (1.10.3)
72
- mini_portile2 (~> 2.4.0)
73
- oauth (0.5.4)
74
- os (1.0.1)
97
+ nokogiri (1.12.4-x86_64-darwin)
98
+ racc (~> 1.4)
99
+ oauth (0.5.6)
100
+ os (1.1.1)
75
101
  pi_piper (2.0.0)
76
102
  eventmachine (= 1.0.9)
77
103
  ffi
78
- power_assert (1.1.4)
79
- public_suffix (3.1.1)
80
- rake (10.5.0)
81
- representable (3.0.4)
104
+ power_assert (2.0.1)
105
+ public_suffix (4.0.6)
106
+ racc (1.5.2)
107
+ rake (13.0.6)
108
+ representable (3.1.1)
82
109
  declarative (< 0.1.0)
83
- declarative-option (< 0.2.0)
110
+ trailblazer-option (>= 0.1.1, < 0.2.0)
84
111
  uber (< 0.2.0)
85
- rest-client (2.0.2)
112
+ rest-client (2.1.0)
113
+ http-accept (>= 1.7.0, < 2.0)
86
114
  http-cookie (>= 1.0.2, < 2.0)
87
115
  mime-types (>= 1.16, < 4.0)
88
116
  netrc (~> 0.8)
89
117
  retriable (3.1.2)
90
- rr (1.2.1)
91
- ruby-trello (2.1.0)
118
+ rexml (3.2.5)
119
+ rr (3.0.7)
120
+ ruby-trello (2.3.1)
92
121
  activemodel (>= 3.2.0)
93
122
  addressable (~> 2.3)
94
- json
123
+ json (>= 2.3.0)
95
124
  oauth (>= 0.4.5)
96
125
  rest-client (>= 1.8.0)
126
+ ruby2_keywords (0.0.5)
97
127
  serialport (1.3.1)
98
- signet (0.11.0)
128
+ signet (0.15.0)
99
129
  addressable (~> 2.3)
100
- faraday (~> 0.9)
130
+ faraday (>= 0.17.3, < 2.0)
101
131
  jwt (>= 1.5, < 3.0)
102
132
  multi_json (~> 1.10)
103
- test-unit (3.3.3)
133
+ test-unit (3.4.4)
104
134
  power_assert
105
135
  test-unit-rr (1.0.5)
106
136
  rr (>= 1.1.1)
107
137
  test-unit (>= 2.5.2)
108
138
  thor (0.20.3)
109
- thread_safe (0.3.6)
110
- tzinfo (1.2.5)
111
- thread_safe (~> 0.1)
139
+ trailblazer-option (0.1.1)
140
+ tzinfo (2.0.4)
141
+ concurrent-ruby (~> 1.0)
112
142
  uber (0.1.0)
113
143
  unf (0.1.4)
114
144
  unf_ext
115
- unf_ext (0.0.7.6)
145
+ unf_ext (0.0.7.7)
146
+ webrick (1.7.0)
147
+ zeitwerk (2.4.2)
116
148
 
117
149
  PLATFORMS
118
- ruby
150
+ x86_64-darwin-19
119
151
 
120
152
  DEPENDENCIES
121
153
  activesupport (>= 4.0)
122
154
  ambient_iot (>= 0.1.1)
123
- bundler (~> 1.11)
155
+ bundler (~> 2.1)
156
+ dotenv
124
157
  ffi (~> 1.9.24)
125
158
  google_drive
126
159
  ladder_drive!
127
160
  pi_piper (>= 2.0.0)
128
- rake (~> 10.0)
161
+ rake (~> 13.0)
129
162
  ruby-trello
130
163
  serialport
131
164
  test-unit
132
165
  test-unit-rr
133
166
 
134
167
  BUNDLED WITH
135
- 1.17.3
168
+ 2.2.26
data/README.md CHANGED
@@ -298,6 +298,7 @@ $ ladder_drive plugin plugin_name
298
298
  |plc_mapper|Share other PLCs data with Ladder drive device.|
299
299
  |slack|Cast the data to the Slack.|
300
300
  |trello|Move the card of Trello to specified list.|
301
+ |ambient|Writing data to Ambient.|
301
302
 
302
303
 
303
304
 
data/README_jp.md CHANGED
@@ -36,8 +36,7 @@ $ cd my_project
36
36
 
37
37
  ファイルの構成は下の様になっています。
38
38
  plc以下にLadderDriveを実行するPLCプロジェクトの雛形があります。
39
- 現在はエミュレーターと三菱電機のiQ-RシリーズR08CPUのみの対応となっています。
40
- 他メーカーや他の機種は今後追加する予定です。
39
+ 現在はエミュレーターと三菱電機のiQ-RシリーズR08CPU、キーエンスKV-5000のみの対応となっています。
41
40
 
42
41
 
43
42
  ```
@@ -310,6 +309,7 @@ Ladder DriveをIoT Gateway として機能させるプラグインになりま
310
309
  |plc_mapper|複数のPLCのデータをLadder Driveのメモリーに展開します。|
311
310
  |slack|Slackにデータの変化を記録します。|
312
311
  |trello|trelloのカードを指定のリストに移動します。|
312
+ |ambient|Ambientにデータの変化を記録します。|
313
313
 
314
314
  これらの用意されているプラグインをインストールするには
315
315
 
data/ladder_drive.gemspec CHANGED
@@ -14,13 +14,16 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/ito-soft-design/ladder_drive"
15
15
  spec.license = "MIT"
16
16
 
17
- spec.add_runtime_dependency 'thor', '~> 0'
18
- spec.add_runtime_dependency 'activesupport', '~> 5.0'#, '>= 4.2.7'
19
- spec.add_runtime_dependency 'ffi', '~> 1.9.24', '>= 1.9.24'
20
- spec.add_runtime_dependency 'pi_piper', '~> 2.0', '>= 2.0.0'
21
- spec.add_runtime_dependency 'serialport'
22
- spec.add_runtime_dependency 'google_drive', '~> 3.0'
23
- spec.add_runtime_dependency 'ruby-trello', '~>2.1'
17
+ spec.add_runtime_dependency 'thor', '~> 0'
18
+ spec.add_runtime_dependency 'activesupport', '~> 6.0'
19
+ spec.add_runtime_dependency 'ffi', '~> 1.9', '>= 1.9.24'
20
+ spec.add_runtime_dependency 'pi_piper', '~> 2.0', '>= 2.0.0'
21
+
22
+ spec.add_runtime_dependency 'serialport', '~> 1.3', '>= 1.3.1'
23
+ spec.add_runtime_dependency 'ambient_iot', '~> 0.1', '>= 0.1.1'
24
+ spec.add_runtime_dependency 'google_drive', '~> 3.0', '>= 3.0.3'
25
+ spec.add_runtime_dependency 'ruby-trello', '~>2.1'
26
+ spec.add_runtime_dependency 'dotenv', '~>2.1'
24
27
 
25
28
  spec.required_ruby_version = '>= 2.3.3'
26
29
 
@@ -29,7 +32,7 @@ Gem::Specification.new do |spec|
29
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
33
  spec.require_paths = ["lib"]
31
34
 
32
- spec.add_development_dependency "bundler", "~> 1.11"
33
- spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "bundler", "~> 2.1"
36
+ spec.add_development_dependency "rake", "~> 13.0"
34
37
 
35
38
  end
@@ -54,11 +54,23 @@ module LadderDrive
54
54
  desc "plugin", "Install the specified plugin."
55
55
  def plugin(name)
56
56
  root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
57
- plugins_path = File.join(root_dir, "plugins")
58
- path = File.join(plugins_path, "#{name}_plugin.rb")
59
- if File.exist? path
57
+
58
+ # copy plugin
59
+ plugins_dir = File.join(root_dir, "plugins")
60
+ plugin_path = File.join(plugins_dir, "#{name}_plugin.rb")
61
+ if File.exist? plugin_path
60
62
  mkdir_p "plugins"
61
- cp path, "plugins/#{name}_plugin.rb"
63
+ cp plugin_path, "plugins/#{name}_plugin.rb"
64
+ end
65
+
66
+ # copy sample settings
67
+ config_dir = File.join(plugins_dir, "config")
68
+ config_path = File.join(config_dir, "#{name}.yaml.example")
69
+ if File.exist? config_path
70
+ dst_dir = "config/plugins"
71
+ mkdir_p dst_dir
72
+ dst_path = "config/plugins/#{name}.yaml.example"
73
+ cp config_path, dst_path unless File.exist? dst_path
62
74
  end
63
75
  end
64
76
 
@@ -25,6 +25,7 @@ require 'active_support/core_ext/string/inflections'
25
25
  require 'yaml'
26
26
  require 'json'
27
27
  require 'protocol/protocol'
28
+ require 'erb'
28
29
 
29
30
  include LadderDrive::Protocol::Mitsubishi
30
31
  include LadderDrive::Protocol::Keyence
@@ -46,7 +47,8 @@ module LadderDrive
46
47
  def load path
47
48
  h = {}
48
49
  if File.exist?(path)
49
- h = YAML.load(File.read(path))
50
+ erb = ERB.new File.read(path)
51
+ h = YAML.load(erb.result(binding))
50
52
  h = JSON.parse(h.to_json, symbolize_names: true)
51
53
  end
52
54
  new h || {}
@@ -49,7 +49,7 @@ module Keyence
49
49
 
50
50
  def suffixes_for_dec; SUFFIXES_FOR_DEC; end
51
51
  def suffixes_for_dec_hex; SUFFIXES_FOR_DEC_HEX; end
52
- def suffixeds_for_hex; SUFFIXES_FOR_HEX; end
52
+ def suffixes_for_hex; SUFFIXES_FOR_HEX; end
53
53
  def suffixes_for_bit; SUFFIXES_FOR_BIT; end
54
54
 
55
55
  end
@@ -124,7 +124,7 @@ module Keyence
124
124
  def receive
125
125
  res = ""
126
126
  begin
127
- Timeout.timeout(0.1) do
127
+ Timeout.timeout(TIMEOUT) do
128
128
  res = @socket.gets
129
129
  end
130
130
  rescue Timeout::Error
@@ -42,7 +42,6 @@ module Mitsubishi
42
42
  NAK = "\u0015"
43
43
 
44
44
  DELIMITER = "\r\n"
45
- TIMEOUT = 1.0
46
45
 
47
46
  def initialize options={}
48
47
  super
@@ -169,7 +169,7 @@ module Mitsubishi
169
169
  res = []
170
170
  len = 0
171
171
  begin
172
- Timeout.timeout(1.0) do
172
+ Timeout.timeout(TIMEOUT) do
173
173
  loop do
174
174
  c = @socket.read(1)
175
175
  next if c.nil? || c == ""
@@ -48,6 +48,8 @@ module Omron
48
48
  ETHERNET_CP1L = 2
49
49
  ETHERNET_CP1H = 3
50
50
 
51
+ TIMEOUT = 5.0
52
+
51
53
  def initialize options={}
52
54
  super
53
55
  @socket = nil
@@ -201,7 +203,7 @@ p e
201
203
  res = []
202
204
  len = 0
203
205
  begin
204
- Timeout.timeout(5.0) do
206
+ Timeout.timeout(TIMEOUT) do
205
207
  loop do
206
208
  c = @socket.getc
207
209
  next if c.nil? || c == ""
@@ -58,6 +58,8 @@ module Protocol
58
58
  end
59
59
  end
60
60
 
61
+ TIMEOUT = 1.0
62
+
61
63
  # abstract methods
62
64
 
63
65
  def open; end
@@ -22,5 +22,5 @@
22
22
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
 
24
24
  module LadderDrive
25
- VERSION = "0.6.4"
25
+ VERSION = "0.6.8"
26
26
  end
data/lib/ladder_drive.rb CHANGED
@@ -24,5 +24,8 @@
24
24
  dir = File.expand_path(File.dirname(__FILE__))
25
25
  $:.unshift dir unless $:.include? dir
26
26
 
27
+ require 'dotenv'
28
+ Dotenv.load
29
+
27
30
  require "plc/plc"
28
31
  require "ladder_drive/ladder_drive"