ruku 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/README.rdoc +6 -5
  2. data/bin/ruku +3 -0
  3. data/lib/ruku/clients/web.rb +11 -2
  4. data/lib/ruku/clients/web/installer.rb +64 -0
  5. data/lib/ruku/clients/{web_static → web/static}/css/ruku.css +0 -0
  6. data/lib/ruku/clients/{web_static → web/static}/images/box-medium.png +0 -0
  7. data/lib/ruku/clients/{web_static → web/static}/images/box-small.png +0 -0
  8. data/lib/ruku/clients/{web_static → web/static}/images/remote/back-over.png +0 -0
  9. data/lib/ruku/clients/{web_static → web/static}/images/remote/back.png +0 -0
  10. data/lib/ruku/clients/{web_static → web/static}/images/remote/down-over.png +0 -0
  11. data/lib/ruku/clients/{web_static → web/static}/images/remote/down.png +0 -0
  12. data/lib/ruku/clients/{web_static → web/static}/images/remote/fwd-over.png +0 -0
  13. data/lib/ruku/clients/{web_static → web/static}/images/remote/fwd.png +0 -0
  14. data/lib/ruku/clients/{web_static → web/static}/images/remote/home-over.png +0 -0
  15. data/lib/ruku/clients/{web_static → web/static}/images/remote/home.png +0 -0
  16. data/lib/ruku/clients/{web_static → web/static}/images/remote/left-over.png +0 -0
  17. data/lib/ruku/clients/{web_static → web/static}/images/remote/left.png +0 -0
  18. data/lib/ruku/clients/{web_static → web/static}/images/remote/pause-over.png +0 -0
  19. data/lib/ruku/clients/{web_static → web/static}/images/remote/pause.png +0 -0
  20. data/lib/ruku/clients/{web_static → web/static}/images/remote/right-over.png +0 -0
  21. data/lib/ruku/clients/{web_static → web/static}/images/remote/right.png +0 -0
  22. data/lib/ruku/clients/{web_static → web/static}/images/remote/select-over.png +0 -0
  23. data/lib/ruku/clients/{web_static → web/static}/images/remote/select.png +0 -0
  24. data/lib/ruku/clients/{web_static → web/static}/images/remote/space1.png +0 -0
  25. data/lib/ruku/clients/{web_static → web/static}/images/remote/space2.png +0 -0
  26. data/lib/ruku/clients/{web_static → web/static}/images/remote/space3.png +0 -0
  27. data/lib/ruku/clients/{web_static → web/static}/images/remote/up-over.png +0 -0
  28. data/lib/ruku/clients/{web_static → web/static}/images/remote/up.png +0 -0
  29. data/lib/ruku/clients/{web_static → web/static}/images/spacer.gif +0 -0
  30. data/lib/ruku/clients/{web_static → web/static}/index.html +0 -0
  31. data/lib/ruku/clients/{web_static → web/static}/js/jquery-1.4.2.js +0 -0
  32. data/lib/ruku/clients/{web_static → web/static}/js/ruku.js +0 -0
  33. data/ruku.gemspec +1 -1
  34. metadata +32 -31
@@ -1,4 +1,6 @@
1
- = Ruku -- Roku™ set-top box remote control, command line and web interfaces
1
+ = Ruku
2
+
3
+ Ruku is a Roku™ set-top box remote control, with command line and web interfaces
2
4
 
3
5
  == Installation
4
6
 
@@ -80,13 +82,12 @@ Ruku is MIT licensed.
80
82
 
81
83
  :include: MIT-LICENSE
82
84
 
83
- = Other stuff
85
+ == Other stuff
84
86
 
85
87
  Author:: Aaron Royer <aaronroyer@gmail.com>
86
88
  Requires:: Ruby 1.8.6 or later
87
- License:: Copyright 2010 by Aaron Royer.
88
- Released under an MIT-style license. See the LICENSE file
89
- included in the distribution.
89
+ License:: Copyright 2010-2011 by Aaron Royer
90
+ MIT licensed - see the MIT-LICENSE file included in the distribution
90
91
 
91
92
  == Warranty
92
93
 
data/bin/ruku CHANGED
@@ -40,6 +40,9 @@ Options:
40
40
  -c, --force-roku-command Force send command to the active Roku box
