artoo 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +4 -3
  4. data/Gemfile +0 -12
  5. data/Gemfile.lock +12 -72
  6. data/LICENSE +1 -1
  7. data/README.md +19 -8
  8. data/artoo.gemspec +1 -0
  9. data/bin/artoo +2 -1
  10. data/examples/hello.rb +6 -3
  11. data/lib/artoo/adaptors/adaptor.rb +2 -2
  12. data/lib/artoo/api/api.rb +6 -10
  13. data/lib/artoo/api/route_helpers.rb +3 -3
  14. data/lib/artoo/commands/connect.rb +12 -4
  15. data/lib/artoo/commands/install.rb +2 -2
  16. data/lib/artoo/delegator.rb +1 -1
  17. data/lib/artoo/drivers/passthru.rb +1 -1
  18. data/lib/artoo/generators/adaptor/artoo-%adaptor_name%.gemspec.tt +1 -0
  19. data/lib/artoo/generators/adaptor/lib/artoo/drivers/%adaptor_name%.rb.tt +1 -1
  20. data/lib/artoo/robot.rb +1 -1
  21. data/lib/artoo/robot_class_methods.rb +7 -2
  22. data/lib/artoo/version.rb +1 -1
  23. metadata +38 -54
  24. data/Guardfile +0 -10
  25. data/api/assets/compass.rb +0 -25
  26. data/api/assets/javascripts/artoo/controllers/robot.js.coffee +0 -33
  27. data/api/assets/javascripts/artoo/routes.js.coffee +0 -23
  28. data/api/assets/javascripts/core.js.coffee +0 -6
  29. data/api/assets/javascripts/vendor/angular.min.js +0 -161
  30. data/api/assets/javascripts/vendor/bootstrap.min.js +0 -6
  31. data/api/assets/javascripts/vendor/jquery.min.js +0 -5
  32. data/api/assets/stylesheets/artoo/_core.css.scss +0 -3
  33. data/api/assets/stylesheets/artoo/_font-awesome.scss +0 -534
  34. data/api/assets/stylesheets/artoo/_variables.scss +0 -8
  35. data/api/assets/stylesheets/core.scss +0 -76
  36. data/api/public/core.css +0 -9856
  37. data/api/public/core.js +0 -274
  38. data/api/public/favicon.ico +0 -0
  39. data/api/public/font/FontAwesome.otf +0 -0
  40. data/api/public/font/fontawesome-webfont.eot +0 -0
  41. data/api/public/font/fontawesome-webfont.svg +0 -284
  42. data/api/public/font/fontawesome-webfont.ttf +0 -0
  43. data/api/public/font/fontawesome-webfont.woff +0 -0
  44. data/api/public/html5shiv.js +0 -8
  45. data/api/public/images/devices/ardrone.jpg +0 -0
  46. data/api/public/images/devices/arduino.jpg +0 -0
  47. data/api/public/images/devices/sphero.png +0 -0
  48. data/api/public/images/glyphicons-halflings-white.png +0 -0
  49. data/api/public/images/glyphicons-halflings.png +0 -0
  50. data/api/public/index.html +0 -36
  51. data/api/public/partials/robot-detail.html +0 -125
  52. data/api/public/partials/robot-device-detail.html +0 -0
  53. data/api/public/partials/robot-index.html +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0431129b36962326980dd7276fd60800b83920a
4
- data.tar.gz: aff806d943afefb360b34d6f4cb8eff004c432a7
3
+ metadata.gz: b4ebe09e363260cba747ed083f76143e57540c58
4
+ data.tar.gz: d34f0a457be5ed505bcb2a4a7e9b8eef5b446c47
5
5
  SHA512:
6
- metadata.gz: ce7fca914d9a2ec16eb3ff84d8c933b4860d585d86574e7019e3fc9560b658790ce286a49ebb9a292c58063b6a5007707dc411e30ab1b15b9660c352a6d03b9c
7
- data.tar.gz: aab84f30e836e8cd97ae429163374098680b38bb5424adef4687142e1caba8239ac9e359c93d7a7a0d214904e690c196bc61e2e3ac6de302f04ee5ec26e67668
6
+ metadata.gz: ea9a2047e2e5924ef8f3e06a0c2d52741adacf63a0ad5c4190963e51732377e1c1c2ee53d5eb323f2ea0fe2faf0f5e3f89a145cc8c2c33e1c26983e8118eec46
7
+ data.tar.gz: 330b5a1e92edce1edfbf66448bb85c3fd2688edf065a8612cc63a160497b8a6b2fbdf3a3e17fc11b62a237acafa60e78f6e31291fbeb4be85f38180311d97ff3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- rbx-2.0.0-rc1
1
+ ruby-2.1.0
data/.travis.yml CHANGED
@@ -1,12 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.1.0
3
4
  - 2.0.0
