ruby_home 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +4 -4
  3. data/.gitignore +2 -2
  4. data/.rubocop.yml +2 -9
  5. data/.standard.yml +3 -0
  6. data/CHANGELOG.md +6 -1
  7. data/Gemfile +2 -2
  8. data/Rakefile +4 -4
  9. data/examples/air_purifier.rb +7 -8
  10. data/examples/air_quality_sensor.rb +8 -9
  11. data/examples/battery_service.rb +2 -3
  12. data/examples/carbon_dioxide_sensor.rb +2 -3
  13. data/examples/carbon_monoxide_sensor.rb +3 -4
  14. data/examples/contact_sensor.rb +2 -3
  15. data/examples/door.rb +5 -6
  16. data/examples/fan.rb +2 -3
  17. data/examples/fan_v2.rb +2 -3
  18. data/examples/garage_door_opener.rb +9 -10
  19. data/examples/heater_cooler.rb +9 -10
  20. data/examples/humidifier_dehumidifier.rb +9 -10
  21. data/examples/humidity_sensor.rb +2 -3
  22. data/examples/leak_sensor.rb +2 -3
  23. data/examples/light_sensor.rb +2 -3
  24. data/examples/lightbulb.rb +2 -3
  25. data/examples/lock_mechanism.rb +6 -7
  26. data/examples/motion_sensor.rb +2 -3
  27. data/examples/occupancy_sensor.rb +2 -3
  28. data/examples/outlet.rb +2 -3
  29. data/examples/security_system.rb +12 -13
  30. data/examples/smoke_sensor.rb +2 -3
  31. data/examples/switch.rb +2 -3
  32. data/examples/television.rb +8 -13
  33. data/examples/temperature_sensor.rb +2 -3
  34. data/examples/thermostat.rb +10 -11
  35. data/examples/window.rb +5 -6
  36. data/examples/window_covering.rb +5 -6
  37. data/lib/ruby_home.rb +21 -21
  38. data/lib/ruby_home/accessory.rb +1 -1
  39. data/lib/ruby_home/accessory_collection.rb +6 -6
  40. data/lib/ruby_home/accessory_info.rb +18 -18
  41. data/lib/ruby_home/characteristic.rb +8 -8
  42. data/lib/ruby_home/characteristic_collection.rb +13 -13
  43. data/lib/ruby_home/config/characteristics.yml +30 -635
  44. data/lib/ruby_home/config/manual_characteristics.yml +278 -0
  45. data/lib/ruby_home/config/manual_services.yml +45 -0
  46. data/lib/ruby_home/config/services.yml +329 -370
  47. data/lib/ruby_home/configuration.rb +4 -4
  48. data/lib/ruby_home/device_id.rb +3 -3
  49. data/lib/ruby_home/dns/service.rb +4 -6
  50. data/lib/ruby_home/dns/text_record.rb +9 -9
  51. data/lib/ruby_home/errors.rb +1 -0
  52. data/lib/ruby_home/factories/characteristic_factory.rb +37 -37
  53. data/lib/ruby_home/factories/service_factory.rb +72 -72
  54. data/lib/ruby_home/factories/templates/characteristic_template.rb +5 -5
  55. data/lib/ruby_home/factories/templates/service_template.rb +11 -10
  56. data/lib/ruby_home/hap/crypto/chacha20poly1305.rb +2 -2
  57. data/lib/ruby_home/hap/crypto/hkdf.rb +4 -4
  58. data/lib/ruby_home/hap/crypto/session_key.rb +7 -7
  59. data/lib/ruby_home/hap/decrypter.rb +8 -8
  60. data/lib/ruby_home/hap/encrypter.rb +5 -6
  61. data/lib/ruby_home/hap/ev_response.rb +17 -17
  62. data/lib/ruby_home/hap/hap_request.rb +1 -1
  63. data/lib/ruby_home/hap/server.rb +4 -4
  64. data/lib/ruby_home/hap/server_handler.rb +8 -10
  65. data/lib/ruby_home/hap/session.rb +22 -22
  66. data/lib/ruby_home/hap/values/base_value.rb +3 -3
  67. data/lib/ruby_home/hap/values/bool_value.rb +4 -4
  68. data/lib/ruby_home/hap/values/float_value.rb +4 -4
  69. data/lib/ruby_home/hap/values/identify_value.rb +1 -1
  70. data/lib/ruby_home/hap/values/int32_value.rb +4 -4
  71. data/lib/ruby_home/hap/values/null_value.rb +1 -1
  72. data/lib/ruby_home/hap/values/string_value.rb +11 -11
  73. data/lib/ruby_home/hap/values/uint32_value.rb +5 -5
  74. data/lib/ruby_home/hap/values/uint8_value.rb +14 -14
  75. data/lib/ruby_home/hex_helper.rb +3 -3
  76. data/lib/ruby_home/http/application.rb +7 -7
  77. data/lib/ruby_home/http/controllers/accessories_controller.rb +3 -3
  78. data/lib/ruby_home/http/controllers/application_controller.rb +6 -6
  79. data/lib/ruby_home/http/controllers/characteristics_controller.rb +29 -29
  80. data/lib/ruby_home/http/controllers/identify_controller.rb +10 -10
  81. data/lib/ruby_home/http/controllers/pair_setups_controller.rb +18 -18
  82. data/lib/ruby_home/http/controllers/pair_verifies_controller.rb +9 -9
  83. data/lib/ruby_home/http/controllers/pairings_controller.rb +5 -5
  84. data/lib/ruby_home/http/serializers/accessory_serializer.rb +5 -5
  85. data/lib/ruby_home/http/serializers/characteristic_serializer.rb +24 -24
  86. data/lib/ruby_home/http/serializers/characteristic_value_serializer.rb +5 -5
  87. data/lib/ruby_home/http/serializers/object_serializer.rb +1 -1
  88. data/lib/ruby_home/http/serializers/service_serializer.rb +9 -9
  89. data/lib/ruby_home/http/serializers/uuid_helper.rb +2 -2
  90. data/lib/ruby_home/http/services/session_notifier.rb +8 -8
  91. data/lib/ruby_home/http/services/start_srp_service.rb +3 -3
  92. data/lib/ruby_home/http/services/verify_finish_service.rb +22 -22
  93. data/lib/ruby_home/http/services/verify_srp_service.rb +22 -22
  94. data/lib/ruby_home/identifier_cache.rb +4 -5
  95. data/lib/ruby_home/password.rb +14 -14
  96. data/lib/ruby_home/persistable.rb +22 -7
  97. data/lib/ruby_home/service.rb +3 -3
  98. data/lib/ruby_home/service_collection.rb +1 -1
  99. data/lib/ruby_home/version.rb +1 -1
  100. data/rubyhome.gemspec +31 -31
  101. data/sbin/characteristic_generator.rb +22 -24
  102. data/sbin/service_generator.rb +36 -27
  103. metadata +25 -8
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  humidity_sensor = RubyHome::ServiceFactory.create(:humidity_sensor,
@@ -7,8 +7,7 @@ humidity_sensor = RubyHome::ServiceFactory.create(:humidity_sensor,
7
7
  status_low_battery: 0, # optional
8
8
  status_tampered: 0, # optional
9
9
  status_fault: 0, # optional
10
- status_active: true # optional
11
- )
10
+ status_active: true) # optional
12
11
 
