ruby_home 0.1.9 → 0.1.10

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
  SHA256:
3
- metadata.gz: 20c4e7bd6f5933ac540dd31a8812ef3bd62e2d716342caa67c76d9e3f3b6ad03
4
- data.tar.gz: 80bd7706f39dac8db197d13dbb1260958e6f7fc0578bea9094926aaa658cb487
3
+ metadata.gz: 7827557dbb63a17e05cd09dd3af1b97f7de15d7f966917ac59d9c5474cebb929
4
+ data.tar.gz: 143a09fe23eef55188ec241f0ee026656bf4a14095e430c8998fcbb07f7671b1
5
5
  SHA512:
6
- metadata.gz: 2c7d93aa8fdd09648b5ab2701b21068ee9f3b7d1b29dd441ccd969c92953a641d9068d4febe74319e63680bc5759dba7ce180c1976f42be5547ed9b64fa4e6f7
7
- data.tar.gz: 3aad8d2ae35afab38bd3a58a306c647bfb768e5d5cefb9a9bebe66f875e409ee4a5176e8ab32c3149c3f1818d469655ef93ccac8a22c1294966c5133554cde40
6
+ metadata.gz: 6de3e8a1a0bea2d14aa7ebcd98ce438daf6703fb46ef20e54e7c3440d10145d7c2891e16f9edb592cd9f6219969e3ae8638e834f4755b2fd69721458eb4db494
7
+ data.tar.gz: 3c40fde21107cc236c2a141383649e752ffd627d0f0f7fde8695eab53ab5205f970db99d755e50f50fb5d6569f99115e0e3ff5cf37109da0877a29905e25daa4
data/.travis.yml CHANGED
@@ -1,14 +1,19 @@
1
1
  cache: bundler
2
2
  language: ruby
3
+ before_install:
4
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y software-properties-common; fi
5
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php; fi
6
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi
7
+ - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libsodium-dev; fi
3
8
  install:
4
9
  - 'gem update --system'
5
10
  - 'gem --version'
6
- - 'gem install bundler -v 1.16.1'
11
+ - 'gem install bundler -v 1.17.1'
7
12
  - 'bundle --version'
8
13
  - bundle
9
14
  rvm:
10
- - 2.5.1
11
- - 2.5.0
15
+ - 2.4
16
+ - 2.5
12
17
  - ruby-head
13
18
  os:
14
19
  - linux
@@ -17,5 +22,8 @@ addons:
17
22
  apt:
18
23
  packages:
19
24
  - libavahi-compat-libdnssd-dev
25
+ homebrew:
26
+ packages:
27
+ - libsodium
20
28
  notifications:
21
29
  email: false
data/README.md CHANGED
@@ -7,6 +7,24 @@ ruby_home is an implementation of the HomeKit Accessory Protocol (HAP) to create
7
7
 
8
8
  ## Installation
9
9
 
10
+ ### libsodium
11
+
12
+ To use ruby_home, you will need to install libsodium:
13
+
14
+ https://github.com/jedisct1/libsodium
15
+
16
+ At least version `1.0.9` is required.
17
+
18
+ For OS X users, libsodium is available via homebrew and can be installed with:
19
+
20
+ brew install libsodium
21
+
22
+ For Debian users, libsodium is available both via apt:
23
+
24
+ sudo apt-get install libsodium-dev
25
+
26
+ ### ruby_home
27
+
10
28
  Add this line to your application's Gemfile:
11
29
 
