ladder_drive 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a51d18cc531802a5947dc4e2c8bbd0f4b6f275e
4
- data.tar.gz: d629a04642bbbfbdc0a7d70b4f4660b068e66262
3
+ metadata.gz: 4f4231540625526b7fd6fbfc169a81e03b1263b9
4
+ data.tar.gz: 5564a1fcdacdfa69ac431d70f47043127d492a2b
5
5
  SHA512:
6
- metadata.gz: acc407dcefc6b258c8a6b4a22a43b33070e78a9611a7997b7df103e0ce17eff99fba377cce6911bf5ffcc139e122b8b29cadd4bad473527d34971c235a026592
7
- data.tar.gz: 8bd5531dfb0b7405b8ec4bd1e044c98aa70a6e2ffd710dbffca5b2a2fbefb1c104d1d5820c4e2d7e246328be92c302707c8ec5159b65af6e518a869be5ca2d3a
6
+ metadata.gz: ee8830bcdcea99c2dcb5f81474b5e13458a9cf075c0cbbf13762b9c4d03825a9983ba635aa5de00c4210069ca555f1897875727804ff7016d97cd8236923cd19
7
+ data.tar.gz: 5a7a21040c260cee1bf3769e1fef2507e447dfba2990586bc820dba6dbc30250c1e1f20a6c0c64e268337a794d52e24c7f62a0c28cb5931b499a2eaf934aa61b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ladder_drive (0.5.1)
4
+ ladder_drive (0.5.2)
5
5
  activesupport (~> 4.2, >= 4.2.7)
6
6
  pi_piper
7
7
  thor (~> 0)
data/NEWS ADDED
@@ -0,0 +1,7 @@
1
+ = LadderDrive 0.5.2 =
2
+
3
+ * [Raspberry Pi] Launchable as a service.
4
+ Follow these steps to run ladder drive as a service at your project directory.
5
+ $ sudo rake service:install
6
+ $ sudo rake service:enable
7
+ $ sudo rake service:start
data/README.md CHANGED
@@ -235,6 +235,17 @@ You can specify pull up or pull down and invert options for input.
235
235
  pin: 42
236
236
  ```
237
237
 
238
+ ### Run Ladder Drive as a service
239
+
240
+ Follow these steps to run ladder drive as a service at your project directory.
241
+
242
+ ```
243
+ $ sudo rake service:install
244
+ $ sudo rake service:enable
245
+ $ sudo rake service:start
246
+ ```
247
+ [![LadderDrive on Raspberry Pi](http://img.youtube.com/vi/UBhSaRNp_gM/0.jpg)](http://www.youtube.com/watch?v=UBhSaRNp_gM)
248
+
238
249
 
239
250
  # Accessing a device values
240
251
 
data/README_jp.md CHANGED
@@ -248,6 +248,18 @@ pinにGPIO番号を指定します。
248
248
  pin: 42
249
249
  ```
250
250
 