4
5
  - 1.9.3
5
- - jruby-1.7.4
6
- - rbx-19mode
6
+ - jruby-1.7.9
7
+ - rbx-2.1.1
7
8
  matrix:
8
9
  allow_failures:
9
- - rvm: jruby-1.7.4
10
+ - rvm: jruby-1.7.9
10
11
  branches:
11
12
  except:
12
13
  - artoo.io
data/Gemfile CHANGED
@@ -3,18 +3,6 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in artoo.gemspec
4
4
  gemspec
5
5
 
6
- # For the front end web application
7
- gem 'sass'
8
- gem 'coffee-script'
9
- gem 'sprockets'
10
- gem 'compass'
11
- gem 'bootstrap-sass'
12
- gem 'guard'
13
- gem 'guard-sprockets'
14
- gem 'guard-compass'
15
- gem 'rb-inotify', '~> 0.8.8'
16
- gem 'execjs'
17
-
18
6
  # For documentation
19
7
  gem 'yard'
20
8
  gem 'yard-sinatra'
data/Gemfile.lock CHANGED
@@ -1,94 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- artoo (1.5.0)
4
+ artoo (1.6.0)
5
5
  celluloid (~> 0.15.0)
6
6
  celluloid-io (~> 0.15.0)
7
7
  multi_json (~> 1.6)
8
8
  pry (~> 0.9)
9
9
  rake
10
10
  reel (~> 0.4.0)
11
+ robeaux (~> 0.0.3)
11
12
  thor (~> 0.18.1)
12
13
 
13
14
  GEM
14
15
  remote: http://rubygems.org/
15
16
  specs:
16
- bootstrap-sass (2.3.2.2)
17
- sass (~> 3.2)
18
17
  celluloid (0.15.2)
19
18
  timers (~> 1.1.0)
20
19
  celluloid-io (0.15.0)
21
20
  celluloid (>= 0.15.0)
22
21
  nio4r (>= 0.5.0)
23
- chunky_png (1.2.8)
24
- coderay (1.0.9)
25
- coffee-script (2.2.0)
26
- coffee-script-source
27
- execjs
28
- coffee-script-source (1.6.3)
29
- compass (0.12.2)
30
- chunky_png (~> 1.2)
31
- fssm (>= 0.2.7)
32
- sass (~> 3.1)
22
+ coderay (1.1.0)
33
23
  dotenv (0.9.0)
34
- execjs (1.4.0)
35
- multi_json (~> 1.0)
36
- ffi (1.9.0)
37
- ffi (1.9.0-java)
38
24
  foreman (0.63.0)
39
25
  dotenv (>= 0.7)
40
26
  thor (>= 0.13.6)
41
27
  foreman (0.63.0-java)
42
28
  dotenv (>= 0.7)
43
29
  thor (>= 0.13.6)
44
- formatador (0.2.4)
45
- fssm (0.2.10)
46
- guard (1.7.0)
47
- formatador (>= 0.2.4)
48
- listen (>= 0.6.0)
49
- lumberjack (>= 1.0.2)
50
- pry (>= 0.9.10)
51
- thor (>= 0.14.6)
52
- guard-compass (0.0.6)
53
- compass (>= 0.10.5)
54
- guard (>= 0.2.1)
55
- guard-sprockets (0.4.3)
56
- execjs (~> 1.0)
57
- guard (>= 1.1.0)
58
- sprockets (~> 2.0)
59
- hike (1.2.3)
60
30
  http (0.5.0)
61
31
  http_parser.rb
62
- http_parser.rb (0.6.0.beta.2)
63
- http_parser.rb (0.6.0.beta.2-java)
32
+ http_parser.rb (0.6.0)
64
33
  json (1.7.7)
65
34
  json (1.7.7-java)
66
35
  kramdown (1.2.0)
67
36
  libv8 (3.16.14.3)
68
- listen (0.7.3)
69
- lumberjack (1.0.4)
70
37
  metaclass (0.0.1)
71
38
  method_source (0.8.2)
72
39
  minitest (5.0.8)
73
40
  minitest-happy (1.0.0)
74
41
  mocha (0.14.0)
75
42
  metaclass (~> 0.0.1)
76
- multi_json (1.8.0)
77
- nio4r (0.5.0)
78
- nio4r (0.5.0-java)
79
- pry (0.9.12.2)
80
- coderay (~> 1.0.5)
43
+ multi_json (1.8.4)
44
+ nio4r (1.0.0)
45
+ pry (0.9.12.4)
46
+ coderay (~> 1.0)
81
47
  method_source (~> 0.8)