13
12
  humidity_sensor.current_relative_humidity.after_update do |current_relative_humidity|
14
13
  puts "humidity sensor current relative humidity #{current_relative_humidity}"
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  leak_sensor = RubyHome::ServiceFactory.create(:leak_sensor,
@@ -7,8 +7,7 @@ leak_sensor = RubyHome::ServiceFactory.create(:leak_sensor,
7
7
  status_low_battery: 0, # optional
8
8
  status_tampered: 0, # optional
9
9
  status_fault: 0, # optional
10
- status_active: true # optional
11
- )
10
+ status_active: true) # optional
12
11
 
13
12
  leak_sensor.leak_detected.after_update do |leak_detected|
14
13
  if leak_detected == 0
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  light_sensor = RubyHome::ServiceFactory.create(:light_sensor,
@@ -7,8 +7,7 @@ light_sensor = RubyHome::ServiceFactory.create(:light_sensor,
7
7
  status_low_battery: 0, # optional
8
8
  status_tampered: 0, # optional
9
9
  status_fault: 0, # optional
10
- status_active: true # optional
11
- )
10
+ status_active: true) # optional
12
11
 
13
12
  light_sensor.current_ambient_light_level.after_update do |current_ambient_light_level|
14
13
  # maximum_value: 100000
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  lightbulb = RubyHome::ServiceFactory.create(:lightbulb,
@@ -6,8 +6,7 @@ lightbulb = RubyHome::ServiceFactory.create(:lightbulb,
6
6
  name: "lightbulb", # optional
7
7
  brightness: 100, # optional
8
8
  saturation: 100, # optional
9
- hue: 360 # optional
10
- )
9
+ hue: 360) # optional
11
10
 
