nutella_framework 0.4.5 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +14 -15
  3. data/VERSION +1 -1
  4. data/framework_components/beacon-cloud-bot/README.md +27 -0
  5. data/framework_components/beacon-cloud-bot/beacon_cloud_bot.rb +154 -0
  6. data/framework_components/beacon-cloud-bot/nutella.json +6 -0
  7. data/framework_components/beacon-cloud-bot/startup +4 -0
  8. data/framework_components/beacon-cloud-interface/LICENSE +21 -0
  9. data/framework_components/beacon-cloud-interface/Readme.md +0 -0
  10. data/framework_components/beacon-cloud-interface/bower.json +29 -0
  11. data/framework_components/beacon-cloud-interface/bower_components/bower-mqttws/.bower.json +23 -0
  12. data/framework_components/beacon-cloud-interface/bower_components/bower-mqttws/bower.json +14 -0
  13. data/framework_components/beacon-cloud-interface/bower_components/bower-mqttws/mqttws31.js +2081 -0
  14. data/framework_components/beacon-cloud-interface/bower_components/bower-mqttws/readme.md +4 -0
  15. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/.bower.json +37 -0
  16. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/LICENSE +21 -0
  17. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/README.md +15 -0
  18. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/bower.json +28 -0
  19. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/examples/browser/mqtt_client_hello_world.html +23 -0
  20. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/examples/browser/nutella_hello_world.html +52 -0
  21. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/examples/node/mqtt_client_hello_world.js +14 -0
  22. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/examples/node/nutella_hello_world.js +38 -0
  23. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/nutella_lib.js +789 -0
  24. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/package.json +30 -0
  25. data/framework_components/beacon-cloud-interface/bower_components/nutella_lib/simple-js-mqtt-client.js +428 -0
  26. data/framework_components/beacon-cloud-interface/css/animation.css +17 -0
  27. data/framework_components/beacon-cloud-interface/css/cursor.css +16 -0
  28. data/framework_components/beacon-cloud-interface/css/page_layout.css +73 -0
  29. data/framework_components/beacon-cloud-interface/index.html +157 -0
  30. data/framework_components/beacon-cloud-interface/js/lib/nutella_lib.js +4039 -0
  31. data/framework_components/beacon-cloud-interface/js/react/beacon-add.js +102 -0
  32. data/framework_components/beacon-cloud-interface/js/react/beacon-table.js +73 -0
  33. data/framework_components/beacon-cloud-interface/js/react/beacon.js +97 -0
  34. data/framework_components/beacon-cloud-interface/nutella.json +6 -0
  35. data/framework_components/example_framework_web_interface/index.html +11 -2
  36. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/.npmignore +10 -0
  37. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/.travis.yml +5 -0
  38. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/LICENSE +21 -0
  39. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/README.md +27 -0
  40. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/dist/nutella_lib.js +4039 -0
  41. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/dist/nutella_lib.js.map +1 -0
  42. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/examples/browser_hello_world.html +67 -0
  43. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/examples/node_hello_world.js +51 -0
  44. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/gulpfile.js +31 -0
  45. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/package.json +41 -0
  46. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_core.js +19 -0
  47. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_core_browser.js +17 -0
  48. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_log.js +50 -0
  49. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_net.js +279 -0
  50. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/app_persist.js +20 -0
  51. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_core_browser.js +17 -0
  52. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_log.js +50 -0
  53. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/fr_net.js +499 -0
  54. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/nutella_i.js +74 -0
  55. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/nutella_i_browser.js +130 -0
  56. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/nutella_lib.js +91 -0
  57. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/nutella_lib_browser.js +90 -0
  58. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_log.js +51 -0
  59. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js +84 -0
  60. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_persist.js +20 -0
  61. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/src/util/net.js +327 -0
  62. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/test/nutella.test.js +16 -0
  63. data/framework_components/example_framework_web_interface/node_modules/nutella_lib/test/runner.html +22 -0
  64. data/framework_components/example_framework_web_interface/package.json +15 -0
  65. data/framework_components/{order.json.example → order.json} +0 -0
  66. data/framework_components/runs_list_bot/{app_runs_list_bot.rb → runs_list_bot.rb} +9 -3
  67. data/framework_components/runs_list_bot/startup +1 -1
  68. data/lib/commands/meta/run_command.rb +21 -36
  69. data/lib/commands/start.rb +9 -199
  70. data/lib/commands/util/components_list.rb +68 -0
  71. data/lib/commands/util/components_starter.rb +169 -0
  72. data/nutella_framework.gemspec +109 -47
  73. data/nutella_lib/framework_net.rb +17 -13
  74. metadata +84 -106
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2053561c843c23949fc06095459bcaaaf3fce57a
4
- data.tar.gz: ad866dc126f6fc835b159593a559c1105ce46295
3
+ metadata.gz: 53e51e0434410cc126a0c03fcf62f3e1a5bb74f7
4
+ data.tar.gz: 6445076511b62bb27db27ac8e29f7e2b5d651fb0
5
5
  SHA512:
