drbirb 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ === 0.2.0 / 2010-06-04
2
+
3
+ * First release to rubygems.org.
4
+
5
+ === 0.1 / 2008-11-26
6
+
7
+ * Birthday!
@@ -0,0 +1,13 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/drbirb
6
+ bin/drbirbc
7
+ init.rb
8
+ lib/drbirb/loader.rb
9
+ lib/drbirb/server.rb
10
+ lib/drbirb/version.rb
11
+ lib/drbirbc.rb
12
+ tasks/drbirb.rake
13
+ test/test_drbirb.rb
@@ -0,0 +1,65 @@
1
+ = drbirb
2
+
3
+ * http://caldersphere.rubyforge.org/drbirb
4
+
5
+ == DESCRIPTION:
6
+
7
+ Small script/plugin to run a DRb/IRB server inside of your Ruby
8
+ application, so you can poke around while it's running.
9
+
10
+ Original code from Charles Lowe [ruby-talk:250220], I just wrapped
11
+ up into a nice package, because I think this is a cool development and
12
+ debugging tool.
13
+
14
+ [ruby-talk:250220]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/250220
15
+
16
+ == REQUIREMENTS:
17
+
18
+ * DRb, IRB (i.e., nothing above the standard library)
19
+
20
+ == SYNOPSIS:
21
+
22
+ Start the server:
23
+
24
+ require 'drbirb/loader'
25
+
26
+ # join the thread unless you have some other code that prevents the
27
+ # interpreter from exiting
28
+ Drbirb.server.thread.join
29
+
30
+ Start the client:
31
+
32
+ ruby -S drbirbc
33
+
34
+ When intalled as a Rails plugin, the server is started automatically
35
+ for you in the plugin's init.rb.
36
+
37
+ == INSTALL:
38
+
39
+ gem install drbirb
40
+ script/plugin install http://github.com/nicksieger/drbirb.git
41
+
42
+ == LICENSE:
43
+
44
+ (The MIT License)
45
+
46
+ Copyright (c) 2008-2010 Nick Sieger
47
+
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of this software and associated documentation files (the
50
+ 'Software'), to deal in the Software without restriction, including
51
+ without limitation the rights to use, copy, modify, merge, publish,
52
+ distribute, sublicense, and/or sell copies of the Software, and to
53
+ permit persons to whom the Software is furnished to do so, subject to
54
+ the following conditions:
55
+
56
+ The above copyright notice and this permission notice shall be
57
+ included in all copies or substantial portions of the Software.
58
+
59
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
60
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
61
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
62
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
63
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
64
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
65
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require 'hoe/gemcutter'
6
+ require './lib/drbirb/version.rb'
7
+
8
+ Hoe.plugin :gemcutter
9
+
10
+ hoe = Hoe.spec('drbirb') do |p|
11
+ p.rubyforge_name = "caldersphere"
12
+ p.version = Drbirb::VERSION
13
+ p.developer('Nick Sieger', 'nick@nicksieger.com')
14
+ end
15
+ hoe.spec.rdoc_options += ["-SHN", "-f", "darkfish"]
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load 'drbirb/loader.rb'
4
+ trap("INT") do
5
+ exit
6
+ end
7
+ Drbirb.server.thread.join
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load 'drbirbc.rb'
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'drbirb/loader'
@@ -0,0 +1,11 @@
1
+ require 'drbirb/version'
2
+ require 'drbirb/server'
3
+
4
+ module Drbirb
5
+ @server = DRb.start_service 'druby://127.0.0.1:7777', IRB::RemoteService.new
6
+ $stderr.puts "Drbirb version #{Drbirb::VERSION}"
7
+ $stderr.puts "* IRB::RemoteService available at #{DRb.uri.inspect}"
8
+ def self.server
9
+ @server
10
+ end
11
+ end
@@ -0,0 +1,68 @@
1
+ require 'irb'
2
+ require 'drb'
3
+
4
+ module IRB
5
+ def IRB.start_with_io_procs input_proc=nil, output_proc=nil
6
+ irb = Irb.new nil, RemoteReadlineInputMethod.new(input_proc),
7
+ RemoteOutputMethod.new(output_proc)
8
+
9
+ @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
10
+ @CONF[:MAIN_CONTEXT] = irb.context
11
+
12
+ trap("SIGINT") do
13
+ irb.signal_handle
14
+ end
15
+
16
+ catch(:IRB_EXIT) do
17
+ irb.eval_input
18
+ end
19
+ end
20
+
21
+ class RemoteReadlineInputMethod < ReadlineInputMethod
22
+ attr_accessor :callback
23
+ def initialize callback
24
+ @callback = callback
25
+ super()
26
+ end
27
+
28
+ def readline prompt, ignore
29
+ callback[prompt]
30
+ end
31
+ end
32
+
33
+ class RemoteOutputMethod < OutputMethod
34
+ attr_accessor :callback
35
+ def initialize callback
36
+ @callback = callback
37
+ super()
38
+ end
39
+
40
+ def print(*args)
41
+ callback[args * '']
42
+ end
43
+ end
44
+
45
+ class RemoteService
46
+ def initialize
47
+ # i was getting e2mmap redefinition warnings,
48
+ # so moved this out of start_with_io
49
+ IRB.setup nil
50
+ IRB.conf[:PROMPT_MODE] = :DEFAULT
51
+ end
52
+
53
+ def irb_start input_proc=nil, output_proc=nil
54
+ IRB.start_with_io_procs input_proc, output_proc
55
+ end
56
+ end
57
+
58
+ # patch a (IMO) bug in IRB - output methods are ignored?
59
+ class Irb
60
+ def print(*args)
61
+ context.instance_variable_get(:@output_method).print(*args)
62
+ end
63
+
64
+ def printf(*args)
65
+ context.instance_variable_get(:@output_method).printf(*args)
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,3 @@
1
+ module Drbirb
2
+ VERSION = '0.2.0'
3
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'irb'
4
+ require 'drb'
5
+
6
+ module IRB
7
+ def IRB.start_remote drb_uri
8
+ DRb.start_service
9
+ remote_service = DRbObject.new nil, drb_uri
10
+ input_proc = proc do |prompt|
11
+ l = Readline.readline prompt
12
+ Readline::HISTORY.push(l) if l and !l.empty?
13
+ l
14
+ end
15
+ output_proc = proc do |l|
16
+ print l
17
+ end
18
+ remote_service.irb_start input_proc, output_proc
19
+ end
20
+
21
+ def IRB.remote_url
22
+ uri = ENV['IRB_URL'] || ARGV[0]
23
+ unless uri =~ /^druby:/
24
+ uri = "druby://127.0.0.1:7777"
25
+ end
26
+ end
27
+ end
28
+
29
+ IRB.start_remote IRB.remote_url
@@ -0,0 +1,3 @@
1
+ task :drbirb do
2
+ load 'drbirbc.rb'
3
+ end
File without changes
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: drbirb
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
+ platform: ruby
11
+ authors:
12
+ - Nick Sieger
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-06-04 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rubyforge
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 0
30
+ - 4
31
+ version: 2.0.4
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: hoe
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 6
44
+ - 0
45
+ version: 2.6.0
46
+ type: :development
47
+ version_requirements: *id002
48
+ description: |-
49
+ Small script/plugin to run a DRb/IRB server inside of your Ruby
50
+ application, so you can poke around while it's running.
51
+
52
+ Original code from Charles Lowe [ruby-talk:250220], I just wrapped
53
+ up into a nice package, because I think this is a cool development and
54
+ debugging tool.
55
+
56
+ [ruby-talk:250220]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/250220
57
+ email:
58
+ - nick@nicksieger.com
59
+ executables:
60
+ - drbirb
61
+ - drbirbc
62
+ extensions: []
63
+
64
+ extra_rdoc_files:
65
+ - History.txt
66
+ - Manifest.txt
67
+ - README.txt
68
+ files:
69
+ - History.txt
70
+ - Manifest.txt
71
+ - README.txt
72
+ - Rakefile
73
+ - bin/drbirb
74
+ - bin/drbirbc
75
+ - init.rb
76
+ - lib/drbirb/loader.rb
77
+ - lib/drbirb/server.rb
78
+ - lib/drbirb/version.rb
79
+ - lib/drbirbc.rb
80
+ - tasks/drbirb.rake
81
+ - test/test_drbirb.rb
82
+ has_rdoc: true
83
+ homepage: http://caldersphere.rubyforge.org/drbirb
84
+ licenses: []
85
+
86
+ post_install_message:
87
+ rdoc_options:
88
+ - --main
89
+ - README.txt
90
+ - -SHN
91
+ - -f
92
+ - darkfish
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ segments:
107
+ - 0
108
+ version: "0"
109
+ requirements: []
110
+
111
+ rubyforge_project: caldersphere
112
+ rubygems_version: 1.3.6
113
+ signing_key:
114
+ specification_version: 3
115
+ summary: Small script/plugin to run a DRb/IRB server inside of your Ruby application, so you can poke around while it's running
116
+ test_files:
117
+ - test/test_drbirb.rb