isaac_toolbelt 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isaac_toolbelt.rb +41 -5
- data/lib/isaac_toolbelt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f3e1214f405ca714c912eb639c9f667c4213d5e
|
4
|
+
data.tar.gz: 304992c3e6f6723c91e44d08d51a4d12df5b48d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 012a3b2dbc27614acbf650a056e298d9742b38c9a977aeb464fb8b7e62461de315b027602bf0e70d0fd237239e6991101ad6886f47358d48f73b89b8fa8630dd
|
7
|
+
data.tar.gz: a01d906282a3a9f6cbf8d93118ffcd211e992bbf13cdc5be94f6bf2392da2f918cbc76e522db450054c6da2cabaffa7f74cf0c2d0e70db7b7358ae628e41a6f7
|
data/lib/isaac_toolbelt.rb
CHANGED
@@ -78,7 +78,7 @@ module IsaacToolbelt
|
|
78
78
|
DEVICE_IP_ADDRESS = '192.168.2.15'
|
79
79
|
SSH_USERNAME = 'root'
|
80
80
|
SSH_OPTIONS = '-o PreferredAuthentications=keyboard-interactive -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=1 -o ServerAliveCountMax=3'
|
81
|
-
TEMP_ROOT = '/
|
81
|
+
TEMP_ROOT = '/var/isaac/tmp'
|
82
82
|
ISAAC_CONF_PATH = '/etc/isaac.conf'
|
83
83
|
ISAAC_EDISON_IMAGE_URL='https://s3-ap-northeast-1.amazonaws.com/isaac-os-images/edison/toFlash.tar.bz2'
|
84
84
|
|
@@ -131,8 +131,9 @@ module IsaacToolbelt
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
# wait until board is booted
|
134
135
|
def waitfor(message=nil)
|
135
|
-
until system('ping -c 1 192.168.2.15 > /dev/null 2>&1') do
|
136
|
+
until system('ping -W 10 -c 1 192.168.2.15 > /dev/null 2>&1') do
|
136
137
|
puts message || 'waiting board...'
|
137
138
|
sleep 1
|
138
139
|
end
|
@@ -183,7 +184,20 @@ module IsaacToolbelt
|
|
183
184
|
def start
|
184
185
|
temp_path = self.class.temp_path
|
185
186
|
self.class.transfer_files(temp_path)
|
186
|
-
self.class.
|
187
|
+
SSHKit::Coordinator.new(self.class.host).each do
|
188
|
+
# start isaac-local
|
189
|
+
execute :systemctl, *%w(stop isaac-local)
|
190
|
+
#execute :systemctl, *%w(start isaac-local)
|
191
|
+
execute :ln, '-nfs', temp_path, '/var/isaac/development'
|
192
|
+
end
|
193
|
+
#self.class.ssh_run_command('journalctl -n 5 -f -u isaac-local')
|
194
|
+
#self.class.ssh_run_command('tail -f /var/log/isaac-local.log')
|
195
|
+
#self.class.ssh_run_command("cd #{temp_path}; " + 'honcho start')
|
196
|
+
self.class.ssh_run_command("cd /var/isaac/development; " + 'shoreman')
|
197
|
+
end
|
198
|
+
|
199
|
+
desc 'stop', 'Stop the sketch'
|
200
|
+
def stop
|
187
201
|
end
|
188
202
|
|
189
203
|
desc 'run', 'Run a command with .env on the debug mode device that connected via RNDIS'
|
@@ -296,6 +310,8 @@ module IsaacToolbelt
|
|
296
310
|
|
297
311
|
desc 'info', 'Show device status'
|
298
312
|
def info
|
313
|
+
waitfor('Please connect the board and wait for a while...')
|
314
|
+
|
299
315
|
uname = get_uname()
|
300
316
|
conf = get_conf()
|
301
317
|
|
@@ -310,6 +326,7 @@ module IsaacToolbelt
|
|
310
326
|
|
311
327
|
desc 'config:access_key ACCESS_KEY', 'Set ISAAC Access Token'
|
312
328
|
def config_access_key(access_key)
|
329
|
+
waitfor
|
313
330
|
configure_access_key(access_key)
|
314
331
|
end
|
315
332
|
map 'config:access_key' => 'config_access_key'
|
@@ -324,21 +341,32 @@ module IsaacToolbelt
|
|
324
341
|
|
325
342
|
desc 'console', 'Shell on the debug mode device that connected via RNDIS'
|
326
343
|
def console
|
344
|
+
waitfor('Please connect the board and wait for a while...')
|
327
345
|
ssh_run_command('')
|
328
346
|
end
|
329
347
|
|
330
348
|
desc 'logs', 'show logs on the device that connected via RNDIS'
|
331
349
|
def logs
|
350
|
+
waitfor('Please connect the board and wait for a while...')
|
332
351
|
ssh_run_command('journalctl -f')
|
333
352
|
end
|
334
353
|
|
335
354
|
desc 'mode', 'Set modes whether production mode or development mode.'
|
336
355
|
def mode(state)
|
356
|
+
waitfor
|
337
357
|
SSHKit::Coordinator.new(host).each do
|
338
|
-
if state == "development" then
|
358
|
+
if state == "development" then
|
359
|
+
# stop isaacd
|
339
360
|
execute :systemctl, *%w(stop isaacd)
|
340
361
|
execute :systemctl, *%w(disable isaacd)
|
362
|
+
# start isaac-local
|
363
|
+
execute :systemctl, *%w(enable isaac-local)
|
364
|
+
execute :systemctl, *%w(start isaac-local)
|
341
365
|
elsif state == "production" then
|
366
|
+
# stop isaac-local
|
367
|
+
execute :systemctl, *%w(stop isaac-local)
|
368
|
+
execute :systemctl, *%w(disable isaac-local)
|
369
|
+
# start isaacd
|
342
370
|
execute :systemctl, *%w(enable isaacd)
|
343
371
|
execute :systemctl, *%w(start isaacd)
|
344
372
|
else
|
@@ -349,6 +377,7 @@ module IsaacToolbelt
|
|
349
377
|
|
350
378
|
desc 'reboot', 'Reboot ISAAC OS'
|
351
379
|
def _reboot
|
380
|
+
waitfor
|
352
381
|
reboot
|
353
382
|
end
|
354
383
|
map 'reboot' => '_reboot'
|
@@ -547,11 +576,18 @@ module IsaacToolbelt
|
|
547
576
|
class CLI < Thor
|
548
577
|
register Local, 'local', 'local <COMMAND>', 'Run the app on local SBC'
|
549
578
|
register Device, 'device', 'device <COMMAND>', 'Configure SBC connected via USB'
|
579
|
+
|
580
|
+
map %w(-v --version) => :version
|
581
|
+
desc "version", "Show Isaac's version information"
|
582
|
+
def version
|
583
|
+
puts "Isaac toolbelt version #{VERSION}"
|
584
|
+
end
|
550
585
|
end
|
551
586
|
end
|
552
587
|
|
553
588
|
Signal.trap(:INT) {
|
554
|
-
puts
|
589
|
+
puts "Quitting..."
|
590
|
+
puts
|
555
591
|
exit 1
|
556
592
|
}
|
557
593
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isaac_toolbelt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xshell inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|