irt 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -500,17 +500,19 @@ which should work quite well without any change:
500
500
  # IRT.copy_to_clipboard_command = 'your command'
501
501
 
502
502
  # the format to build the command to launch nano
503
- # IRT.nano_command_format = 'nano +%2$d %1$s'
503
+ # IRT.nano_command_format = %(nano +%2$d "%1$s")
504
504
 
505
505
  # the format to build the command to launch vi
506
- # IRT.vi_command_format ="vi -c 'startinsert' %1$s +%2$d"
506
+ # IRT.vi_command_format = %(vi -c "startinsert" "%1$s" +%2$d)
507
507
 
508
508
  # the format to build the command to launch the ri tool
509
- # IRT.ri_command_format = "qri -f #{Dye.color? ? 'ansi' : 'plain'} %s"
509
+ # if RUBY_VERSION > 1.9.2 uses qri (from fastri) else bri
510
+ # IRT.ri_command_format = %(qri -f #{Dye.color? ? 'ansi' : 'plain'} "%s")
511
+ # IRT.ri_command_format = %(bri "%s")
510
512
 
511
513
  # add your command format if you want to use another editor than nano or vi
512
514
  # default 'open -t %1$s' on MacOX; 'kde-open %1$s' or 'gnome-open %1$s' un unix/linux; '%1$s' on windoze
513
- # IRT.edit_command_format ="your_preferred_GUI_editor %1$s +%2$d"
515
+ # IRT.edit_command_format = "your_preferred_GUI_editor %1$s +%2$d"
514
516
 
515
517
  # any log-ignored-echo command you want to add
516
518
  # IRT.log.ignored_echo_commands << %w[commandA commandB ...]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.1.3
data/bin/irt CHANGED
@@ -58,7 +58,10 @@ puts copy
58
58
 
59
59
  paths = if ARGV.empty?
60
60
  options[:interactive_eof] = true
61
- [ Tempfile.new(%w[tmp- .irt]).path ]
61
+ tmp_file = Tempfile.new(%w[tmp- .irt])
62
+ tmp_file << "\n" # one empty line makes irb of 1.9.2 happy
63
+ tmp_file.flush
64
+ [ tmp_file.path ]
62
65
  else
63
66
  ARGV.map {|p| File.expand_path(p) }
64
67
  end
@@ -69,7 +72,7 @@ files = paths.map do |path|
69
72
  options[:interactive_eof] = true
70
73
  dirname = File.dirname(path)
71
74
  FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
72
- FileUtils.touch(path)
75
+ File.open(path, 'w') {|f| f.puts "\n" } # one empty line makes irb of 1.9.2 happy
73
76
  end
74
77
  File.directory?(path) ? Dir.glob(File.join(path, '**/*.irt')) : path
75
78
  end.flatten
data/irt.gemspec CHANGED
@@ -1,6 +1,7 @@
1
1
  name = File.basename( __FILE__, '.gemspec' )
2
2
  version = File.read(File.expand_path('../VERSION', __FILE__)).strip
3
3
  require 'date'
4
+ require File.expand_path('../lib/irt/ruby_version.rb', __FILE__)
4
5
 
5
6
  Gem::Specification.new do |s|
6
7
 
@@ -13,7 +14,11 @@ Gem::Specification.new do |s|
13
14
  s.add_runtime_dependency('differ', [">= 0.1.1"])
14
15
  s.add_runtime_dependency('dye', [">= 0.1.1"])
15
16
  s.add_runtime_dependency('prompter', [">= 0.1.2"])
16
- s.add_runtime_dependency('fastri', [">= 0.3.1.1"])
17
+ if IRT::RubyVersion >= '1.9.2'
18
+ s.add_runtime_dependency('bri', [">= 0.1.4"])
19
+ else
20
+ s.add_runtime_dependency('fastri', [">= 0.3.1.1"])
21
+ end
17
22
 