12
11
  lightbulb.on.after_update do |on|
13
12
  if on
@@ -1,11 +1,10 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  lock_mechanism = RubyHome::ServiceFactory.create(:lock_mechanism,
5
5
  lock_target_state: 1, # required
6
6
  lock_current_state: 1, # required
7
- name: "lock" # optional
8
- )
7
+ name: "lock") # optional
9
8
 
10
9
  lock_mechanism.lock_target_state.after_update do |lock_target_state|
11
10
  if lock_target_state == 0
@@ -22,10 +21,10 @@ lock_mechanism.lock_target_state.after_update do |lock_target_state|
22
21
  end
23
22
 
24
23
  lock_current_state_values = {
25
- 0 => 'Unsecured',
26
- 1 => 'Secured',
27
- 2 => 'Jammed',
28
- 3 => 'Unknown'
24
+ 0 => "Unsecured",
25
+ 1 => "Secured",
26
+ 2 => "Jammed",
27
+ 3 => "Unknown"
29
28
  }
30
29
  lock_mechanism.lock_current_state.after_update do |lock_current_state|
31
30
  state = lock_current_state_values[lock_current_state]
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  motion_sensor = RubyHome::ServiceFactory.create(:motion_sensor,
@@ -7,8 +7,7 @@ motion_sensor = RubyHome::ServiceFactory.create(:motion_sensor,
7
7
  status_low_battery: 0, # optional
8
8
  status_tampered: 0, # optional
9
9
  status_fault: 0, # optional
10
- status_active: true # optional
11
- )
10
+ status_active: true) # optional
12
11
 
13
12
  motion_sensor.motion_detected.after_update do |motion_detected|
14
13
  if motion_detected
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  occupancy_sensor = RubyHome::ServiceFactory.create(:occupancy_sensor,
@@ -7,8 +7,7 @@ occupancy_sensor = RubyHome::ServiceFactory.create(:occupancy_sensor,
7
7
  status_low_battery: 0, # optional
8
8
  status_tampered: 0, # optional
9
9
  status_fault: 0, # optional
10
- status_active: true # optional
11
- )
10
+ status_active: true) # optional
12
11
 
13
12
  occupancy_sensor.occupancy_detected.after_update do |occupancy_detected|
14
13
  if occupancy_detected == 0
data/examples/outlet.rb CHANGED
@@ -1,11 +1,10 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  outlet = RubyHome::ServiceFactory.create(:outlet,
5
5
  outlet_in_use: false, # required
6
6
  on: false, # required
7
- name: "occupancy sensor", # optional
8
- )
7
+ name: "occupancy sensor") # optional
9
8
 
10
9
  outlet.outlet_in_use.after_update do |outlet_in_use|
11
10
  if outlet_in_use
