lignite 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.travis.yml +6 -0
- data/README.md +20 -1
- data/VERSION +1 -1
- data/bin/ev3tool +24 -2
- data/lib/lignite/connection/bluetooth.rb +10 -2
- data/lignite.gemspec +3 -0
- data/spec/spec_helper.rb +1 -1
- metadata +24 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8074515f5e1914a0a56146c77bd2a6119d225e47
|
4
|
+
data.tar.gz: bdcddbb0e36882d3c6f13b1886d120777fabc301
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 021fdf25c04f71348c3a66c88d18d100e7581f649c13e45838f47e282d2c003e1f959876b6fc0c6532f8a0d9d4e12c0b1e9bce3c3c5457356ab8d15409a0a7fc
|
7
|
+
data.tar.gz: c0967937b3ce7af363bc5ee23de719989edc5b3a5f7f957bf3476f52781f2e722497decc0e96d67a1eea5db7058e9ccdcc9222af663df50677fce3dd4e02c977
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -9,6 +9,21 @@ documents at hand for reference: see the "Advanced Users – Developer Kits"
|
|
9
9
|
section of the
|
10
10
|
[Mindstorms Downloads](https://www.lego.com/en-us/mindstorms/downloads) page.
|
11
11
|
|
12
|
+
[![Gem Version][GV img]][Gem Version]
|
13
|
+
[![Build Status][BS img]][Build Status]
|
14
|
+
[![Code Climate][CC img]][Code Climate]
|
15
|
+
[![Coverage Status][CS img]][Coverage Status]
|
16
|
+
|
17
|
+
[Gem Version]: https://rubygems.org/gems/lignite
|
18
|
+
[Build Status]: https://travis-ci.org/mvidner/lignite
|
19
|
+
[Code Climate]: https://codeclimate.com/github/mvidner/lignite
|
20
|
+
[Coverage Status]: https://coveralls.io/r/mvidner/lignite
|
21
|
+
|
22
|
+
[GV img]: https://badge.fury.io/rb/lignite.png
|
23
|
+
[BS img]: https://travis-ci.org/mvidner/lignite.png
|
24
|
+
[CC img]: https://codeclimate.com/github/mvidner/lignite.png
|
25
|
+
[CS img]: https://coveralls.io/repos/mvidner/lignite/badge.png?branch=master
|
26
|
+
|
12
27
|
## Features
|
13
28
|
|
14
29
|
- Connect via USB or Bluetooth
|
@@ -29,7 +44,11 @@ Running the built-in demo program: Connect the brick with a USB cable. Run
|
|
29
44
|
sudo ev3tool run ../prjs/BrkProg_SAVE/Demo.rpf
|
30
45
|
```
|
31
46
|
|
32
|
-
|
47
|
+
> The `sudo` is needed to access the USB device.
|
48
|
+
> With udev you can configure the system to allow access to all users like this:
|
49
|
+
>
|
50
|
+
> echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0005", MODE="0666"' \
|
51
|
+
> | sudo tee /etc/udev/rules.d/99-org-rubygems-lignite-lego-ev3.rules
|
33
52
|
|
34
53
|
To connect with Bluetooth, [configure the address](data/lignite-btaddr) and
|
35
54
|
pair the device (FIXME: how; troubleshooting?)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/bin/ev3tool
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "lignite"
|
3
|
+
require "fileutils"
|
3
4
|
include Lignite::Bytes
|
4
5
|
|
5
6
|
def phandles
|
@@ -55,8 +56,29 @@ def run(name)
|
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
|
-
|
59
|
-
|
59
|
+
def assisted_connection
|
60
|
+
Lignite::Connection.create
|
61
|
+
rescue => e
|
62
|
+
fn = Lignite::Connection::Bluetooth.config_filename
|
63
|
+
$stderr.puts <<MSG
|
64
|
+
Could not connect to EV3.
|
65
|
+
Use a USB cable or configure a Bluetooth address in #{fn.inspect}.
|
66
|
+
Details:
|
67
|
+
#{e.message}
|
68
|
+
MSG
|
69
|
+
|
70
|
+
template = Lignite::Connection::Bluetooth.template_config_filename
|
71
|
+
if !File.exist?(fn) && File.exist?(template)
|
72
|
+
FileUtils.mkdir_p(File.dirname(fn))
|
73
|
+
FileUtils.install(template, fn)
|
74
|
+
$stderr.puts "(A template config file has been copied for your convenience)"
|
75
|
+
end
|
76
|
+
exit 1
|
77
|
+
end
|
78
|
+
|
79
|
+
conn = assisted_connection
|
80
|
+
$sc = Lignite::SystemCommands.new(conn)
|
81
|
+
$dc = Lignite::DirectCommands.new(conn)
|
60
82
|
|
61
83
|
case ARGV[0]
|
62
84
|
when "upload", "ul"
|
@@ -19,9 +19,17 @@ module Lignite
|
|
19
19
|
@sock.connect(sockaddr)
|
20
20
|
end
|
21
21
|
|
22
|
+
def self.config_filename
|
23
|
+
"#{ENV['HOME']}/.config/lignite-btaddr"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.template_config_filename
|
27
|
+
# TODO: also find it from a gem
|
28
|
+
File.expand_path("../../../../data/lignite-btaddr", __FILE__)
|
29
|
+
end
|
30
|
+
|
22
31
|
def address_from_file
|
23
|
-
|
24
|
-
s = File.read(fn)
|
32
|
+
s = File.read(self.class.config_filename)
|
25
33
|
s.lines.grep(/^[0-9a-fA-F]/).first.strip
|
26
34
|
end
|
27
35
|
|
data/lignite.gemspec
CHANGED
@@ -18,7 +18,9 @@ TXT
|
|
18
18
|
|
19
19
|
# ruby -e 'puts `git ls-files`.lines.map { |f| " %s,\n" % f.strip.inspect }'
|
20
20
|
s.files = [
|
21
|
+
".coveralls.yml",
|
21
22
|
".gitignore",
|
23
|
+
".travis.yml",
|
22
24
|
"COPYING",
|
23
25
|
"Gemfile",
|
24
26
|
"README.md",
|
@@ -69,6 +71,7 @@ TXT
|
|
69
71
|
|
70
72
|
s.add_development_dependency "coveralls", "~> 0"
|
71
73
|
s.add_development_dependency "simplecov", "~> 0"
|
74
|
+
s.add_development_dependency "rake", ">= 0", "< 99"
|
72
75
|
s.add_development_dependency "rspec", "~> 3"
|
73
76
|
s.add_development_dependency "yard", "~> 0"
|
74
77
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lignite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Vidner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libusb
|
@@ -52,6 +52,26 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '99'
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '99'
|
55
75
|
- !ruby/object:Gem::Dependency
|
56
76
|
name: rspec
|
57
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,7 +109,9 @@ executables:
|
|
89
109
|
extensions: []
|
90
110
|
extra_rdoc_files: []
|
91
111
|
files:
|
112
|
+
- ".coveralls.yml"
|
92
113
|
- ".gitignore"
|
114
|
+
- ".travis.yml"
|
93
115
|
- COPYING
|
94
116
|
- Gemfile
|
95
117
|
- README.md
|