41
41
  --web Fire up the web client (port 3030 default)
42
42
  -p, --port PORT Specify port (only use with --web)
43
+ --install Installs the web client to start up on login;
44
+ right now this only works on OS X (only use
45
+ with --web)
43
46
  -h, --help Show this message
44
47
  HELP
45
48
  puts help
@@ -8,15 +8,23 @@ include WEBrick
8
8
  module Ruku
9
9
  module Clients
10
10
  class Web
11
+ DEFAULT_PORT = 3030
12
+
11
13
  attr_reader :options
12
14
 
13
15
  def initialize(opts={})
14
16
  @options = OpenStruct.new(opts)
15
17
  handle_options
16
18
 
19
+ if options.install
20
+ require File.join(File.dirname(__FILE__), 'web', 'installer')
21
+ WebInstaller.install(options.port || DEFAULT_PORT)
22
+ exit
23
+ end
24
+
17
25
  server_options = {
18
- :Port => options.port || 3030,
19
- :DocumentRoot => File.join(File.dirname(__FILE__), 'web_static')
26
+ :Port => options.port || DEFAULT_PORT,
27
+ :DocumentRoot => File.join(File.dirname(__FILE__), 'web', 'static')
20
28
  }
21
29
  @server = HTTPServer.new(server_options)
22
30
 
@@ -35,6 +43,7 @@ module Ruku
35
43
  def handle_options
36
44
  OptionParser.new do |opts|
37
45
  opts.on('-p', '--port PORT') {|p| options.port = p.to_i }
46
+ opts.on('--install') { options.install = true }
38
47
  opts.on('--web') { } # ignore
39
48
  end.parse!
40
49
  end
@@ -0,0 +1,64 @@
1
+ module Ruku
2
+ module Clients
3
+ class WebInstaller
4
+ def self.install(port)
5
+ case RUBY_PLATFORM.downcase
6
+ when /darwin/
7
+ osx_install port
8
+ else
9
+ fail('Cannot install for your operating system')
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def self.fail(msg)
16
+ $stderr.puts msg
17
+ exit 1
18
+ end
19
+
20
+ def self.osx_install(port)
21
+ # TODO: make finding the executable a little more sophisticated
22
+ executable_path = (ENV['GEM_HOME'] || '/usr') + '/bin/ruku'
23
+
24
+ fail('Could not find Ruku executable') if not File.exist?(executable_path)
25
+
26
+ plist = <<PLIST
27
+ <?xml version="1.0" encoding="UTF-8"?>
28
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
29
+ <plist version="1.0">
30
+ <dict>
31
+ <key>Label</key>
32
+ <string>com.aaronroyer.ruku</string>
33
+ <key>KeepAlive</key>
34
+ <true/>
35
+ <key>ProgramArguments</key>
36
+ <array>
37
+ <string>#{executable_path}</string>
38
+ <string>--web</string>
39
+ <string>--port</string>
40
+ <string>#{port}</string>
41
+ </array>
42
+ <key>RunAtLoad</key>
43
+ <true/>
44
+ </dict>
45
+ </plist>
46
+ PLIST
47
+
48
+ plist_path= '~/Library/LaunchAgents/com.aaronroyer.ruku.plist'
49
+ expanded = File.expand_path plist_path
50
+ begin
51
+ File.open(expanded, 'w') {|f| f.puts plist }
52
+ rescue
53
+ fail "Could not write to #{expanded}"
54
+ end
55
+ $stderr.puts <<-SUCCESS
56
+ Ruku installed for launch on startup
57
+
58
+ To launch right now:
59
+ launchctl load -w #{plist_path}
60
+ SUCCESS
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ruku'
3
- s.version = '0.1'
3
+ s.version = '0.2'
4
4
  s.date = '2011-2-1'
5
5
  s.platform = Gem::Platform::RUBY
6
6
 
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruku
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aaron Royer
@@ -61,35 +61,36 @@ files:
61
61
  - bin/ruku
62
62
  - lib/ruku/clients/simple.rb
63
63
  - lib/ruku/clients/tk.rb