82
48
  slop (~> 3.4)
83
- pry (0.9.12.2-java)
84
- coderay (~> 1.0.5)
85
- method_source (~> 0.8)
86
- slop (~> 3.4)
87
- spoon (~> 0.0)
88
- rack (1.5.2)
89
- rake (10.1.0)
90
- rb-inotify (0.8.8)
91
- ffi (>= 0.5.0)
49
+ rake (10.1.1)
92
50
  reel (0.4.0)
93
51
  celluloid (>= 0.15.1)
94
52
  celluloid-io (>= 0.15.0)
@@ -96,15 +54,8 @@ GEM
96
54
  http_parser.rb (>= 0.6.0.beta.2)
97
55
  websocket_parser (>= 0.1.4)
98
56
  ref (1.0.5)
99
- sass (3.2.10)
100
- slop (3.4.6)
101
- spoon (0.0.4)
102
- ffi
103
- sprockets (2.10.0)
104
- hike (~> 1.2)
105
- multi_json (~> 1.0)
106
- rack (~> 1.0)
107
- tilt (~> 1.1, != 1.3.0)
57
+ robeaux (0.0.3)
58
+ slop (3.4.7)
108
59
  therubyracer (0.12.0)
109
60
  libv8 (~> 3.16.14.0)
110
61
  ref
@@ -112,9 +63,8 @@ GEM
112
63
  therubyrhino_jar (>= 1.7.3)
113
64
  therubyrhino_jar (1.7.4)
114
65
  thor (0.18.1)
115
- tilt (1.4.1)
116
66
  timers (1.1.0)
117
- websocket_parser (0.1.4)
67
+ websocket_parser (0.1.5)
118
68
  http
119
69
  yard (0.8.7.2)
120
70
  yard-sinatra (1.0.0)
@@ -126,22 +76,12 @@ PLATFORMS
126
76
 
127
77
  DEPENDENCIES
128
78
  artoo!
129
- bootstrap-sass
130
- coffee-script
131
- compass
132
- execjs
133
79
  foreman
134
- guard
135
- guard-compass
136
- guard-sprockets
137
80
  json (~> 1.7.7)
138
81
  kramdown
139
82
  minitest (~> 5.0.1)
140
83
  minitest-happy
141
84
  mocha (~> 0.14.0)
142
- rb-inotify (~> 0.8.8)
143
- sass
144
- sprockets
145
85
  therubyracer
146
86
  therubyrhino
147
87
  yard
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012, 2013 The Hybrid Group
1
+ Copyright (c) 2012-2014 The Hybrid Group
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -8,6 +8,8 @@ Artoo provides a simple, yet powerful Domain-Specific Language (DSL) for robotic
8
8
 