6
- metadata.gz: 1d8826cf38ca62a196916de32d279a2e2ce35ebf5c45f430b435c371fc023bd096cdf5c25d1924c107de52d3cfc8a564c4d701367808230b9b46e8d30f00beba
7
- data.tar.gz: 2b1389cd4fb4df14a450de083d9fe8cbc18bb049239e799a6561382cda70768d15ec2926fe042d78021f8cfe8424b153f6b19901160226dc926fc199b2d5191d
6
+ metadata.gz: 631be6578b0806ea89f4168ef984949e31b21d2279804ec6c1c7b7175029b564c6e8a52a1633b59c50dbcfa4b15810c5c930bd9acc9fa365420ecbced5d9af48
7
+ data.tar.gz: 04aa409a5cdbfdf9956cff54a24af1e774c1abb7e397eb4fe7c0dcf8577c86910398293a24fc1419af4c3b7a971df295435cc5a05063d378053db0c14fa0d9ba
data/Gemfile CHANGED
@@ -1,25 +1,24 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'semantic', '~> 1.3', '>=1.3'
4
- gem 'logging', '~> 1.8', '>=1.8.2'
5
- gem 'git', '~> 1.2', '>=1.2.8'
6
- gem 'sinatra', '~>1.4.5', '>=1.4.5'
7
- gem 'thin', '~>1.6.3', '>=1.6.3'
8
- gem 'nokogiri', '~>1.6.3', '>=1.6.3'
9
- gem 'slop', '~>4.0.0', '>=4.0.0'
10
- gem 'nutella_lib','~>0.4.6', '>=0.4.6'
3
+ gem 'semantic', '~> 1.4'
4
+ gem 'logging', '~> 1.8'
5
+ gem 'git', '~> 1.2'
6
+ gem 'sinatra', '~>1.4'
7
+ gem 'thin', '~>1.6'
8
+ gem 'nokogiri', '~>1.6'
9
+ gem 'slop', '~>4.0'
10
+ gem 'nutella_lib','~>0.4.10'
11
11
 
12
12
 
13
13
  group :development do
14
- gem 'shoulda', '~> 3', '>= 3'
15
- gem 'yard', '~> 0.8', '>= 0.8.7'
16
- gem 'rdoc', '~> 4.0', '>= 4.0'
17
- gem 'bundler', '~> 1.0', '>= 1.0'
18
- gem 'jeweler', '~> 2.0.1', '>= 2.0.1'
19
- gem 'simplecov', '~> 0', '>= 0'
14
+ gem 'shoulda', '~> 3.0'
15
+ gem 'yard', '~> 0.8'
16
+ gem 'rdoc', '~> 4.0'
17
+ gem 'bundler', '~> 1.0'
18
+ gem 'jeweler', '~> 2.0'
19
+ gem 'simplecov', '~> 0.9'
20
20
  end
21
21
 
22
22
  group :test do
23
23
  gem 'rake'