@@ -1,20 +1,19 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  security_system = RubyHome::ServiceFactory.create(:security_system,
5
5
  security_system_target_state: 0, # required
6
6
  security_system_current_state: 0, # required
7
- name: 'security system', # optional
7
+ name: "security system", # optional
8
8
  security_system_alarm_type: 0, # optional
9
9
  status_tampered: 0, # optional
10
- status_fault: 0 # optional
11
- )
10
+ status_fault: 0) # optional
12
11
 
13
12
  security_system_target_state_values = {
14
- 0 => 'Stay Arm',
15
- 1 => 'Away Arm',
16
- 2 => 'Night Arm',
17
- 3 => 'Disarm'
13
+ 0 => "Stay Arm",
14
+ 1 => "Away Arm",
15
+ 2 => "Night Arm",
16
+ 3 => "Disarm"
18
17
  }
19
18
  security_system.security_system_target_state.after_update do |security_system_target_state|
20
19
  state = security_system_target_state_values[security_system_target_state]
@@ -24,11 +23,11 @@ security_system.security_system_target_state.after_update do |security_system_ta
24
23
  end
25
24
 
26
25
  security_system_current_state_values = {
27
- 0 => 'Stay Arm',
28
- 1 => 'Away Arm',
29
- 2 => 'Night Arm',
30
- 3 => 'Disarmed',
31
- 4 => 'Alarm Triggered'
26
+ 0 => "Stay Arm",
27
+ 1 => "Away Arm",
28
+ 2 => "Night Arm",
29
+ 3 => "Disarmed",
30
+ 4 => "Alarm Triggered"
32
31
  }
33
32
  security_system.security_system_current_state.after_update do |security_system_current_state|
34
33
  state = security_system_current_state_values[security_system_current_state]
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  smoke_sensor = RubyHome::ServiceFactory.create(:smoke_sensor,
@@ -7,8 +7,7 @@ smoke_sensor = RubyHome::ServiceFactory.create(:smoke_sensor,
7
7
  status_low_battery: 0, # optional
8
8
  status_tampered: 0, # optional
9
9
  status_fault: 0, # optional
10
- status_active: true # optional
11
- )
10
+ status_active: true) # optional
12
11
 
13
12
  smoke_sensor.smoke_detected.after_update do |smoke_detected|
14
13
  if smoke_detected == 0
data/examples/switch.rb CHANGED
@@ -1,10 +1,9 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  switch = RubyHome::ServiceFactory.create(:switch,
5
5
  on: false, # required
6
- name: 'switch', # optional
7
- )
6
+ name: "switch") # optional
8
7
 
9
8
  switch.on.after_update do |on|
10
9
  if on
@@ -1,31 +1,29 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  RubyHome.configure do |c|
4
- c.discovery_name = 'Television'
4
+ c.discovery_name = "Television"
5
5
  c.category_identifier = :television
6
6
  end
7
7
 
8
8
  accessory = RubyHome::Accessory.new
9
9
 
10
10
  RubyHome::ServiceFactory.create(:accessory_information,
11
- accessory: accessory, # required
12
- )
11
+ accessory: accessory) # required
13
12
 
14
13
  television = RubyHome::ServiceFactory.create(:television,
15
14
  accessory: accessory, # required
16
15
  primary: true, # required
17
- configured_name: 'Television', # required
16
+ configured_name: "Television", # required
18
17
  active: 1, # required
19
18
  active_identifier: 1, # required
20
19
  sleep_discovery_mode: 1, # required
21
20
  remote_key: nil, # required
22
- name: 'Television', # optional
21
+ name: "Television", # optional
23
22
  power_mode_selection: true, # optional
24
23
  picture_mode: 4, # optional
25
24
  target_media_state: 0, # optional
26
25
  current_media_state: 0, # optional
27
- brightness: 100 # optional
28
- )
26
+ brightness: 100) # optional
29
27
 
30
28
  television.active.after_update do |active|