18
23
  s.executables = ['irt', 'irt_irb', 'irt_rails2']
19
24
  s.files = `git ls-files -z`.split("\0") - %w[irt-tutorial.pdf]
data/irtrc CHANGED
@@ -24,17 +24,19 @@
24
24
  # IRT.copy_to_clipboard_command = 'your command'
25
25
 
26
26
  # the format to build the command to launch nano
27
- # IRT.nano_command_format = 'nano +%2$d %1$s'
27
+ # IRT.nano_command_format = %(nano +%2$d "%1$s")
28
28
 
29
29
  # the format to build the command to launch vi
30
- # IRT.vi_command_format ="vi -c 'startinsert' %1$s +%2$d"
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
- # IRT.ri_command_format = "qri -f #{Dye.color? ? 'ansi' : 'plain'} %s"
33
+ # if RUBY_VERSION > 1.9.2 uses qri (from fastri) else bri
34
+ # IRT.ri_command_format = %(qri -f #{Dye.color? ? 'ansi' : 'plain'} "%s")
35
+ # IRT.ri_command_format = %(bri "%s")
34
36
 
35
37
  # add your command format if you want to use another editor than nano or vi
36
38
  # default 'open -t %1$s' on MacOX; 'kde-open %1$s' or 'gnome-open %1$s' un unix/linux; '%1$s' on windoze
37
- # IRT.edit_command_format ="your_preferred_GUI_editor %1$s +%2$d"
39
+ # IRT.edit_command_format = "your_preferred_GUI_editor %1$s +%2$d"
38
40
 
39
41
  # any log-ignored-echo command you want to add
40
42
  # IRT.log.ignored_echo_commands << %w[commandA commandB ...]
@@ -79,7 +79,7 @@ module IRT
79
79
  else
80
80
  args
81
81
  end
82
- system sprintf(cmd_format, file, line)
82
+ system sprintf(cmd_format, file, line||0)
83
83
  end
84
84
 
85
85
  def copy_to_clipboard(cmd)
@@ -87,8 +87,9 @@ module IRB
87
87
  private
88
88
 
89
89
  def process_exception(e)