64
+ - lib/ruku/clients/web/installer.rb
65
+ - lib/ruku/clients/web/static/css/ruku.css
66
+ - lib/ruku/clients/web/static/images/box-medium.png
67
+ - lib/ruku/clients/web/static/images/box-small.png
68
+ - lib/ruku/clients/web/static/images/remote/back-over.png
69
+ - lib/ruku/clients/web/static/images/remote/back.png
70
+ - lib/ruku/clients/web/static/images/remote/down-over.png
71
+ - lib/ruku/clients/web/static/images/remote/down.png
72
+ - lib/ruku/clients/web/static/images/remote/fwd-over.png
73
+ - lib/ruku/clients/web/static/images/remote/fwd.png
74
+ - lib/ruku/clients/web/static/images/remote/home-over.png
75
+ - lib/ruku/clients/web/static/images/remote/home.png
76
+ - lib/ruku/clients/web/static/images/remote/left-over.png
77
+ - lib/ruku/clients/web/static/images/remote/left.png
78
+ - lib/ruku/clients/web/static/images/remote/pause-over.png
79
+ - lib/ruku/clients/web/static/images/remote/pause.png
80
+ - lib/ruku/clients/web/static/images/remote/right-over.png
81
+ - lib/ruku/clients/web/static/images/remote/right.png
82
+ - lib/ruku/clients/web/static/images/remote/select-over.png
83
+ - lib/ruku/clients/web/static/images/remote/select.png
84
+ - lib/ruku/clients/web/static/images/remote/space1.png
85
+ - lib/ruku/clients/web/static/images/remote/space2.png
86
+ - lib/ruku/clients/web/static/images/remote/space3.png
87
+ - lib/ruku/clients/web/static/images/remote/up-over.png
88
+ - lib/ruku/clients/web/static/images/remote/up.png
89
+ - lib/ruku/clients/web/static/images/spacer.gif
90
+ - lib/ruku/clients/web/static/index.html
91
+ - lib/ruku/clients/web/static/js/jquery-1.4.2.js
92
+ - lib/ruku/clients/web/static/js/ruku.js
64
93
  - lib/ruku/clients/web.rb
65
- - lib/ruku/clients/web_static/css/ruku.css
66
- - lib/ruku/clients/web_static/images/box-medium.png
67
- - lib/ruku/clients/web_static/images/box-small.png
68
- - lib/ruku/clients/web_static/images/remote/back-over.png
69
- - lib/ruku/clients/web_static/images/remote/back.png
70
- - lib/ruku/clients/web_static/images/remote/down-over.png
71
- - lib/ruku/clients/web_static/images/remote/down.png
72
- - lib/ruku/clients/web_static/images/remote/fwd-over.png
73
- - lib/ruku/clients/web_static/images/remote/fwd.png
74
- - lib/ruku/clients/web_static/images/remote/home-over.png
75
- - lib/ruku/clients/web_static/images/remote/home.png
76
- - lib/ruku/clients/web_static/images/remote/left-over.png
77
- - lib/ruku/clients/web_static/images/remote/left.png
78
- - lib/ruku/clients/web_static/images/remote/pause-over.png
79
- - lib/ruku/clients/web_static/images/remote/pause.png
80
- - lib/ruku/clients/web_static/images/remote/right-over.png
81
- - lib/ruku/clients/web_static/images/remote/right.png
82
- - lib/ruku/clients/web_static/images/remote/select-over.png
83
- - lib/ruku/clients/web_static/images/remote/select.png
84
- - lib/ruku/clients/web_static/images/remote/space1.png
85
- - lib/ruku/clients/web_static/images/remote/space2.png
86
- - lib/ruku/clients/web_static/images/remote/space3.png
87
- - lib/ruku/clients/web_static/images/remote/up-over.png
88
- - lib/ruku/clients/web_static/images/remote/up.png
89
- - lib/ruku/clients/web_static/images/spacer.gif
90
- - lib/ruku/clients/web_static/index.html
91
- - lib/ruku/clients/web_static/js/jquery-1.4.2.js
92
- - lib/ruku/clients/web_static/js/ruku.js
93
94
  - lib/ruku/remote.rb
94
95
  - lib/ruku/remotes.rb
95
96
  - lib/ruku/storage.rb