31
29
  if active == 0
@@ -49,8 +47,7 @@ speaker = RubyHome::ServiceFactory.create(:television_speaker,
49
47
  name: "Television Volume", # optional
50
48
  active: 1, # optional
51
49
  volume_control_type: 1, # optional
52
- volume_selector: 0, # optional
53
- )
50
+ volume_selector: 0) # optional
54
51
  speaker.volume_selector.after_update do |volume|
55
52
  if volume == 0
56
53
  puts "television volume up"
@@ -69,9 +66,7 @@ sources = (1..4).map do |index|
69
66
  is_configured: 1, # required
70
67
  current_visibility_state: 0, # required
71
68
  identifier: index, # optional
72
- input_device_type: 1 # optional
73
-
74
- )
69
+ input_device_type: 1) # optional
75
70
  end
76
71
  television.linked = [speaker] + sources
77
72
 
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  temperature_sensor = RubyHome::ServiceFactory.create(:temperature_sensor,
@@ -7,8 +7,7 @@ temperature_sensor = RubyHome::ServiceFactory.create(:temperature_sensor,
7
7
  status_low_battery: 0, # optional
8
8
  status_tampered: 0, # optional
9
9
  status_fault: 0, # optional
10
- status_active: true # optional
11
- )
10
+ status_active: true) # optional
12
11
 
13
12
  temperature_sensor.current_temperature.after_update do |current_temperature|
14
13
  puts "temperature sensor current_temperature #{current_temperature}"
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  thermostat = RubyHome::ServiceFactory.create(:thermostat,
@@ -11,8 +11,7 @@ thermostat = RubyHome::ServiceFactory.create(:thermostat,
11
11
  heating_threshold_temperature: 20, # optional
12
12
  cooling_threshold_temperature: 10, # optional
13
13
  target_relative_humidity: 0, # optional
14
- current_relative_humidity: 0, # optional
15
- )
14
+ current_relative_humidity: 0) # optional
16
15
 
17
16
  thermostat.temperature_display_units.after_update do |temperature_display_unit|
18
17
  if temperature_display_unit == 0
@@ -47,16 +46,16 @@ thermostat.current_temperature.after_update do |current_temperature|
47
46
  end
48
47
 
49
48
  target_heating_cooling_state_values = {
50
- 0 => 'Off',
51
- 1 => 'Heat',
52
- 2 => 'Cool',
53
- 3 => 'Auto',
49
+ 0 => "Off",
50
+ 1 => "Heat",
51
+ 2 => "Cool",
52
+ 3 => "Auto"
54
53
  }
55
54
  thermostat.target_heating_cooling_state.after_update do |target_heating_cooling_state|
56
55
  state = target_heating_cooling_state_values[target_heating_cooling_state]
57
56
  puts "heater cooler target heating cooler state is #{state}"
58
57
 
59
- return if thermostat.current_heating_cooling_state == target_heating_cooling_state
58
+ return true if thermostat.current_heating_cooling_state == target_heating_cooling_state
60
59
 
61
60
  if target_heating_cooling_state == 1
62
61
  thermostat.current_heating_cooling_state = 1
@@ -68,9 +67,9 @@ thermostat.target_heating_cooling_state.after_update do |target_heating_cooling_
68
67
  end
69
68
 
70
69
  current_heating_cooling_state_values = {
71
- 0 => 'Off',
72
- 1 => 'Heat',
73
- 2 => 'Cool',
70
+ 0 => "Off",
71
+ 1 => "Heat",
72
+ 2 => "Cool"
74
73
  }
75
74
  thermostat.current_heating_cooling_state.after_update do |current_heating_cooling_state|
76
75
  state = current_heating_cooling_state_values[current_heating_cooling_state]
data/examples/window.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  window = RubyHome::ServiceFactory.create(:window,
@@ -6,8 +6,7 @@ window = RubyHome::ServiceFactory.create(:window,
6
6
  position_state: 1, # required
7
7
  current_position: 0, # required
8
8
  name: "window", # optional
9
- obstruction_detected: false, # optional
10
- )
9
+ obstruction_detected: false) # optional
11
10
 
