irt 1.1.5 → 1.1.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/README.markdown +18 -18
- data/VERSION +1 -1
- data/bin/irt_rails2 +3 -4
- data/irtrc +4 -4
- data/lib/irt/commands/core.rb +5 -1
- data/lib/irt/commands/help.rb +3 -1
- data/lib/irt/extensions/irb/context.rb +6 -6
- data/lib/irt/extensions/rails.rb +6 -0
- data/lib/irt/log.rb +1 -1
- metadata +4 -4
data/README.markdown
CHANGED
@@ -36,7 +36,7 @@ to distinguish, and showing NOTHING about the test code that produced the failur
|
|
36
36
|
When something fails IRT assumes that you don't want just to know that something went wrong,
|
37
37
|
but that you actually want to fix it! IRT assumes that...
|
38
38
|
|
39
|
-
- you want to know exactly what the resulting diffs
|
39
|
+
- you want to know exactly what are the resulting diffs
|
40
40
|
- you want to look at the code that failed without having to search for it
|
41
41
|
- you want to play with it IMMEDIATELY in an interactive session, right in the context of the failure
|
42
42
|
- you want to eventually edit and possibly fix it, right in the console
|
@@ -366,8 +366,8 @@ the wanted line. Example:
|
|
366
366
|
|
367
367
|
### Contextual ri doc with autocompletion
|
368
368
|
|
369
|
-
IRT offers the 'ri' command, implemented with fastri
|
370
|
-
|
369
|
+
IRT offers the 'ri' command, (implemented with fastri for RUBY_VERSION < 1.9.2, or 'bri' for RUBY_VERSION >= 1.9.2)
|
370
|
+
See also the IRT.ri_command_format option if you want to change it.
|
371
371
|
|
372
372
|
In its basic form the 'ri' command can accept a string as the system ri command does (you can even omit the quotes).
|
373
373
|
|
@@ -425,18 +425,18 @@ You can also print it with 'status' (or 'ss') at any time.
|
|
425
425
|
### Quasi-shell
|
426
426
|
|
427
427
|
Save some typing for system calls and avoid to open a shell.
|
428
|
-
You can use the '
|
429
|
-
(although quotes
|
428
|
+
You can use the 'sh' as an alias of 'system' with the difference that you don't need to use quotes
|
429
|
+
(although the quotes work anyway), and the command will not be logged. Examples:
|
430
430
|
|
431
|
-
>>
|
432
|
-
>>
|
433
|
-
>>
|
434
|
-
>>
|
431
|
+
>> sh ls -F
|
432
|
+
>> sh tail /some/path
|
433
|
+
>> sh git rebase -i HEAD~5
|
434
|
+
>> sh cat #{file_path}
|
435
435
|
|
436
436
|
### FileUtils
|
437
437
|
|
438
438
|
All the FileUtils methods are included as commands: just call them in the session
|
439
|
-
and they will ignored by the log; if they are part of your testing, use them as usual
|
439
|
+
and they will ignored by the log; if they are part of your testing, use them as usual:
|
440
440
|
|
441
441
|
>> rm_rf 'dir/to/remove' # ignored because it's an irt command
|
442
442
|
>> FileUtils.rm_rf 'dir/to/remove' # logged because it's a regular statement
|
@@ -512,7 +512,7 @@ which should work quite well without any change:
|
|
512
512
|
# IRT.vi_command_format = %(vi -c "startinsert" "%1$s" +%2$d)
|
513
513
|
|
514
514
|
# the format to build the command to launch the ri tool
|
515
|
-
# if RUBY_VERSION
|
515
|
+
# if RUBY_VERSION < 1.9.2 uses qri (from fastri) else bri
|
516
516
|
# IRT.ri_command_format = %(qri -f #{Dye.color? ? 'ansi' : 'plain'} "%s")
|
517
517
|
# IRT.ri_command_format = %(bri "%s")
|
518
518
|
|
@@ -521,13 +521,13 @@ which should work quite well without any change:
|
|
521
521
|
# IRT.edit_command_format = "your_preferred_GUI_editor %1$s +%2$d"
|
522
522
|
|
523
523
|
# any log-ignored-echo command you want to add
|
524
|
-
# IRT.log.ignored_echo_commands <<
|
524
|
+
# IRT.log.ignored_echo_commands << [:commandA, :commandB ...]
|
525
525
|
|
526
526
|
# any log-ignored command you want to add (includes all the log-ignored-echo commands)
|
527
|
-
# IRT.log.ignored_commands <<
|
527
|
+
# IRT.log.ignored_commands << [:commandC, :commandD ...]
|
528
528
|
|
529
529
|
# any command that will not set the last value (includes all the log-ignored commands)
|
530
|
-
# IRT.log.non_setting_commands <<
|
530
|
+
# IRT.log.non_setting_commands << [:commandE, :commandF ...]
|
531
531
|
|
532
532
|
# shows the rails log in console
|
533
533
|
# IRT.rails_log = true
|
@@ -589,8 +589,8 @@ will not be loaded, so be careful to be in the right dir to make it work properl
|
|
589
589
|
You can use irt instead of the standard Rails console, by just calling the irt executable from
|
590
590
|
any Rails application dir. By default IRT will output the rails log (colored in blue) right in the console.
|
591
591
|
|
592
|
-
You can switch the rails log ON or OFF by using the 'rails\_log\_on' and 'rails\_log\_off'
|
593
|
-
besides you can set the option true or false in the ~/.irtrc file.
|
592
|
+
You can switch the rails log ON or OFF by using the 'rails\_log\_on' (or 'rlo') and 'rails\_log\_off' (or 'rlf')
|
593
|
+
commands in any session, besides you can set the option IRT.rails_log to true or false in the ~/.irtrc file.
|
594
594
|
|
595
595
|
#### Rails 3
|
596
596
|
|
@@ -598,8 +598,8 @@ You must add the gem to your Gemfile, to make the bundler happy:
|
|
598
598
|
|
599
599
|
gem 'irt'
|
600
600
|
|
601
|
-
eventually adding it only to the group that you prefer.
|
602
|
-
|
601
|
+
eventually adding it only to the group that you prefer. Anyway, if the irt executable detects that you don't have it set,
|
602
|
+
it will ask and eventually add it for you.
|
603
603
|
|
604
604
|
## Known Issue
|
605
605
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.6
|
data/bin/irt_rails2
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
exec "irt_irb #{argv.join(' ')}"
|
3
|
+
ARGV.pop # remove --simple-prompt
|
4
|
+
ARGV.push ARGV.shift # move the irt file to the end
|
5
|
+
exec "irt_irb #{ARGV.join(' ')}"
|
data/irtrc
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
# IRT.vi_command_format = %(vi -c "startinsert" "%1$s" +%2$d)
|
31
31
|
|
32
32
|
# the format to build the command to launch the ri tool
|
33
|
-
# if RUBY_VERSION
|
33
|
+
# if RUBY_VERSION < 1.9.2 uses qri (from fastri) else bri
|
34
34
|
# IRT.ri_command_format = %(qri -f #{Dye.color? ? 'ansi' : 'plain'} "%s")
|
35
35
|
# IRT.ri_command_format = %(bri "%s")
|
36
36
|
|
@@ -39,13 +39,13 @@
|
|
39
39
|
# IRT.edit_command_format = "your_preferred_GUI_editor %1$s +%2$d"
|
40
40
|
|
41
41
|
# any log-ignored-echo command you want to add
|
42
|
-
# IRT.log.ignored_echo_commands <<
|
42
|
+
# IRT.log.ignored_echo_commands << [:commandA, :commandB ...]
|
43
43
|
|
44
44
|
# any log-ignored command you want to add (includes all the log-ignored-echo commands)
|
45
|
-
# IRT.log.ignored_commands <<
|
45
|
+
# IRT.log.ignored_commands << [:commandC, :commandD ...]
|
46
46
|
|
47
47
|
# any command that will not set the last value (includes all the log-ignored commands)
|
48
|
-
# IRT.log.non_setting_commands <<
|
48
|
+
# IRT.log.non_setting_commands << [:commandE, :commandF ...]
|
49
49
|
|
50
50
|
# shows the rails log in console
|
51
51
|
# IRT.rails_log = true
|
data/lib/irt/commands/core.rb
CHANGED
@@ -20,7 +20,7 @@ module IRT
|
|
20
20
|
end
|
21
21
|
alias_method :open_session, :irt # legacy method
|
22
22
|
|
23
|
-
|
23
|
+
[:p, :y, :pp, :ap].each do |m|
|
24
24
|
define_method(m) do |*args|
|
25
25
|
args = [context.last_value] if args.empty?
|
26
26
|
super *args
|
@@ -47,6 +47,10 @@ module IRT
|
|
47
47
|
end
|
48
48
|
alias_method :rr, :rerun
|
49
49
|
|
50
|
+
def sh(*args)
|
51
|
+
system *args
|
52
|
+
end
|
53
|
+
|
50
54
|
end
|
51
55
|
end
|
52
56
|
end
|
data/lib/irt/commands/help.rb
CHANGED
@@ -71,7 +71,9 @@ module IRT
|
|
71
71
|
|
72
72
|
#{label(" Rails Commands ", :interactive_color) + IRT.dye(" (only available for Rails Apps)", :interactive_color, :bold)}
|
73
73
|
rails_log_on Turn the rails log-in-console ON
|
74
|
+
rlon|rlo Aliases for rails_log_on
|
74
75
|
rails_log_off Turn the rails log-in-console OFF
|
76
|
+
rloff|rlf Aliases for rails_log_off
|
75
77
|
|
76
78
|
#{label " Misc Commands ", :interactive_color}
|
77
79
|
x|q Aliases for exit (from the current session)
|
@@ -79,7 +81,7 @@ module IRT
|
|
79
81
|
status|ss Prints the session status line
|
80
82
|
rerun|rr Reruns the same file
|
81
83
|
irt_help|hh Shows this screen
|
82
|
-
|
84
|
+
sh command Alias for system("command") (no quotes needed)
|
83
85
|
|
84
86
|
#{label " Session Directives ", :file_color}
|
85
87
|
irt Opens an interactive session which retains the
|
@@ -39,12 +39,12 @@ module IRB
|
|
39
39
|
log_file_line(line_no) if irt_mode == :file
|
40
40
|
begin
|
41
41
|
# skip setting last_value for non_setting_commands
|
42
|
-
if line =~ /^\s*(#{quoted_option_string(IRT.log.non_setting_commands)})
|
42
|
+
if line =~ /^\s*(#{quoted_option_string(IRT.log.non_setting_commands)})\b(.*)$/
|
43
43
|
command, args = $1, $2
|
44
|
-
if command =~ /^(
|
45
|
-
|
46
|
-
args = "%(#{args})" unless args.match(/^('|").+\1$/)
|
47
|
-
line = "#{
|
44
|
+
if command =~ /^(sh|ri)$/ && irt_mode != :file
|
45
|
+
args = args.strip if args
|
46
|
+
args = "%(#{args})" unless args.empty? || args.match(/^('|").+\1$/)
|
47
|
+
line = "#{command} #{args}"
|
48
48
|
end
|
49
49
|
IRT::Commands::Ri.reset_choices_map unless command == 'ri'
|
50
50
|
self.echo = false
|
@@ -145,7 +145,7 @@ private
|
|
145
145
|
i = -1
|
146
146
|
str.each_line do |l|
|
147
147
|
@last_line_no = line_no + i+=1
|
148
|
-
unless l =~ /^\s*(#{quoted_option_string(IRT.log.ignored_commands)})/
|
148
|
+
unless l =~ /^\s*(#{quoted_option_string(IRT.log.ignored_commands)})\b/
|
149
149
|
IRT.log.add_line l, @last_line_no
|
150
150
|
end
|
151
151
|
end
|
data/lib/irt/extensions/rails.rb
CHANGED
@@ -24,11 +24,17 @@ module IRT
|
|
24
24
|
|
25
25
|
def rails_log_on
|
26
26
|
IRT.rails_log = true
|
27
|
+
"Rails Log ON"
|
27
28
|
end
|
29
|
+
alias_method :rlon, :rails_log_on
|
30
|
+
alias_method :rlo, :rails_log_on
|
28
31
|
|
29
32
|
def rails_log_off
|
30
33
|
IRT.rails_log = false
|
34
|
+
"Rails Log OFF"
|
31
35
|
end
|
36
|
+
alias_method :rloff, :rails_log_off
|
37
|
+
alias_method :rlf, :rails_log_off
|
32
38
|
|
33
39
|
end
|
34
40
|
end
|
data/lib/irt/log.rb
CHANGED
@@ -10,7 +10,7 @@ module IRT
|
|
10
10
|
@ignored_echo_commands = @ignored_echo_commands.map(&:to_sym)
|
11
11
|
@ignored_commands = @ignored_echo_commands +
|
12
12
|
IRB::ExtendCommandBundle.instance_methods +
|
13
|
-
[ :p, :pp, :ap, :y, :puts, :print, :irt, :irb
|
13
|
+
[ :p, :pp, :ap, :y, :puts, :print, :irt, :irb ]
|
14
14
|
@ignored_commands = @ignored_commands.map(&:to_sym)
|
15
15
|
@non_setting_commands = @ignored_commands + IRT::Directives.own_methods
|
16
16
|
@non_setting_commands = @non_setting_commands.map(&:to_sym)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 6
|
10
|
+
version: 1.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Domizio Demichelis
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-07 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|