90
- return if IRT.debug
91
- bktr = e.backtrace.reject {|m| File.expand_path(m).match(/^#{IRT.lib_path}/) || workspace.filter_backtrace(m).nil? }
90
+ bktr = e.backtrace.reject do |m|
91
+ workspace.filter_backtrace(m).nil? || !IRT.debug && File.expand_path(m).match(/^#{IRT.lib_path}/)
92
+ end
92
93
  e.set_backtrace( e.class.name.match(/^IRT::/) ? bktr : map_backtrace(bktr) )
93
94
  end
94
95
 
@@ -135,8 +136,8 @@ private
135
136
  end
136
137
  end
137
138
 
138
- def output_ignored_echo_value(value)
139
- if inspect?
139
+ def output_ignored_echo_value(value)
140
+ if inspect?
140
141
  printf return_format(:ignored_color,false), value.inspect
141
142
  else
142
143
  printf return_format(:ignored_color,false), value
@@ -0,0 +1,22 @@
1
+ module IRT
2
+ module RubyVersion
3
+
4
+ extend self
5
+
6
+ class Version < Array
7
+ include Comparable
8
+
9
+ def initialize(version=RUBY_VERSION)
10
+ replace version.split('.').map(&:to_i)
11
+ end
12
+ end
13
+
14
+ [:>, :>=, :<, :<=, :==, :between?].each do |m|
15
+ define_method(m) do |*args|
16
+ vers = args.map{|a| Version.new(a)}
17
+ Version.new.send m, *vers
18
+ end
19
+ end
20
+
21
+ end
22
+ end
data/lib/irt.rb CHANGED
@@ -19,6 +19,7 @@ require 'irt/hunks'
19
19
  require 'irt/differ'
20
20
  require 'irt/directives'
21
21
  require 'irt/session'
22
+ require 'irt/ruby_version'
22
23
 
23
24
  module IRT
24
25
 
@@ -92,9 +93,9 @@ module IRT
92
93
  'gnome-open %1$s'
93
94
  end
94
95
  end
95
- @vi_command_format = "vi -c 'startinsert' %1$s +%2$d"
96
- @nano_command_format = 'nano +%2$d %1$s'
97
- @ri_command_format = "qri -f #{Dye.color? ? 'ansi' : 'plain'} %s"
96
+ @vi_command_format = %(vi -c "startinsert" "%1$s" +%2$d)
97
+ @nano_command_format = %(nano +%2$d "%1$s")
98
+ @ri_command_format = IRT::RubyVersion >= '1.9.2' ? %(bri "%s") : %(qri -f #{Dye.color? ? 'ansi' : 'plain'} "%s")
98
99
  @debug = false
99
100
  end
100
101
 
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 2
10
- version: 1.1.2
4
+ prerelease:
5
+ version: 1.1.3
11
6
  platform: ruby
12
7
  authors:
13
8
  - Domizio Demichelis
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-02-01 00:00:00 -04:00
13
+ date: 2011-02-02 00:00:00 -04:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,11 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 25
30
- segments:
31
- - 0
32
- - 1
33
- - 1
34
24
  version: 0.1.1
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -42,11 +32,6 @@ dependencies:
42
32
  requirements:
43
33
  - - ">="
44
34
  - !ruby/object:Gem::Version
45
- hash: 25
46
- segments:
47
- - 0
48
- - 1
49
- - 1
50
35
  version: 0.1.1
51
36
  type: :runtime
52
37
  version_requirements: *id002
@@ -58,29 +43,18 @@ dependencies:
58
43
  requirements:
59
44
  - - ">="
60
45
  - !ruby/object:Gem::Version
61
- hash: 31
62
- segments:
63
- - 0
64
- - 1
65
- - 2
66
46
  version: 0.1.2
67
47
  type: :runtime
68
48
  version_requirements: *id003
69
49
  - !ruby/object:Gem::Dependency
70
- name: fastri
50
+ name: bri
71
51
  prerelease: false
72
52
  requirement: &id004 !ruby/object:Gem::Requirement
73
53
  none: false
74
54
  requirements:
75
55
  - - ">="
76
56
  - !ruby/object:Gem::Version
77
- hash: 81
78
- segments:
79
- - 0
80
- - 3
81
- - 1
82
- - 1
83
- version: 0.3.1.1
57
+ version: 0.1.4
84
58
  type: :runtime
85
59
  version_requirements: *id004
86
60
  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.
@@ -126,6 +100,7 @@ files:
126
100
  - lib/irt/hunks.rb
127
101
  - lib/irt/init.rb
128
102
  - lib/irt/log.rb
103
+ - lib/irt/ruby_version.rb
129
104
  - lib/irt/session.rb
130
105
  has_rdoc: true
131
106
  homepage: http://github.com/ddnexus/irt
@@ -141,25 +116,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
116
  requirements:
142
117
  - - ">="
143
118
  - !ruby/object:Gem::Version
144
- hash: 3
145
- segments:
146
- - 0
147
119
  version: "0"
148
120
  required_rubygems_version: !ruby/object:Gem::Requirement
149
121
  none: false
150
122
  requirements:
151
123
  - - ">="
152
124
  - !ruby/object:Gem::Version
153
- hash: 23
154
- segments:
155
- - 1
156
- - 3
157
- - 6
158
125
  version: 1.3.6
159
126
  requirements: []
160
127
 
161
128
  rubyforge_project:
162
- rubygems_version: 1.3.7
129
+ rubygems_version: 1.5.0
163
130
  signing_key:
164
131
  specification_version: 3
165
132
  summary: Interactive Ruby Tools - Improved irb and rails console with a lot of easy and powerful tools.