dietrb 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/TODO CHANGED
@@ -1,4 +1,4 @@
1
- * Make puts/print use the proper IO when used from user code
1
+ * Add specs for irb/driver/socket, and possibly for bin/dietrb
2
2
  * Configurable history file? (:HISTORY_FILE) Configurable number of saved history lines? (:SAVE_HISTORY)
3
3
  * Make sure the following formatters work: hirb, awesome_print, and looksee
4
4
  * Make sure the majority of the utils in utility_belt work
data/bin/dietrb CHANGED
@@ -7,12 +7,12 @@ IRB_CONTEXT_TOPLEVEL_ARGS = [self, TOPLEVEL_BINDING.dup]
7
7
  module IRB
8
8
  # Just a namespace so not to pollute the toplevel namespace with lvars.
9
9
  module Bin
10
+ driver = nil
11
+ ignore_irbrc = false
12
+
10
13
  unless ARGV.empty?
11
14
  require 'optparse'
12
15
 
13
- driver = nil
14
- ignore_irbrc = false
15
-
16
16
  OptionParser.new do |opt|
17
17
  bin = File.basename($0)
18
18
  opt.banner = "Usage: #{bin} [options] [programfile] [arguments]"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dietrb}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eloy Duran"]
@@ -4,6 +4,15 @@ require 'socket'
4
4
  module IRB
5
5
  module Driver
6
6
  class Socket
7
+ class << self
8
+ attr_reader :instance
9
+
10
+ def run(object, binding)
11
+ @instance = new(object, binding)
12
+ @instance.run
13
+ end
14
+ end
15
+
7
16
  # Initializes with the object and binding that each new connection will
8
17
  # get as Context. The binding is shared, so local variables will stay
9
18
  # around. The benefit of this is that a socket based irb session is most
@@ -34,11 +43,16 @@ module IRB
34
43
  end
35
44
  end
36
45
 
37
- def self.irb(object, binding = nil)
38
- unless @server
39
- @server = IRB::Driver::Socket.new(object, binding)
40
- @server.run
41
- else
42
- super
46
+ module Kernel
47
+ alias_method :irb_before_socket, :irb
48
+
49
+ def irb(object, binding = nil)
50
+ if IRB::Driver::Socket.instance.nil?
51
+ IRB::Driver::Socket.run(object, binding)
52
+ else
53
+ irb_before_socket(object, binding)
54
+ end
43
55
  end
56
+
57
+ private :irb, :irb_before_socket
44
58
  end
@@ -9,7 +9,7 @@ module IRB
9
9
  NAME = 'DietRB'
10
10
  MAJOR = 0
11
11
  MINOR = 5
12
- TINY = 0
12
+ TINY = 1
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY].join('.')
15
15
  DESCRIPTION = "#{NAME} (#{STRING})"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dietrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran