irt 1.2.5 → 1.2.6
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 +1 -1
- data/lib/irt/commands/core.rb +2 -0
- data/lib/irt/commands/help.rb +84 -83
- data/lib/irt/extensions/debugger.rb +39 -0
- data/lib/irt/extensions/kernel.rb +14 -7
- data/lib/irt.rb +7 -0
- metadata +90 -88
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.6
|
data/lib/irt/commands/core.rb
CHANGED
data/lib/irt/commands/help.rb
CHANGED
@@ -11,116 +11,117 @@ module IRT
|
|
11
11
|
- The #{IRT.dye "Extensions", :log_color, :bold} are methods available anywhere
|
12
12
|
|
13
13
|
#{label " Inspecting Commands ", :interactive_color}
|
14
|
-
irt object
|
15
|
-
vdiff|vd obj_a, obj_b
|
16
|
-
p, pp, ap, y
|
17
|
-
|
14
|
+
irt object Opens an inspecting session into object
|
15
|
+
vdiff|vd obj_a, obj_b Prints the visual diff of the yaml dump of 2 objects
|
16
|
+
p, pp, ap, y When invoked with no arguments print the last_value
|
17
|
+
(e.g. just type 'y' instead 'y _')
|
18
18
|
|
19
19
|
#{label " Log Commands ", :interactive_color}
|
20
|
-
log|l [limit]
|
21
|
-
full_log|ll
|
22
|
-
print_lines|pl
|
23
|
-
|
24
|
-
print_all_lines|pll
|
20
|
+
log|l [limit] Prints limit or 'tail_size' lines of the virtual log
|
21
|
+
full_log|ll Prints all the lines in the virtual log
|
22
|
+
print_lines|pl Prints the last lines of the current session
|
23
|
+
without numbers (for easy copying)
|
24
|
+
print_all_lines|pll Like print_line but prints all the sessions lines
|
25
25
|
|
26
26
|
#{label " In Place Editing Commands ", :interactive_color}
|
27
27
|
(<editor> can be 'vi', 'nano|nn', 'emacs|em', 'edit|ed')
|
28
|
-
<editor>
|
29
|
-
|
30
|
-
<editor> file[, line]
|
31
|
-
|
32
|
-
<editor> hash
|
33
|
-
<editor> array
|
34
|
-
<editor> traceline
|
35
|
-
|
36
|
-
|
37
|
-
<editor> n
|
38
|
-
|
28
|
+
<editor> Uses <editor> to open the current evalued file at
|
29
|
+
the current evalued line for in place edit
|
30
|
+
<editor> file[, line] Uses <editor> to open file [at line] for in place
|
31
|
+
editing
|
32
|
+
<editor> hash Uses <editor> to open hash[:file] at the hash[:line]
|
33
|
+
<editor> array Uses <editor> to open array[0] at the array[1] line
|
34
|
+
<editor> traceline Uses <editor> to open the file at line in traceline
|
35
|
+
e.g.: nn "from /path/to/file.rb:34:in 'any_method'"
|
36
|
+
nn "a_gem (1.2.3) lib/file.rb:13:in 'a_meth'"
|
37
|
+
<editor> n Uses <editor> to open the backtraced file [n] at
|
38
|
+
the backtraced line
|
39
39
|
|
40
40
|
#{label( " Copy-Edit Commands ", :interactive_color ) + IRT.dye(" (use copy_to_clipboard_command)", :interactive_color, :bold)}
|
41
|
-
copy_lines|cl
|
42
|
-
copy_all_lines|cll
|
43
|
-
c<editor>
|
41
|
+
copy_lines|cl Copies the last session lines to the clipboard
|
42
|
+
copy_all_lines|cll Copies all the sessions' lines to the clipboard
|
43
|
+
c<editor> Like `copy_lines` and <editor> in just one step
|
44
44
|
|
45
45
|
#{label(" Test Commands ", :interactive_color) + IRT.dye(" (only available in interactive sessions)", :interactive_color, :bold)}
|
46
|
-
add_desc|ad|dd desc
|
47
|
-
add_test|at|tt
|
48
|
-
|
49
|
-
|
50
|
-
add_test|at|tt desc
|
51
|
-
save_as|sa path
|
46
|
+
add_desc|ad|dd desc Adds a description for the test in the log
|
47
|
+
add_test|at|tt Adds a test in the log, checking the last value (_)
|
48
|
+
by automatically choosing the :_eql?, or :_yaml_eql?
|
49
|
+
method, depending on the type of the last value (_)
|
50
|
+
add_test|at|tt desc Like add_test but adds a 'desc' directive first'
|
51
|
+
save_as|sa path Saves the current irt file as path
|
52
52
|
|
53
53
|
#{label " FileUtils Commands ", :interactive_color}
|
54
54
|
All the FileUtils methods are availabe as IRT Commands
|
55
55
|
(e.g. pwd, touch, mkdir, mv, cp, rm, rm_rf, compare_files, ...)
|
56
56
|
|
57
57
|
#{label " Documentation Commands ", :interactive_color}
|
58
|
-
ri "string_to_search"
|
59
|
-
ri to_search
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
ri obj.any_method
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
ri n
|
69
|
-
|
70
|
-
pri ...
|
71
|
-
|
58
|
+
ri "string_to_search" Search the ri doc for the literal string_to_search
|
59
|
+
ri to_search Search the ri doc for to_search (without quote)
|
60
|
+
If to_search represents any object in your code
|
61
|
+
it looks for the obj.class documentation
|
62
|
+
e.g.: ri arr #=> (where arr=[]) ri doc for Array
|
63
|
+
ri "" #=> ri doc for String
|
64
|
+
ri obj.any_method Search the method.owner ri doc for of any_method
|
65
|
+
(no quotes needed, and completion available)
|
66
|
+
e.g.: ri "".eql? #=> ri doc for String#eql?
|
67
|
+
ri [].eql? #=> ri doc for Array#eql?
|
68
|
+
ri n Search the ri doc for the method n in a multiple
|
69
|
+
choices list
|
70
|
+
pri ... Like the above commands for `ri ...` but uses the
|
71
|
+
pager to show the result
|
72
72
|
|
73
73
|
#{label(" Rails Commands ", :interactive_color) + IRT.dye(" (only available for Rails Apps)", :interactive_color, :bold)}
|
74
|
-
rails_log_on
|
75
|
-
rlon|rlo
|
76
|
-
rails_log_off
|
77
|
-
rloff|rlf
|
74
|
+
rails_log_on Turn the rails log-in-console ON
|
75
|
+
rlon|rlo Aliases for rails_log_on
|
76
|
+
rails_log_off Turn the rails log-in-console OFF
|
77
|
+
rloff|rlf Aliases for rails_log_off
|
78
78
|
|
79
79
|
#{label " Misc Commands ", :interactive_color}
|
80
|
-
x|q
|
81
|
-
xx|qq
|
82
|
-
status|ss
|
83
|
-
run file
|
84
|
-
rerun|rr
|
85
|
-
|
86
|
-
restart|rs
|
87
|
-
|
88
|
-
irt_help|hh
|
89
|
-
sh command
|
90
|
-
pager|pg string|block
|
91
|
-
|
80
|
+
x|q Aliases for exit (from the current session)
|
81
|
+
xx|qq Aliases for abort (abort the irt process)
|
82
|
+
status|ss Prints the session status line
|
83
|
+
run file Run an irt file (exiting from the current sessions)
|
84
|
+
rerun|rr Reruns the current irt file (exiting from the
|
85
|
+
current sessions)
|
86
|
+
restart|rs Restart the executable, reload IRT (and Rails) and
|
87
|
+
rerun the current file
|
88
|
+
irt_help|hh Shows this screen
|
89
|
+
sh command Alias for system("command") (no quotes needed)
|
90
|
+
pager|pg string|block Uses the pager to show a long string or executes
|
91
|
+
block and shows its captured stdout
|
92
92
|
|
93
93
|
#{label " Session Directives ", :file_color}
|
94
|
-
irt
|
95
|
-
|
96
|
-
irt binding
|
94
|
+
irt Opens an interactive session which retains the
|
95
|
+
current variables and the last value (_)
|
96
|
+
irt binding Opens a binding session at the line of the call
|
97
97
|
|
98
98
|
#{label(" Test Directives ", :file_color) + IRT.dye(" (auto added by the Test Commands)", :file_color, :bold)}
|
99
|
-
desc description
|
100
|
-
_eql? val
|
101
|
-
_yaml_eql? yaml_dump
|
99
|
+
desc description Adds a description to the next test
|
100
|
+
_eql? val Runs a test checking _ == val
|
101
|
+
_yaml_eql? yaml_dump Runs a test checking y _ == yaml_dump
|
102
102
|
|
103
103
|
#{label " Helper Directives ", :file_color}
|
104
|
-
insert_file file
|
105
|
-
eval_file
|
106
|
-
irt_at_exit block
|
107
|
-
|
104
|
+
insert_file file Evaluates file as it were inserted at that line
|
105
|
+
eval_file Alias for eval_file
|
106
|
+
irt_at_exit block Ensures execution of block at exit (useful for
|
107
|
+
cleanup of test env)
|
108
108
|
|
109
109
|
#{label " Extensions ", :log_color}
|
110
|
-
Kernel#capture
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
110
|
+
Kernel#capture stream {} Executes block and returns a string containing the
|
111
|
+
captured str(eam).
|
112
|
+
Kernel#silence stream {} Alias for capture
|
113
|
+
Object#own_methods Returns the methods implemented by the receiver
|
114
|
+
itself (not inherited)
|
115
|
+
Object#<editor> (<editor> can be 'vi', 'nano|nn', 'emacs|em')
|
116
|
+
Yaml-dump the object in a tmp.yml file and opens it
|
117
|
+
with <editor>. After your editing and save returns
|
118
|
+
the evaluated yaml file
|
119
|
+
e.g.: {:a => 2}.vi #=> {:an_edited => 'value'}
|
120
|
+
Method#location When possible, it returns file and line where the
|
121
|
+
method is defined. It is suitable to be passed to
|
122
|
+
the in place editing commands.
|
123
|
+
Method#info Returns useful info about the method. It is suitable
|
124
|
+
to be passed to the in place editing commands.
|
124
125
|
)
|
125
126
|
end
|
126
127
|
alias_method :hh, :irt_help
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module IRB
|
2
|
+
|
3
|
+
def self.start_session(bind)
|
4
|
+
IRT.start
|
5
|
+
IRT::Session.enter :binding, bind
|
6
|
+
end
|
7
|
+
|
8
|
+
class Context
|
9
|
+
alias_method :evaluate_without_debugger, :evaluate
|
10
|
+
def evaluate(line, line_no)
|
11
|
+
$rdebug_irb_statements = line
|
12
|
+
evaluate_without_debugger line, line_no
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
module Kernel
|
19
|
+
alias_method :original_irt, :irt
|
20
|
+
def irt(bind=nil)
|
21
|
+
IRT.start
|
22
|
+
IRT::Commands::Core.irt(bind)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module IRT
|
27
|
+
module Session
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def set_binding_file_pointers(context)
|
32
|
+
context.binding_file = Debugger.current_context.frame_file
|
33
|
+
context.binding_line_no = Debugger.current_context.frame_line
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
@@ -1,14 +1,21 @@
|
|
1
1
|
require 'stringio'
|
2
2
|
module Kernel
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
# copied from ActiveRecord 3.1 because of conflicting name with previous IRT implementation
|
5
|
+
# modified in the argument default in order to be used by both AR and IRT
|
6
|
+
def capture(stream=:stdout)
|
7
|
+
begin
|
8
|
+
stream = stream.to_s
|
9
|
+
eval "$#{stream} = StringIO.new"
|
10
|
+
yield
|
11
|
+
result = eval("$#{stream}").string
|
12
|
+
ensure
|
13
|
+
eval("$#{stream} = #{stream.upcase}")
|
14
|
+
end
|
15
|
+
|
16
|
+
result
|
11
17
|
end
|
18
|
+
alias :silence :capture
|
12
19
|
|
13
20
|
def irt(bind)
|
14
21
|
raise IRT::ArgumentTypeError, "You must pass binding instead of #{bind.class.name} object" unless bind.is_a?(Binding)
|
data/lib/irt.rb
CHANGED
@@ -153,6 +153,12 @@ module IRT
|
|
153
153
|
|
154
154
|
end
|
155
155
|
|
156
|
+
# before we patch irb
|
157
|
+
if defined?(Debugger)
|
158
|
+
require 'ruby-debug/command'
|
159
|
+
require 'ruby-debug/commands/irb'
|
160
|
+
end
|
161
|
+
|
156
162
|
require 'irt/extensions/irb'
|
157
163
|
require 'irb/completion'
|
158
164
|
IRT.init_config
|
@@ -161,5 +167,6 @@ require 'irt/extensions/object'
|
|
161
167
|
require 'irt/extensions/method'
|
162
168
|
require 'irt/prompter'
|
163
169
|
require 'irt/extensions/rails' if defined?(ActiveSupport::BufferedLogger)
|
170
|
+
require 'irt/extensions/debugger' if defined?(Debugger)
|
164
171
|
|
165
172
|
end
|
metadata
CHANGED
@@ -2,98 +2,101 @@
|
|
2
2
|
name: irt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
|
8
|
+
- Domizio Demichelis
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-02 00:00:00 -04:00
|
14
|
+
default_executable:
|
14
15
|
dependencies:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: differ
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.1.1
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dye
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.1.3
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: prompter
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.1.4
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
48
49
|
description: If you use IRT in place of irb or Rails Console, you will have more tools that will make your life a lot easier.
|
49
50
|
email: dd.nexus@gmail.com
|
50
51
|
executables:
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
- irt
|
53
|
+
- irt_irb
|
54
|
+
- irt_rails2
|
54
55
|
extensions: []
|
55
56
|
|
56
57
|
extra_rdoc_files:
|
57
|
-
|
58
|
+
- README.markdown
|
58
59
|
files:
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
60
|
+
- .gitignore
|
61
|
+
- LICENSE
|
62
|
+
- README.markdown
|
63
|
+
- Rakefile
|
64
|
+
- VERSION
|
65
|
+
- bin/irt
|
66
|
+
- bin/irt_irb
|
67
|
+
- bin/irt_rails2
|
68
|
+
- goodies/nano/README
|
69
|
+
- goodies/nano/irt.nanorc
|
70
|
+
- goodies/vi/README
|
71
|
+
- irt.gemspec
|
72
|
+
- irtrc
|
73
|
+
- lib/irt.rb
|
74
|
+
- lib/irt/commands/core.rb
|
75
|
+
- lib/irt/commands/edit.rb
|
76
|
+
- lib/irt/commands/help.rb
|
77
|
+
- lib/irt/commands/log.rb
|
78
|
+
- lib/irt/commands/ri.rb
|
79
|
+
- lib/irt/commands/test.rb
|
80
|
+
- lib/irt/differ.rb
|
81
|
+
- lib/irt/directives.rb
|
82
|
+
- lib/irt/directives/test.rb
|
83
|
+
- lib/irt/extensions/debugger.rb
|
84
|
+
- lib/irt/extensions/irb.rb
|
85
|
+
- lib/irt/extensions/irb/commands.rb
|
86
|
+
- lib/irt/extensions/irb/context.rb
|
87
|
+
- lib/irt/extensions/kernel.rb
|
88
|
+
- lib/irt/extensions/method.rb
|
89
|
+
- lib/irt/extensions/object.rb
|
90
|
+
- lib/irt/extensions/rails.rb
|
91
|
+
- lib/irt/history.rb
|
92
|
+
- lib/irt/hunks.rb
|
93
|
+
- lib/irt/init.rb
|
94
|
+
- lib/irt/log.rb
|
95
|
+
- lib/irt/prompter.rb
|
96
|
+
- lib/irt/ruby_version.rb
|
97
|
+
- lib/irt/session.rb
|
98
|
+
- lib/irt/utils.rb
|
99
|
+
has_rdoc: true
|
97
100
|
homepage: http://github.com/ddnexus/irt
|
98
101
|
licenses: []
|
99
102
|
|
@@ -121,28 +124,27 @@ post_install_message: |+
|
|
121
124
|
________________________________________________________________________________
|
122
125
|
|
123
126
|
rdoc_options:
|
124
|
-
|
127
|
+
- --charset=UTF-8
|
125
128
|
require_paths:
|
126
|
-
|
129
|
+
- lib
|
127
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
131
|
none: false
|
129
132
|
requirements:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: "0"
|
133
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
137
|
none: false
|
135
138
|
requirements:
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 1.3.6
|
139
142
|
requirements: []
|
140
143
|
|
141
144
|
rubyforge_project:
|
142
|
-
rubygems_version: 1.
|
145
|
+
rubygems_version: 1.5.0
|
143
146
|
signing_key:
|
144
147
|
specification_version: 3
|
145
148
|
summary: Interactive Ruby Tools - Very improved irb and Rails Console with a lot of cool features.
|
146
149
|
test_files: []
|
147
150
|
|
148
|
-
has_rdoc:
|