ir_b 1.0.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.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 jugyo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ ir_b
2
+ ====
3
+
4
+ irb anywhere by calling 'ir b' (need a whitespace!).
5
+
6
+ Install
7
+ ----
8
+
9
+ gem install ir_b
10
+
11
+ Usage
12
+ ----
13
+
14
+ ir b
15
+
16
+ or
17
+
18
+ ir-b
19
+
20
+ Detail
21
+ ----
22
+
23
+ * the method 'ir' is Kernel#ir and start irb session with specified binding
24
+ * the method 'b' is an alias of binding
25
+ * the method IrB.- start irb session
26
+
27
+ Copyright
28
+ ----
29
+
30
+ Copyright (c) 2010 jugyo. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "ir_b"
8
+ gem.summary = %Q{irb anywhere}
9
+ gem.description = %Q{You can do irb anywhere by calling 'ir b' (need a whitespace!).}
10
+ gem.email = "jugyo.org@gmail.com"
11
+ gem.homepage = "http://github.com/jugyo/ir_b"
12
+ gem.authors = ["jugyo"]
13
+ gem.add_development_dependency "shoulda", ">= 0"
14
+ gem.add_development_dependency "rr", ">= 0"
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/test_*.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+ task :test => :check_dependencies
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "ir_b #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
data/example1.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'ir_b'
2
+ a = 'a'
3
+ ir b
data/example2.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'ir_b'
2
+ a = 'a'
3
+ ir-b
data/lib/ir_b.rb ADDED
@@ -0,0 +1,44 @@
1
+ # coding: utf-8
2
+ require 'irb'
3
+
4
+ module IRB
5
+ def self.start_session(binding)
6
+ unless @__irb_initialized
7
+ args = ARGV.dup
8
+ ARGV.clear
9
+ IRB.setup(nil)
10
+ ARGV.replace(args)
11
+ @__irb_initialized = true
12
+ end
13
+
14
+ workspace = WorkSpace.new(binding)
15
+
16
+ irb = Irb.new(workspace)
17
+
18
+ @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
19
+ @CONF[:MAIN_CONTEXT] = irb.context
20
+
21
+ catch(:IRB_EXIT) do
22
+ irb.eval_input
23
+ end
24
+ end
25
+ end
26
+
27
+ module IrB
28
+ class << self
29
+ def -(_binding)
30
+ IRB.start_session(_binding)
31
+ end
32
+ end
33
+ end
34
+
35
+ module Kernel
36
+ alias_method :b, :binding
37
+ def ir(_binding = nil)
38
+ if _binding
39
+ IrB-_binding
40
+ else
41
+ IrB
42
+ end
43
+ end
44
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'ir_b'
8
+ require 'rr'
9
+
10
+ class Test::Unit::TestCase
11
+ include RR::Adapters::TestUnit
12
+ end
data/test/test_ir_b.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'helper'
2
+
3
+ class TestIrB < Test::Unit::TestCase
4
+ should "do ir b" do
5
+ _binding = b
6
+ mock(IRB).start_session(_binding)
7
+ ir _binding
8
+ end
9
+
10
+ should "do ir-b" do
11
+ _binding = b
12
+ mock(IRB).start_session(_binding)
13
+ ir-_binding
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ir_b
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - jugyo
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-08 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rr
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :development
45
+ version_requirements: *id002
46
+ description: You can do irb anywhere by calling 'ir b' (need a whitespace!).
47
+ email: jugyo.org@gmail.com
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - LICENSE
54
+ - README.md
55
+ files:
56
+ - .document
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ - VERSION
61
+ - example1.rb
62
+ - example2.rb
63
+ - lib/ir_b.rb
64
+ - test/helper.rb
65
+ - test/test_ir_b.rb
66
+ has_rdoc: true
67
+ homepage: http://github.com/jugyo/ir_b
68
+ licenses: []
69
+
70
+ post_install_message:
71
+ rdoc_options:
72
+ - --charset=UTF-8
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.3.7
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: irb anywhere
98
+ test_files:
99
+ - test/helper.rb
100
+ - test/test_ir_b.rb