12
11
  window.target_position.after_update do |target_position|
13
12
  puts "window target position #{target_position}"
@@ -25,9 +24,9 @@ window.target_position.after_update do |target_position|
25
24
  end
26
25
 
27
26
  position_state_values = {
28
- 0 => 'Decreasing',
29
- 1 => 'Increasing',
30
- 2 => 'Stopped'
27
+ 0 => "Decreasing",
28
+ 1 => "Increasing",
29
+ 2 => "Stopped"
31
30
  }
32
31
  window.position_state.after_update do |position_state|
33
32
  state = position_state_values[position_state]
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  window_covering = RubyHome::ServiceFactory.create(:window_covering,
@@ -10,8 +10,7 @@ window_covering = RubyHome::ServiceFactory.create(:window_covering,
10
10
  current_vertical_tilt_angle: 0, # optional
11
11
  target_vertical_tilt_angle: 0, # optional
12
12
  current_horizontal_tilt_angle: 0, # optional
13
- target_horizontal_tilt_angle: 0 # optional
14
- )
13
+ target_horizontal_tilt_angle: 0) # optional
15
14
 
16
15
  window_covering.target_position.after_update do |target_position|
17
16
  puts "window covering target position #{target_position}"
@@ -29,9 +28,9 @@ window_covering.target_position.after_update do |target_position|
29
28
  end
30
29
 
31
30
  position_state_values = {
32
- 0 => 'Decreasing',
33
- 1 => 'Increasing',
34
- 2 => 'Stopped'
31
+ 0 => "Decreasing",
32
+ 1 => "Increasing",
33
+ 2 => "Stopped"
35
34
  }
36
35
  window_covering.position_state.after_update do |position_state|
37
36
  state = position_state_values[position_state]
data/lib/ruby_home.rb CHANGED
@@ -1,25 +1,25 @@
1
- require 'dnssd'
2
- require 'facets/hash/slice'
3
- require 'hkdf'
4
- require 'oj'
5
- require 'rack'
6
- require 'rbnacl'
7
- require 'ruby_home/srp'
8
- require 'ruby_home/tlv'
9
- require 'securerandom'
10
- require 'sinatra/base'
11
- require 'socket'
12
- require 'webrick'
13
- require 'wisper'
14
- require 'yaml'
1
+ require "dnssd"
2
+ require "facets/hash/slice"
3
+ require "hkdf"
4
+ require "oj"
5
+ require "rack"
6
+ require "rbnacl"
7
+ require "ruby_home/srp"
8
+ require "ruby_home/tlv"
9
+ require "securerandom"
10
+ require "sinatra/base"
11
+ require "socket"
12
+ require "webrick"
13
+ require "wisper"
14
+ require "yaml"
15
15
 
16
16
  module RubyHome
17
17
  [
18
- '/ruby_home/hap/**/*.rb',
19
- '/ruby_home/http/**/*.rb',
20
- '/ruby_home/factories/**/*.rb',
21
- '/ruby_home/dns/**/*.rb',
22
- '/ruby_home/*.rb'
18
+ "/ruby_home/hap/**/*.rb",
19
+ "/ruby_home/http/**/*.rb",
20
+ "/ruby_home/factories/**/*.rb",
21
+ "/ruby_home/dns/**/*.rb",
22
+ "/ruby_home/*.rb"
23
23
  ].each do |pattern|
24
24
  Dir[File.dirname(__FILE__) + pattern].each { |file| require file }
25
25
  end
@@ -36,8 +36,8 @@ module RubyHome
36
36
  end
37
37
 
38
38
  def run
39
- trap 'INT' do shutdown end
40
- trap 'TERM' do shutdown end
39
+ trap("INT") { shutdown }
40
+ trap("TERM") { shutdown }
41
41
 
42
42
  greet
43
43
  start