Permalink
Browse files

Words

  • Loading branch information...
1 parent 1eb103a commit 78335c7810dfa238f3cf7c39def45769699214c8 @txus committed Dec 5, 2010
Showing with 25 additions and 10 deletions.
  1. +1 −1 Gemfile.lock
  2. +23 −8 Readme.md
  3. +1 −1 bin/hijacker
View
2 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- hijacker (0.1.1)
+ hijacker (0.2.0)
trollop
GEM
View
31 Readme.md
@@ -16,7 +16,9 @@ creative! :)
(See the "Extending hijacker blabla" part below to know how to write your own
handlers)
-Hijacker is tested with Ruby 1.8.7, 1.9.2, JRuby 1.5.3 and Rubinius 1.1.
+Hijacker is tested with Ruby 1.8.7, 1.9.2, and JRuby 1.5.3. Unfortunately there
+are some issues with Rubinius, mostly due to the metaprogramming stuff, which I
+will definitely look into.
##Install and configure
@@ -44,6 +46,15 @@ So you type:
And it will output the URI for this super fancy hijacker logging server.
*Remember this URI* and pass it to your configuration block!
+If you have some custom handler, you should send me a pull request! In case you
+don't want to, Hijacker automatically requires all ruby files inside these
+paths:
+
+ ./.hijacker/**/**.rb
+ ~/.hijacker/**/**.rb
+
+So you put your handlers in there and have fun! :)
+
Some options you can pass to the server command:
hijacker <handler> --port 1234 (spawn the server in port 1234 rather than 8787)
@@ -122,13 +133,13 @@ Of course, you can specify a particular server uri for a block, with #spying:
It is really easy to write your own handlers. Why don't you write one and send
me a pull request? I mean now. What are you waiting for, why are you still reading?
-Ok, maybe a bit of explanation on that. Handlers live here:
-
- lib/hijacker/handlers/your_handler.rb
+Ok, maybe a bit of explanation on that. Handlers are automatically loaded from
+here:
-They are autoloaded and automatically registered, so all you have to do is
-write them like this:
+ ./.hijacker/**/*.rb
+ ~/.hijacker/**/*.rb
+They are automatically registered, so all you have to do is write them like this:
module Hijacker
class MyHandler < Handler # Yes, you have to subclass Hijacker::Handler!
@@ -154,10 +165,14 @@ write them like this:
#
# args [{:inspect => '3', :class => 'Fixnum'},
# {:inspect => '"string"', :class => 'String'}]
+ #
+ # retval {:inspect => ':bar', :class => 'Symbol'}
+ # (note: retval will be nil if the method raised)
#
- # retval [{:inspect => ':bar', :class => 'Symbol'}]
+ # raised {:inspect => 'oops', :class => 'StandardError'}
+ # (note: raised will be nil unless the method raised, obviously)
#
- # object [{:inspect => '#<MyClass:0x003457>', :class => 'MyClass'}]
+ # object {:inspect => '#<MyClass:0x003457>', :class => 'MyClass'}
#
def handle(method, args, retval, object)
# Do what you want with these!
View
2 bin/hijacker
@@ -58,7 +58,7 @@ puts welcome.join("#{ANSI[:RESET]} ") + "\n"
# We need the uri of the service to connect a client
instructions = "Put this code in the configuration of your ruby program #{ANSI[:BOLD]}before any call to Hijacker#{ANSI[:RESET]}:\n\n"
-instructions += "\t" + "Hijacker.config do\n"
+instructions += "\t" + "Hijacker.configure do\n"
instructions += "\t" + " uri '#{DRb.uri}'\n"
instructions += "\t" + "end\n\n"
puts instructions

0 comments on commit 78335c7

Please sign in to comment.