251
+ ### サービスとして Ladder Drive を起動
252
+
253
+ 電源投入でLadder Driveが起動する様にサービスとして立ち上げることができます。
254
+ Ladder Driveプロジェクのディレクトリで以下のコマンドを実行することでサービスを立ち上げることができます。
255
+
256
+ ```
257
+ $ sudo rake service:install
258
+ $ sudo rake service:enable
259
+ $ sudo rake service:start
260
+ ```
261
+
262
+ [![LadderDrive on Raspberry Pi](http://img.youtube.com/vi/UBhSaRNp_gM/0.jpg)](http://www.youtube.com/watch?v=UBhSaRNp_gM)
251
263
 
252
264
  ## PLCデバイスへのアクセスツールとしての利用
253
265
 
@@ -98,4 +98,56 @@ task :console => :upload do
98
98
  c.run
99
99
  end
100
100
 
101
+ namespace :service do
102
+
103
+ desc "Install as a service."
104
+ task :install do
105
+ # copy lddrive to current directory.
106
+ dir = Dir.pwd
107
+ root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."))
108
+ template_dir = File.join(root_dir, "template", "raspberrypi")
109
+ fname = "lddrive"
110
+ cp_r File.join(template_dir, fname), fname, verbose:false
111
+
112
+ # copy lddrive.serive file to /etc/systemd/system
113
+ fname = "lddrive.service"
114
+ s = File.read(File.join(template_dir, fname))
115
+ s.gsub!("<%= exec_start %>", "/home/pi/project/lddrive")
116
+ File.write File.join("/etc", "systemd", "system", fname), s
117
+
118
+ # reload services
119
+ system("systemctl daemon-reload")
120
+
121
+ puts "Successfuly installed lddrive serivice."
122
+ end
123
+
124
+ desc "Uninstall as a service."
125
+ task :uninstall do
126
+ path = File.join("/etc", "systemd", "system", "lddrive.service")
127
+ rm path if File.exist? path
128
+ puts "Successfuly uninstalled lddrive serivice."
129
+ end
130
+
131
+ desc "Enable a service"
132
+ task :enable do
133
+ system "systemctl enable lddrive.service"
134
+ end
135
+
136
+ desc "Disable a service"
137
+ task :disable do
138
+ system "systemctl disable lddrive.service"
139
+ end
140
+
141
+ desc "Start a service"
142
+ task :start do
143
+ system "systemctl start lddrive.service"
144
+ end
145
+
146
+ desc "Stop a service"
147
+ task :stop do
148
+ system "systemctl stop lddrive.service"
149
+ end
150
+
151
+ end
152
+
101
153
  task :default => :console
@@ -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.5.1"
25
+ VERSION = "0.5.2"
26
26
  end
@@ -41,7 +41,7 @@ module Raspberrypi
41
41
  private
42
42
 
43
43
  def setup_io
44
- @available_pi_piper = false
44
+ @available_pi_piper = true
45
45
  @io_dict = { inputs:[], outputs:[] }
46
46
  config[:io][:inputs].each do |dev, info|
47
47
  @io_dict[:inputs] << [device_by_name(dev), Pin.new(pin:info[:pin], direction: :in, pull:(info[:pull].to_sym || :off), invert:info[:invert])]
@@ -49,10 +49,10 @@ module Raspberrypi
49
49
  config[:io][:outputs].each do |dev, info|
50
50
  @io_dict[:outputs] << [device_by_name(dev), Pin.new(pin:info[:pin], direction: :out)]
51
51
  end
52
- @available_pi_piper = true
53
52
  rescue NoMethodError
54
53
  puts "WARN: defention of io is missing!"
55
54
  rescue LoadError
55
+ @available_pi_piper = false
56
56
  puts "WARN: pi_piper is not available in this system!"
57
57
  end
58
58
 
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ dir = File.dirname(__FILE__)
3
+ Dir.chdir dir do
4
+ system "rake target=raspberrypi"
5
+ end
@@ -0,0 +1,12 @@
1
+ [Unit]
2
+ Description=lddrive
3
+ Wants=network.target
4
+ Before=network.target
5
+
6
+ [Service]
7
+ Type=simple
8
+ ExecStart=<%= exec_start %>
9
+ StandardOutput=null
10
+
11
+ [Install]
12
+ WantedBy = multi-user.target
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ladder_drive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katsuyoshi Ito
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-17 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -99,6 +99,7 @@ files:
99
99
  - Gemfile
100
100
  - Gemfile.lock
101
101
  - LICENSE
102
+ - NEWS
102
103
  - README.md
103
104
  - README_jp.md
104
105
  - Rakefile
@@ -166,6 +167,8 @@ files:
166
167
  - template/ladder_drive/Rakefile
167
168
  - template/ladder_drive/asm/main.esc
168
169
  - template/ladder_drive/config/plc.yml
170
+ - template/raspberrypi/lddrive
171
+ - template/raspberrypi/lddrive.service
169
172
  homepage: https://github.com/ito-soft-design/ladder_drive
170
173
  licenses:
171
174
  - MIT