9
9
  Want to use JavaScript on robots? Check out our sister project Cylon.js (http://cylonjs.com)
10
10
 
11
+ Want to use the Go programming language to power your robots? Check out our sister project Gobot (http://gobot.io).
12
+
11
13
  [![Code Climate](https://codeclimate.com/github/hybridgroup/artoo.png)](https://codeclimate.com/github/hybridgroup/artoo) [![Build Status](https://travis-ci.org/hybridgroup/artoo.png?branch=master)](https://travis-ci.org/hybridgroup/artoo)
12
14
 
13
15
  ## Examples:
@@ -75,12 +77,12 @@ SPHEROS.each {|p|
75
77
  SpheroRobot.work!(robots)
76
78
  ```
77
79
 
78
- Ruby versions supported: Ruby 2.0, Ruby 1.9.3, JRuby 1.7.4, and Rubinius 2.0.
80
+ Ruby versions supported: Ruby 2.0, Ruby 1.9.3, JRuby 1.7.4+, and Rubinius 2.0+
79
81
 
80
82
  Rubinius requires 1.9 mode, to install Rubinius in 1.9 mode using rvm
81
83
 
82
84
  ```
83
- rvm get head && rvm install rbx-2.0.0 --1.9
85
+ rvm get head && rvm install rbx-2.1.1 --1.9
84
86
  ```
85
87
 
86
88
  Artoo is conceptualy influenced by [Sinatra](https://github.com/sinatra/sinatra) as well as borrowing some code from it.
@@ -99,11 +101,13 @@ Artoo has a extensible system for connecting to hardware devices. The following
99
101
  - [Crazyflie](http://www.bitcraze.se/) <=> [Adaptor](https://github.com/hybridgroup/artoo-crazyflie)
100
102
  - [Digispark](http://digistump.com/products/1) <=> [Adaptor](https://github.com/hybridgroup/artoo-digispark)
101
103
  - [Joystick](http://www.libsdl.org/) <=> [Adaptor](https://github.com/hybridgroup/artoo-joystick)
104
+ - [Keyboard](http://en.wikipedia.org/wiki/Computer_keyboard) <=> [Adaptor](https://github.com/hybridgroup/artoo-keyboard)
102
105
  - [Leap Motion](https://www.leapmotion.com/) <=> [Adaptor](https://github.com/hybridgroup/artoo-leapmotion)
103
106
  - [OpenCV](http://opencv.org/) <=> [Adaptor](https://github.com/hybridgroup/artoo-opencv)
104
107
  - [Pebble](http://getpebble.com/) <=> [Adaptor](https://github.com/hybridgroup/artoo-pebble)
105
108
  - [Raspberry Pi](http://www.raspberrypi.org/) <=> [Adaptor](https://github.com/hybridgroup/artoo-raspi)
106
109
  - [Roomba](http://www.irobot.com/us/robots/Educators/Create.aspx) <=> [Adaptor](https://github.com/hybridgroup/artoo-roomba)
110
+ - [Spark Core](http://www.spark.io/) <=> [Adaptor](https://github.com/hybridgroup/artoo-spark)
107
111
  - [Sphero](http://www.gosphero.com/) <=> [Adaptor](https://github.com/hybridgroup/artoo-sphero)
108
112
 
109
113
  More platforms are coming soon!
@@ -330,10 +334,17 @@ Need more help? Just want to say "Hello"? Come visit us on IRC freenode #artoo
330
334
 
331
335
  ## Contributing
332
336
 
333
- 1. Fork it
334
- 2. Create your feature branch (`git checkout -b my-new-feature`)
335
- 3. Commit your changes (`git commit -am 'Add some feature'`)
336
- 4. Push to the branch (`git push origin my-new-feature`)
337
- 5. Create new Pull Request
337
+ * All patches must be provided under the Apache 2.0 License
338
+ * Please use the -s option in git to "sign off" that the commit is your work and you are providing it under the Apache 2.0 License
339
+ * Submit a Github Pull Request to the appropriate branch and ideally discuss the changes with us in IRC.
340
+ * We will look at the patch, test it out, and give you feedback.
341
+ * Avoid doing minor whitespace changes, renamings, etc. along with merged content. These will be done by the maintainers from time to time but they can complicate merges and should be done seperately.
342
+ * Take care to maintain the existing coding style.
343
+ * Add unit tests for any new or changed functionality.
344
+ * All pull requests should be "fast forward"
345
+ * If there are commits after yours use “git rebase -i <new_head_branch>”
346
+ * If you have local changes you may need to use “git stash”
347
+ * For git help see [progit](http://git-scm.com/book) which is an awesome (and free) book on git
348
+
338
349
 
339
- (c) 2012-2013 The Hybrid Group
350
+ (c) 2012-2014 The Hybrid Group
data/artoo.gemspec CHANGED
@@ -27,4 +27,5 @@ Gem::Specification.new do |s|
27
27
  s.add_runtime_dependency 'rake'
28
28
  s.add_runtime_dependency 'pry', '~> 0.9'
29
29
  s.add_runtime_dependency 'thor', '~> 0.18.1'
30
+ s.add_runtime_dependency 'robeaux', '~> 0.0.3'
30
31
  end
data/bin/artoo CHANGED
@@ -14,7 +14,7 @@ Celluloid.logger = nil
14
14
  module CLI
15
15
  class Root < Thor
16
16
  include Thor::Actions
17
-
17
+
18
18
  desc 'version', 'Displays the current version'
19
19
  def version
20
20
  say Artoo::VERSION
@@ -42,6 +42,7 @@ module CLI
42
42
 
43
43
  desc "install SUBCOMMAND ...ARGS", "Installs utility programs"
44
44
  subcommand "install", Artoo::Commands::Install
45
+
45
46
  end
46
47
  end
47
48
 
data/examples/hello.rb CHANGED
@@ -2,11 +2,14 @@ require 'artoo'
2
2
 
3
3
  connection :loop
4
4
 
5
+ name "Johnny"
6
+
5
7
  work do
6
8
  every(3.seconds) do
7
- puts "hello"
9
+ puts "Hello. My name is #{name}."
8
10
  end
11
+
9
12
  after(10.seconds) do
10
- puts "wow"
13
+ puts "Wow."
11
14
  end
12
- end
15
+ end
@@ -9,7 +9,7 @@ module Artoo
9
9
  class Adaptor
10
10
  include Celluloid::IO
11
11
  finalizer :finalize
12
-
12
+
13
13
  attr_reader :parent, :port, :additional_params
14
14
 
15
15
  # Initialize an adaptor
@@ -69,7 +69,7 @@ module Artoo
69
69
  def connect_to_tcp
70
70
  @socket ||= TCPSocket.new(port.host, port.port)
71
71
  end
72
-
72
+
73
73
  # @return [UDPSocket] UDP socket connection
74
74
  def connect_to_udp
75
75
  @udp_socket ||= UDPSocket.new
data/lib/artoo/api/api.rb CHANGED
@@ -21,6 +21,10 @@ module Artoo
21
21
  def on_connection(connection)
22
22
  while request = connection.request
23
23
  dispatch!(connection, request)
24
+ if request.websocket?
25
+ connection.detach
26
+ return
27
+ end
24
28
  end
25
29
  end
26
30
 
@@ -77,7 +81,7 @@ module Artoo
77
81
  # Subscribte to robot device events
78
82
  # @return [nil]
79
83
  get_ws '/robots/:robotid/devices/:deviceid/events' do
80
- DeviceEventClient.new(@req, device(@params['robotid'], @params['deviceid']).event_topic_name('update'))
84
+ DeviceEventClient.new(@req.websocket, device(@params['robotid'], @params['deviceid']).event_topic_name('update'))
81
85
  return nil
82
86
  end
83
87
 
@@ -106,15 +110,7 @@ module Artoo
106
110
  def command_params
107
111
  if @req.body.to_s != ""
108
112
  data = MultiJson.load(@req.body.to_s, :symbolize_keys => true)
109
- if data
110
- params = []
111
- data.each {|key, value|
112
- params << value
113
- }
114
- params
115
- else
116
- nil
117
- end
113
+ data.values
118
114
  end
119
115
  end
120
116
  end
@@ -7,7 +7,7 @@ module Artoo
7
7
 
8
8
  # Path to api/public directory
9
9
  # @return [String] static path
10
- def static_path(default=File.join(File.dirname(__FILE__), "..", "..", "..","api/public"))
10
+ def static_path(default = Gem.loaded_specs['robeaux'].full_gem_path)
11
11
  @static_path ||= default
12
12
  end
13
13
 
@@ -140,10 +140,10 @@ module Artoo
140
140
  route! connection, req
141
141
  end
142
142
  if resp && !resp.nil?
143
- return if req.is_a?(Reel::WebSocket)
143
+ return if req.websocket?
144
144
  status, body = resp
145
145
  begin
146
- req.respond status, body
146
+ req.respond status, body
147
147
  rescue Errno::EAGAIN
148
148
  retry
149
149
  end
@@ -17,12 +17,12 @@ module Artoo
17
17
  when 'serial'
18
18
  run("ls /dev/tty*")
19
19
  when 'usb'
20
- run("lsusb")
20
+ run("lsusb")
21
21
  else
22
22
  say "ERROR: scan type '#{options[:type]}' not supported!"
23
23
  end
24
24
  when :macosx
25
- run("ls /dev/tty*")
25
+ run("ls /dev/tty*")
26
26
  else
27
27
  say "OS not yet supported..."
28
28
  end
@@ -48,11 +48,19 @@ module Artoo
48
48
  option :baudrate, :aliases => "-b", :default => 57600, :desc => "Baud rate to use to connect to the serial device"
49
49
  def serial(name, port)
50
50
  attempts = 1 + options[:retries].to_i
51
-
51
+
52
+ # check that Socat is installed
53
+ system("socat -V &> /dev/null")
54
+ unless $?.success?
55
+ say "Socat not installed. Cannot bind serial to TCP."
56
+ say "Please install with 'artoo install socat' and try again."
57
+ return
58
+ end
59
+
52
60
  case os
53
61
  when :linux
54
62
  run("sudo chmod a+rw /dev/#{name}")
55
-
63
+
56
64
  while(attempts > 0) do
57
65
  run("socat -d -d FILE:/dev/#{name},nonblock,raw,b#{options[:baudrate]},echo=0 TCP-LISTEN:#{port},fork")
58
66
  break unless $? == 1
@@ -6,10 +6,10 @@ module Artoo
6
6
  module Commands
7
7
  class Install < Commands
8
8
  package_name "install"
9
-
9
+
10
10
  desc "socat", "Install the socat serial to socket utility program"
11
11
  def socat
12
- case os
12
+ case os
13
13
  when :linux
14
14
  run("sudo apt-get update && sudo apt-get install socat")
15
15
  when :macosx