12
30
  ```ruby
data/bin/ruby_home CHANGED
File without changes
@@ -1,14 +1,16 @@
1
1
  require_relative 'object_serializer'
2
+ require_relative 'uuid_helper'
2
3
 
3
4
  module RubyHome
4
5
  module HTTP
5
6
  class CharacteristicSerializer
6
7
  include ObjectSerializer
8
+ include UUIDHelper
7
9
 
8
10
  def record_hash(characteristic)
9
11
  {
10
12
  'iid' => characteristic.instance_id,
11
- 'type' => characteristic.uuid,
13
+ 'type' => uuid_short_form(characteristic.uuid),
12
14
  'perms' => perms(characteristic),
13
15
  'format' => characteristic.format,
14
16
  'description' => characteristic.description,
@@ -1,15 +1,17 @@
1
1
  require_relative 'characteristic_serializer'
2
2
  require_relative 'object_serializer'
3
+ require_relative 'uuid_helper'
3
4
 
4
5
  module RubyHome
5
6
  module HTTP
6
7
  class ServiceSerializer
7
8
  include ObjectSerializer
9
+ include UUIDHelper
8
10
 
9
11
  def record_hash(service)
10
12
  {
11
13
  'iid' => service.instance_id,
12
- 'type' => service.uuid,
14
+ 'type' => uuid_short_form(service.uuid),
13
15
  'characteristics' => CharacteristicSerializer.new(service.characteristics).serializable_hash,
14
16
  'primary' => service.primary,
15
17
  'hidden' => service.hidden,
@@ -0,0 +1,21 @@
1
+ module RubyHome
2
+ module HTTP
3
+ module UUIDHelper
4
+ APPLE_BASE_UUID = -'0000-1000-8000-0026BB765291'
5
+
6
+ def uuid_short_form(uuid)
7
+ return uuid unless apple_defined_uuid?(uuid)
8
+
9
+ trim_leading_zeros(uuid[0...8])
10
+ end
11
+
12
+ def apple_defined_uuid?(uuid)
13
+ uuid.end_with?(APPLE_BASE_UUID)
14
+ end
15
+
16
+ def trim_leading_zeros(input)
17
+ input.remove(/^0*/)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module RubyHome
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
data/lib/ruby_home.rb CHANGED
@@ -6,7 +6,7 @@ require 'hkdf'
6
6
  require 'nio'
7
7
  require 'oj'
8
8
  require 'rack'
9
- require 'rbnacl/libsodium'
9
+ require 'rbnacl'
10
10
  require 'ruby_home-srp'
11
11
  require 'securerandom'
12
12
  require 'sinatra/base'
data/rubyhome.gemspec CHANGED
@@ -30,9 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency 'dnssd', '~> 3.0'
31
31
  spec.add_dependency 'hkdf', '~> 0.3.0'
32
32
  spec.add_dependency 'nio4r', '~> 2.3', '>= 2.3.1'
33
- spec.add_dependency 'oj', '3.7.0'
34
- spec.add_dependency 'rbnacl', '~> 5.0'
35
- spec.add_dependency 'rbnacl-libsodium', '~> 1.0', '>= 1.0.16'
33
+ spec.add_dependency 'oj', '3.7.1'
34
+ spec.add_dependency 'rbnacl', '~> 6.0'
36
35
  spec.add_dependency 'ruby_home-srp', '~> 1.2'
37
36
  spec.add_dependency 'sinatra', '2.0.4'
38
37
  spec.add_dependency 'wisper', '~> 2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_home
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Entwistle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-07 00:00:00.000000000 Z
11
+ date: 2018-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -98,48 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 3.7.0
101
+ version: 3.7.1
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - '='
107
107
  - !ruby/object:Gem::Version
108
- version: 3.7.0
108
+ version: 3.7.1
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: rbnacl
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: '5.0'
115
+ version: '6.0'
116
116
  type: :runtime
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '5.0'
123
- - !ruby/object:Gem::Dependency
124
- name: rbnacl-libsodium
125
- requirement: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - "~>"
128
- - !ruby/object:Gem::Version
129
- version: '1.0'
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: 1.0.16
133
- type: :runtime
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: '1.0'
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- version: 1.0.16
122
+ version: '6.0'
143
123
  - !ruby/object:Gem::Dependency
144
124
  name: ruby_home-srp
145
125
  requirement: !ruby/object:Gem::Requirement
@@ -338,6 +318,7 @@ files:
338
318
  - lib/ruby_home/http/serializers/characteristic_value_serializer.rb
339
319
  - lib/ruby_home/http/serializers/object_serializer.rb
340
320
  - lib/ruby_home/http/serializers/service_serializer.rb
321
+ - lib/ruby_home/http/serializers/uuid_helper.rb
341
322
  - lib/ruby_home/http/services/socket_notifier.rb
342
323
  - lib/ruby_home/http/services/start_srp_service.rb
343
324
  - lib/ruby_home/http/services/verify_srp_service.rb
@@ -368,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
368
349
  version: '0'
369
350
  requirements: []
370
351
  rubyforge_project:
371
- rubygems_version: 2.7.8
352
+ rubygems_version: 2.7.6
372
353
  signing_key:
373
354
  specification_version: 4
374
355
  summary: Ruby HomeKit support