24
- gem 'fakefs', '~> 0.6.7', '>= 0.6'
25
24
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 0.4.8
@@ -0,0 +1,27 @@
1
+ # beacon-cloud-bot
2
+ This is a RoomPlaces bot, it keep tracks of information about beacons in order to decouple low level technical details with the resource name needed by RoomPlaces.
3
+
4
+ In order to interact with this bot you can use the library Nutella client library using the methods described below:
5
+
6
+ ## Publish - Subscribe channels
7
+
8
+ | Channel | Function | Direction | Content |
9
+ | ------------------------------- | -------------------------- | ----------------- | -------------------------------------------------- |
10
+ | /beacon/beacon/add | Add a new beacon | client -> server | \<beacon\> |
11
+ | /beacon/beacon/remove | Remove a beacon | client -> server | {rid: ''} |
12
+ | /beacon/beacon/added | Remove a beacon | client -> server | {beacons: [\<beacon\>*]} |
13
+ | /beacon/beacon/removed | Remove a beacon | client -> server | {beacons: [\<beacon\>*]} |
14
+
15
+
16
+
17
+ ## Request - Response channels
18
+
19
+ | Channel | Function | Request -> Response | Request | Response |
20
+ | -------------------------- | -------------------------- | ------------------- | ----------------- | ------------------------------------- |
21
+ | /beacon/beacons | Request all the beacons | client -> server | {} | {beacons: [\<beacon\>*]} |
22
+ | /beacon/uuids | Request all the uuids | client -> server | {} | {uuids: [''*]} |
23
+ | /beacon/virtual_beacon | Request new iBeacon codes | client -> server | {rid:'\<string\>} | {major: \<int\>, minor: \<int\>} | |
24
+
25
+
26
+
27
+ \<beacon\> ::= {rid: '', major: '\<number\>', minor: '\<number\>'}
@@ -0,0 +1,154 @@
1
+ require 'nutella_lib'
2
+ require 'json'
3
+
4
+ require_relative '../../lib/config/runlist'
5
+ require_relative '../../lib/config/config'
6
+ require_relative '../../nutella_lib/framework_core'
7
+
8
+ # Parse command line arguments
9
+ broker, app_id, run_id = nutella.parse_args ARGV
10
+ # Extract the component_id
11
+ component_id = nutella.extract_component_id
12
+ # Initialize nutella
13
+ nutella.f.init(Nutella.config['broker'], 'beacon-cloud-bot')
14
+
15
+ puts "Beacon cloud initialization"
16
+
17
+ # Open the resources database
18
+ beacons = nutella.f.persist.get_json_object_store("beacons")
19
+
20
+ # Contains virtual beacon codes that are created for iPads
21
+ virtualBeacons = {}
22
+ major = 0
23
+ minor = 0
24
+ uuid = '00000000-0000-0000-0000-000000000000'
25
+
26
+ # Create new beacon
27
+ nutella.f.net.subscribe("beacon/beacon/add", lambda do |message, from|
28
+ puts message
29
+ rid = message["rid"]
30
+ uuid = message["uuid"]
31
+ major = message["major"]
32
+ minor = message["minor"]
33
+
34
+ if rid != nil && uuid != nil && major != nil && minor != nil
35
+
36
+ if beacons[rid] == nil
37
+ beacons[rid] = {
38
+ :rid => rid,
39
+ :uuid => uuid,
40
+ :major => major,
41
+ :minor => minor
42
+ }
43
+
44
+ publishBeaconAdd(beacons[rid])
45
+ puts("Added beacon")
46
+ end
47
+ end
48
+ end)
49
+
50
+ # Create new beacon
51
+ nutella.f.net.subscribe("beacon/beacon/remove", lambda do |message, from|
52
+ puts message
53
+ rid = message["rid"]
54
+
55
+ if rid != nil
56
+ if beacons[rid] != nil
57
+ beacon = beacons[rid]
58
+
59
+ beacons.delete(rid)
60
+
61
+ publishBeaconRemove(beacon)
62
+ puts("Removed resource")
63
+ end
64
+ end
65
+ end)
66
+
67
+ # Publish an added beacon
68
+ def publishBeaconAdd(beacon)
69
+ puts beacon
70
+ nutella.f.net.publish("beacon/beacons/added", {:beacons => [beacon]})
71
+ nutella.f.net.publish_to_all_runs("beacon/beacons/added", {:beacons => [beacon]})
72
+ end
73
+
74
+ # Publish an remove beacon
75
+ def publishBeaconRemove(beacon)
76
+ puts beacon
77
+ nutella.f.net.publish("beacon/beacons/removed", {:beacons => [beacon]})
78
+ nutella.f.net.publish_to_all_runs("beacon/beacons/removed", {:beacons => [beacon]})
79
+ end
80
+
81
+ # Request all the beacons
82
+ nutella.f.net.handle_requests("beacon/beacons", lambda do |request, from|
83
+ puts "Send the beacon list"
84
+ beaconList = []
85
+
86
+ beacons.to_h.each do |key, beacon|
87
+ beaconList.push(beacon)
88
+ end
89
+
90
+ virtualBeacons.each do |key, beacon|
91
+ beaconList.push(beacon)
92
+ end
93
+ {:beacons => beaconList}
94
+ end)
95
+
96
+ # Request all the beacons
97
+ nutella.f.net.handle_requests_on_all_runs("beacon/beacons", lambda do |request, app_id, run_id, from|
98
+ puts "Send the beacon list"
99
+ beaconList = []
100
+
101
+ beacons.to_h.each do |key, beacon|
102
+ beaconList.push(beacon)
103
+ end
104
+
105
+ virtualBeacons.each do |key, beacon|
106
+ beaconList.push(beacon)
107
+ end
108
+ {:beacons => beaconList}
109
+ end)
110
+
111
+ # Request all the UUIDs
112
+ nutella.f.net.handle_requests_on_all_runs("beacon/uuids", lambda do |request, app_id, run_id, from|
113
+ puts "Send the uuid list"
114
+ uuidList = []
115
+ beacons.to_h.each do |key, beacon|
116
+ if !uuidList.include? beacon["uuid"]
117
+ uuidList.push(beacon["uuid"])
118
+ end
119
+ end
120
+
121
+ {:uuids => uuidList}
122
+ end)
123
+
124
+ # Request virtual beacon codes
125
+ nutella.f.net.handle_requests_on_all_runs("beacon/virtual_beacon", lambda do |request, app_id, run_id, from|
126
+ if request["rid"] != nil
127
+ rid = request["rid"]
128
+ virtualBeacon = virtualBeacons[rid]
129
+ if virtualBeacon == nil
130
+ puts "Create new virtual beacon major: #{major}, minor: #{minor}"
131
+ virtualBeacons[rid] = {
132
+ :rid => rid,
133
+ :uuid => uuid,
134
+ :major => "#{major}",
135
+ :minor => "#{minor}",
136
+ :virtual => true
137
+ }
138
+ minor += 1
139
+ if minor != minor % 65536
140
+ major += 1
141
+ end
142
+ minor = minor % 65536
143
+ virtualBeacon = virtualBeacons[rid]
144
+ publishBeaconAdd(virtualBeacon)
145
+ puts("Added virtual-beacon")
146
+ end
147
+ virtualBeacon
148
+ end
149
+ end)
150
+
151
+ puts "Beacon cloud Initialization completed"
152
+
153
+ # Just sit there waiting for messages to come
154
+ nutella.f.net.listen
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "beacon-cloud-bot",
3
+ "version": "0.0.1",
4
+ "type": "bot",
5
+ "description": "This is a RoomPlaces bot, it keep tracks of information about beacons in order to decouple low level technical details with the resource name needed by RoomPlaces"
6
+ }
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+
3
+ BASEDIR=$(dirname $0)
4
+ ruby $BASEDIR/beacon_cloud_bot.rb
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 by The Board of Trustees of the University of Illinois at Chicago
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "basic-web-interface",
3
+ "version": "0.1.0",
4
+ "authors": [
5
+ "Alessandro Gnoli <tebemis@gmail.com>"
6
+ ],
7
+ "description": "The simple possible nutella interface designed using only standard web technologies",
8
+ "main": "index.html",
9
+ "keywords": [
10
+ "nutella",
11
+ "interface",
12
+ "web"
13
+ ],
14
+ "license": "MIT",
15
+ "private": true,
16
+ "ignore": [
17
+ "**/.*",
18
+ "node_modules",
19
+ "bower_components",
20
+ "test",
21
+ "tests"
22
+ ],
23
+ "resolutions": {
24
+ "nutella_lib": "~0.2.0"
25
+ },
26
+ "dependencies": {
27
+ "nutella_lib": "~0.2.0"
28
+ }
29
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "bower-mqttws",
3
+ "version": "1.0.0",
4
+ "homepage": "http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.javascript.git/tree/src/mqttws31.js",
5
+ "authors": [
6
+ "2lemetry <m2mIO-gister@m2m.io>"
7
+ ],
8
+ "description": "Bower package for Paho Mqtt Javascript library",
9
+ "main": "mqttws31.js",
10
+ "keywords": [
11
+ "mqtt"
12
+ ],
13
+ "license": "MIT",
14
+ "_release": "1.0.0",
15
+ "_resolution": {
16
+ "type": "version",
17
+ "tag": "1.0.0",
18
+ "commit": "8da8dfea046e22580786c7b5f92d01a29f60b6dc"
19
+ },
20
+ "_source": "git://github.com/m2mIO/bower-mqttws.git",
21
+ "_target": "=1.0.0",
22
+ "_originalSource": "bower-mqttws"
23
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "bower-mqttws",
3
+ "version": "1.0.0",
4
+ "homepage": "http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.javascript.git/tree/src/mqttws31.js",
5
+ "authors": [
6
+ "2lemetry <m2mIO-gister@m2m.io>"
7
+ ],
8
+ "description": "Bower package for Paho Mqtt Javascript library",
9
+ "main": "mqttws31.js",
10
+ "keywords": [
11
+ "mqtt"
12
+ ],
13
+ "license": "MIT"
14
+ }