dietrb 0.1.1 → 0.1.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/bin/dietrb CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'irb'
4
-
5
- IRB::Context.new(self).run
4
+ IRB(self)
data/dietrb.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dietrb}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
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"]
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
  "lib/irb/ext/macruby.rb",
30
30
  "lib/irb/source.rb",
31
31
  "spec/context_spec.rb",
32
+ "spec/irb_spec.rb",
32
33
  "spec/source_spec.rb",
33
34
  "spec/spec_helper.rb"
34
35
  ]
@@ -40,6 +41,7 @@ Gem::Specification.new do |s|
40
41
  s.summary = %q{IRB on a diet, for MacRuby / Ruby 1.9}
41
42
  s.test_files = [
42
43
  "spec/context_spec.rb",
44
+ "spec/irb_spec.rb",
43
45
  "spec/source_spec.rb",
44
46
  "spec/spec_helper.rb"
45
47
  ]
@@ -5,11 +5,15 @@ module IRB
5
5
  alias_method :_run, :run
6
6
 
7
7
  def run
8
- Thread.new do
8
+ if NSApplication.sharedApplication.running?
9
9
  _run
10
- NSApplication.sharedApplication.terminate(self)
10
+ else
11
+ Thread.new do
12
+ _run
13
+ NSApplication.sharedApplication.terminate(self)
14
+ end
15
+ NSApplication.sharedApplication.run
11
16
  end
12
- NSApplication.sharedApplication.run
13
17
  end
14
18
  end
15
19
  end
data/lib/irb.rb CHANGED
@@ -1,6 +1,15 @@
1
1
  require 'irb/context'
2
2
  require 'irb/source'
3
3
 
4
- if defined?(RUBY_ENGINE) && RUBY_ENGINE == "macruby"
4
+ if !ENV['SPECCING'] && defined?(RUBY_ENGINE) && RUBY_ENGINE == "macruby"
5
5
  require 'irb/ext/macruby'
6
+ end
7
+
8
+ module Kernel
9
+ # Creates a new IRB::Context with the given +object+ and runs it.
10
+ def IRB(object)
11
+ IRB::Context.new(object).run
12
+ end
13
+
14
+ private :IRB
6
15
  end
data/spec/irb_spec.rb ADDED
@@ -0,0 +1,10 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe "Kernel::IRB()" do
4
+ it "creates a new context for the given object and runs it" do
5
+ Readline.stub_input("::IRBRan = self")
6
+ o = Object.new
7
+ IRB(o)
8
+ IRBRan.should == o
9
+ end
10
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'rubygems'
2
2
  require 'bacon'
3
3
 
4
+ ENV['SPECCING'] = 'true'
5
+
4
6
  ROOT = File.expand_path('../../', __FILE__)
5
7
  $:.unshift File.join(ROOT, 'lib')
6
8
 
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -33,6 +33,7 @@ files:
33
33
  - lib/irb/ext/macruby.rb
34
34
  - lib/irb/source.rb
35
35
  - spec/context_spec.rb
36
+ - spec/irb_spec.rb
36
37
  - spec/source_spec.rb
37
38
  - spec/spec_helper.rb
38
39
  has_rdoc: true
@@ -65,5 +66,6 @@ specification_version: 3
65
66
  summary: IRB on a diet, for MacRuby / Ruby 1.9
66
67
  test_files:
67
68
  - spec/context_spec.rb
69
+ - spec/irb_spec.rb
68
70
  - spec/source_spec.rb
69
71
  - spec/spec_helper.rb