ripl-irb 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemspec +2 -2
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +15 -3
- data/deps.rip +1 -1
- data/lib/ripl/irb.rb +50 -3
- metadata +8 -8
data/.gemspec
CHANGED
@@ -9,10 +9,10 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = "gabriel.horner@gmail.com"
|
10
10
|
s.homepage = "http://github.com/cldwalker/ripl-irb"
|
11
11
|
s.summary = "A ripl plugin to smooth the transition from irb"
|
12
|
-
s.description = "A ripl plugin that smooths the transition from irb by
|
12
|
+
s.description = "A ripl plugin that smooths the transition from irb by mocking out IRB. Safely captures all IRB calls and points to ripl equivalents for irb's commands and config options."
|
13
13
|
s.required_rubygems_version = ">= 1.3.6"
|
14
14
|
s.rubyforge_project = 'tagaholic'
|
15
|
-
s.add_dependency 'ripl', '>= 0.2.
|
15
|
+
s.add_dependency 'ripl', '>= 0.2.5'
|
16
16
|
s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
|
17
17
|
s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
|
18
18
|
s.license = 'MIT'
|
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
== Description
|
2
|
-
A ripl plugin that smooths the transition from irb by
|
2
|
+
A ripl plugin that smooths the transition from irb by mocking out IRB. Safely captures all IRB calls
|
3
|
+
and points to ripl equivalents for irb's commands and config options.
|
3
4
|
|
4
5
|
== Install
|
5
6
|
Install the gem with:
|
@@ -16,5 +17,16 @@ Or add to your ~/.riplrc
|
|
16
17
|
|
17
18
|
require 'ripl/irb'
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
When your mocked out IRB encounters a ripl equivalent, it prints a message:
|
21
|
+
|
22
|
+
# When encountering a IRB.config[:HISTORY_FILE]
|
23
|
+
Use Ripl.config[:history] instead of IRB.config[:HISTORY_FILE]
|
24
|
+
|
25
|
+
When you invoke an irb command, you'll get pointed to a similar ripl command:
|
26
|
+
|
27
|
+
>> context
|
28
|
+
See config() in ripl-commands plugin
|
29
|
+
|
30
|
+
To disable printing these messages:
|
31
|
+
|
32
|
+
Ripl.config[:irb_verbose] = false
|
data/deps.rip
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ripl >=0.2.
|
1
|
+
ripl >=0.2.5
|
data/lib/ripl/irb.rb
CHANGED
@@ -1,15 +1,38 @@
|
|
1
|
+
require 'ripl'
|
2
|
+
|
1
3
|
module Ripl
|
2
4
|
module Irb
|
3
|
-
VERSION = '0.
|
5
|
+
VERSION = '0.2.0'
|
4
6
|
|
5
7
|
def before_loop
|
6
8
|
mock_irb
|
7
9
|
super
|
8
10
|
end
|
9
11
|
|
12
|
+
CONFIG_MAP = {
|
13
|
+
:PROMPT_MODE => :prompt, :PROMPT => :prompt, :HISTORY_FILE => :history,
|
14
|
+
:USE_READLINE => :readline, :AP_NAME => :name, :RC => :irbrc
|
15
|
+
}
|
16
|
+
DESC_MAP = {
|
17
|
+
:SINGLE_IRB => "jump commands in ripl-commands plugin have this enabled by default",
|
18
|
+
:IRB_RC => "Use ripl-after_rc plugin instead of IRB.conf[:IRB_RC]",
|
19
|
+
:RC_NAME_GENERATOR => "Use Ripl.config[:history] or Ripl.config[:irbrc] "+
|
20
|
+
"instead of IRB.conf[:RC_NAME_GENERATOR]",
|
21
|
+
:LOAD_MODULES => 'No need for irb or ripl to do this. Just use require :)'
|
22
|
+
}
|
23
|
+
|
10
24
|
def mock_irb
|
11
25
|
mod = Object.const_set(:IRB, Module.new).extend(MockIrb)
|
12
|
-
|
26
|
+
conf = {}
|
27
|
+
def conf.[]=(key, val)
|
28
|
+
return unless Ripl.config[:irb_verbose]
|
29
|
+
if ripl_key = CONFIG_MAP[key]
|
30
|
+
puts "Use Ripl.config[#{ripl_key.inspect}] instead of IRB.conf[#{key.inspect}]"
|
31
|
+
elsif desc = DESC_MAP[key]
|
32
|
+
puts desc
|
33
|
+
end
|
34
|
+
end
|
35
|
+
class <<mod; self end.send(:define_method, :conf) { conf }
|
13
36
|
end
|
14
37
|
|
15
38
|
module MockIrb
|
@@ -20,7 +43,31 @@ module Ripl
|
|
20
43
|
def method_missing(*)
|
21
44
|
end
|
22
45
|
end
|
46
|
+
|
47
|
+
module Commands
|
48
|
+
JUMP_COMMANDS = [:bindings, :cb, :chws, :cws, :cwws, :fg, :irb, :irb_bindings, :irb_cb,
|
49
|
+
:irb_change_binding, :irb_change_workspace, :irb_chws, :irb_current_working_binding,
|
50
|
+
:irb_current_working_workspace, :irb_cwb, :irb_cws, :irb_cwws, :irb_exit, :irb_fg,
|
51
|
+
:irb_jobs, :irb_kill, :irb_pop_binding, :irb_pop_workspace, :irb_popb, :irb_popws,
|
52
|
+
:irb_print_working_binding, :irb_print_working_workspace, :irb_push_binding,
|
53
|
+
:irb_push_workspace, :irb_pushb, :irb_pushws, :irb_pwb, :irb_pwws, :irb_workspaces, :jobs,
|
54
|
+
:kill, :popb, :popws, :pushb, :pushws, :pwws, :workspaces]
|
55
|
+
|
56
|
+
(JUMP_COMMANDS - Ripl::Commands.instance_methods.map {|e| e.to_sym }).each do |meth|
|
57
|
+
define_method(meth) do
|
58
|
+
puts "See jump() and jumps() in ripl-commands plugin" if Ripl.config[:irb_verbose]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
[:conf, :irb_context, :context].each do |meth|
|
63
|
+
define_method(meth) do
|
64
|
+
puts "See config() in ripl-commands plugin" if Ripl.config[:irb_verbose]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
23
68
|
end
|
24
69
|
end
|
25
70
|
|
26
|
-
Ripl::Shell.send :include, Ripl::Irb
|
71
|
+
Ripl::Shell.send :include, Ripl::Irb
|
72
|
+
Ripl::Commands.send :include, Ripl::Irb::Commands
|
73
|
+
Ripl.config[:irb_verbose] = true
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ripl-irb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gabriel Horner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-24 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,15 +26,15 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 29
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 2
|
33
|
-
-
|
34
|
-
version: 0.2.
|
33
|
+
- 5
|
34
|
+
version: 0.2.5
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
|
-
description: A ripl plugin that smooths the transition from irb by
|
37
|
+
description: A ripl plugin that smooths the transition from irb by mocking out IRB. Safely captures all IRB calls and points to ripl equivalents for irb's commands and config options.
|
38
38
|
email: gabriel.horner@gmail.com
|
39
39
|
executables: []
|
40
40
|
|