irbtools 1.2.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,12 @@
1
- 1.3.0
1
+ 1.4.0
2
+ * every_day_irb is now a module that extends self
3
+ * specs for most of every_day_irb's functionality
4
+ * add helper method for paging output with hirb: page
5
+ * version bumps, including wirb and fancy_irb
6
+ * remove sketches dependency, it's a great gem, but very similar to interactive_editor
7
+ * Object#mlp alias for method_lookup_path
8
+
9
+ 1.3.0 == 1.2.3
2
10
  * add modern debundle note
3
11
  * remove loading of .railsrc
4
12
  * remove dbg method
data/README.rdoc CHANGED
@@ -1,18 +1,17 @@
1
1
  = irbtools
2
- The irbtools gem is a meta gem that installs handy and useful irb gems and provides an appealing ready-to-use irb configuration. It has a modular structure and supports multiple library-loading mechanisms, e.g. via <tt>autoload</tt> or threads.
2
+ irbtools improves Ruby's irb console. Unlike pry, you are still in your normal irb, but you have colors and lots of helpful methods.
3
3
 
4
4
  == Setup
5
5
 
6
6
  gem install irbtools
7
7
 
8
8
  * On Linux, you need +xclip+ or +xsel+ to use the clipboard: sudo <tt>apt-get install xclip</tt>
9
- * On Windows, you need ansicon[https://github.com/adoxa/ansicon] to enjoy all the colors
9
+ * On Windows, you need ansicon[https://github.com/adoxa/ansicon] to enable colors
10
10
  * On MacOS, you need growl, to use the +g+ gem.
11
11
 
12
12
  == Usage
13
- To use *irbtools*, put the following in your <tt>~/.irbrc</tt> file (this file is loaded every time you start irb):
13
+ To use *irbtools*, put the following in your <tt>~/.irbrc</tt> file (it is loaded every time you start irb):
14
14
 
15
- require 'rubygems' unless defined? Gem # rubygems is only needed in 1.8
16
15
  require 'irbtools'
17
16
 
18
17
  If the file does not exist, just create a new one. See further below on how to customize loaded libraries.
@@ -32,8 +31,6 @@ Another way is to add a debundle hack on top of your <tt>~/.irbrc</tt>:
32
31
  alias gem require
33
32
  end
34
33
 
35
- See {this blog post}[http://rbjl.net/49-railsrc-rails-console-snippets] for some Rails integration features.
36
-
37
34
  === Yesterday's Ruby versions
38
35
 
39
36
  *irbtools* focuses on Ruby 1.9 support. To get it working with 1.8.7, use the following line in your Gemfile:
@@ -42,7 +39,7 @@ See {this blog post}[http://rbjl.net/49-railsrc-rails-console-snippets] for some
42
39
 
43
40
  === This is irbtools "light"
44
41
 
45
- When installing *irbtools*, some gems won't be installed to keep windows support, e.g. better auto-completion or the looksee gem. These are packaged in the {irbtools-more}[https://github.com/janlelis/irbtools-more] gem. To use them, you need to change your <tt>.irbrc</tt> to:
42
+ When installing *irbtools*, some gems won't be installed to keep windows support, e.g. better auto-completion or the looksee gem. These are packaged into the {irbtools-more}[https://github.com/janlelis/irbtools-more] gem. To use them, you need to change your <tt>.irbrc</tt> to:
46
43
 
47
44
  require 'irbtools/configure'
48
45
  Irbtools.add_package :more
@@ -52,7 +49,7 @@ When installing *irbtools*, some gems won't be installed to keep windows support
52
49
 
53
50
  See http://rbjl.net/40-irbtools-release-the-power-of-irb or read the commented source files to get some examples of what you can do with irbtools.
54
51
 
55
- [wirb[https://github.com/janlelis/wirb/]] Colorizes Ruby objects (used for the results)
52
+ [wirb[https://github.com/janlelis/wirb/]] Colorizes resulting Ruby objects
56
53
  [paint[https://github.com/janlelis/paint/]] Provides easily to use terminal colors
57
54
  [hirb[http://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html]]
58
55
  Custom views for specific objects, e.g. tables for ActiveRecord
@@ -61,15 +58,14 @@ See http://rbjl.net/40-irbtools-release-the-power-of-irb or read the commented s
61
58
  Contains helper methods that might be useful in every-day irb usage, see below for details
62
59
  [clipboard[http://github.com/janlelis/clipboard]] Easy clipboard access
63
60
  [interactive_editor[https://github.com/jberkel/interactive_editor]]
64
- Lets you open vim from within irb to hack something that gets loaded into the current session, also possible: yaml object editing
65
- [sketches[http://sketches.rubyforge.org/]] Another, more flexible "start editor and it gets loaded into your irb session" plugin
61
+ Lets you open vim (or emacs) from within irb to hack something that gets loaded into the current session, also possible: yaml object editing
66
62
  [zucker[http:/rubyzucker.info]] Nice debug printing (<tt>q</tt>, <tt>o</tt>, <tt>c</tt>, <tt>Object#m</tt>, <tt>Object#d</tt>) and useful pseudo-constants (<tt>Info</tt>, <tt>OS</tt>, <tt>RubyVersion</tt>, <tt>RubyEngine</tt>)
67
- [ap[https://github.com/michaeldv/awesome_print]] Nice debug printing commands (<tt>ap</tt>) [also possible: <tt>wp</tt> from wirb/wp]
63
+ [ap[https://github.com/michaeldv/awesome_print]] Alternative for displaying Ruby objects
68
64
  [coderay[http://coderay.rubychan.de/]] Colorizes Ruby code (<tt>colorize</tt>, <tt>ray</tt>)
69
65
  [boson[http://tagaholic.me/boson/]] "A command/task framework similar to rake and thor that opens your ruby universe to the commandline and irb."
70
66
  [methodfinder[https://github.com/citizen428/methodfinder]] Interesting method finder (<tt>mf</tt>)
71
67
  [ori[https://github.com/dadooda/ori]] Adds an <tt>Object#ri</tt> method
72
- [method_locator[https://github.com/ryanlecompte/method_locator]] Provides <tt>Object#method_lookup_path</tt> (improved version of <tt>Module#ancestors</tt>) and <tt>Object#methods_for</tt> (get this method from all ancestors)
68
+ [method_locator[https://github.com/ryanlecompte/method_locator]] Provides <tt>Object#mlp</tt> (improved version of <tt>Module#ancestors</tt>) and <tt>Object#methods_for(m)</tt> (get this method from all ancestors)
73
69
  [method_source[https://github.com/banister/method_source]] <tt>Object#src</tt> can be shown for Ruby methods
74
70
  [bond[http://tagaholic.me/bond/]] <b>irbtools-more:</b> Improves irb tab-completion
75
71
  [looksee[https://github.com/oggy/looksee]] <b>irbtools-more:</b> Great load path inspector: <tt>Object#l</tt> (Extended version of <tt>Object#m</tt>), also provides the ability to <tt>Object#edit</tt> methods.
@@ -78,6 +74,7 @@ See http://rbjl.net/40-irbtools-release-the-power-of-irb or read the commented s
78
74
 
79
75
  === Not included anymore
80
76
 
77
+ [sketches[http://sketches.rubyforge.org/]] Another, more flexible "start editor and it gets loaded into your irb session" plugin. It's a great gem, but the reason it's not included anymore is that it's functionality is very similar to the one provided by the interactive_editor gem
81
78
  [guessmethod[http://guessmethod.rubyforge.org/]] Automatically tries to corrects typos in method names
82
79
  [rvm_loader] RVM helpers
83
80
 
@@ -106,6 +103,7 @@ Irbtools also defines some more helpers in combination with the loaded gems:
106
103
  [copy_input] Copies the session_history to the clipboard
107
104
  [copy_output] Copies this session's results to the clipboard
108
105
  [mf] Shortcut for using the *methodfinder*
106
+ [page] Shortcut for using the pager from *hirb*
109
107
 
110
108
  These are the custom public +Object+ methods renamed/patched for some gems
111
109
 
@@ -114,6 +112,7 @@ These are the custom public +Object+ methods renamed/patched for some gems
114
112
  [l/ll] Alternative method name to trigger the *looksee* gem (<b>irbtools-more</b>)
115
113
 
116
114
 
115
+ == Advanced tweaking
117
116
  === How to load more or less libraries
118
117
 
119
118
  It's possible to modify, which libraries should get loaded:
@@ -143,7 +142,7 @@ When adding a new library, you should firstly consider some way to load it via <
143
142
  If not possible, try loading via thread.
144
143
  If that is not possible either, fallback to the default loading.
145
144
 
146
- == Troubleshooting: Unicode caused Wrong display widths?
145
+ == Troubleshooting: Unicode causes wrong display widths?
147
146
  When using double-width unicode chars, you need to paste the following snippet to your <tt>.irbrc</tt>.
148
147
 
149
148
  Irbtools.replace_library_callback :fancy_irb do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.4.0
data/irbtools.gemspec CHANGED
@@ -19,23 +19,22 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency %q<boson>, "~> 1.2.4"
20
20
  s.add_dependency %q<clipboard>, "~> 1.0.1"
21
21
  s.add_dependency %q<interactive_editor>, ">= 0.0.10"
22
- s.add_dependency %q<sketches>, ">= 0.1.1"
23
22
  s.add_dependency %q<every_day_irb>, ">= #{ s.version }"
24
23
 
25
24
  # display
26
25
  s.add_dependency %q<paint>, ">= 0.8.5"
27
- s.add_dependency %q<fancy_irb>, ">= 0.7.2"
28
- s.add_dependency %q<wirb>, ">= 0.4.2"
26
+ s.add_dependency %q<fancy_irb>, ">= 0.7.3"
27
+ s.add_dependency %q<wirb>, ">= 0.4.3"
29
28
  s.add_dependency %q<hirb>, "~> 0.7.0"
30
29
  s.add_dependency %q<awesome_print>, "~> 1.0.2"
31
- s.add_dependency %q<coderay>, "~> 1.0.7"
30
+ s.add_dependency %q<coderay>, "~> 1.0.8"
32
31
  s.add_dependency %q<g>, ">= 1.7.1"
33
32
 
34
33
  # introspection / docs
35
34
  s.add_dependency %q<ori>, "~> 0.1.0"
36
35
  s.add_dependency %q<methodfinder>, ">= 1.2.5"
37
36
  s.add_dependency %q<method_locator>,">= 0.0.4"
38
- s.add_dependency %q<method_source>, ">= 0.8.0"
37
+ s.add_dependency %q<method_source>, ">= 0.8.1"
39
38
 
40
39
  len = s.homepage.size
41
40
  s.post_install_message = \
@@ -19,15 +19,13 @@ Irbtools.add_library :fileutils, :thread => :stdlib do # cd, pwd, ln_s, mv, rm,
19
19
  def cd( path = '~' )
20
20
  new_last_path = FileUtils.pwd
21
21
  if path == '-'
22
- if $irbtools_last_cd_path
23
- path = $irbtools_last_cd_path
24
- else
22
+ unless path = Irbtools.instance_variable_get(:@last_cd_path)
25
23
  warn 'Sorry, there is no previous directory.'
26
24
  return
27
25
  end
28
26
  end
29
27
  super(File.expand_path(path))
30
- $irbtools_last_cd_path = new_last_path
28
+ Irbtools.instance_variable_set(:@last_cd_path, new_last_path)
31
29
  ls
32
30
  end
33
31
  end
@@ -47,9 +45,6 @@ Irbtools.add_library 'g', :thread => 40 if RbConfig::CONFIG['host_os'] =~ /mac|d
47
45
  # lets you open vim (or your favourite editor), hack something, save it, and it's loaded in the current irb session
48
46
  Irbtools.add_library 'interactive_editor', :thread => :stdlib
49
47
 
50
- # another, more flexible "start editor and it gets loaded into your irb session" plugin
51
- Irbtools.add_library 'sketches', :thread => :stdlib
52
-
53
48
  # object oriented ri method
54
49
  Irbtools.add_library :ori, :thread => 50 do
55
50
  class Object
@@ -72,7 +67,11 @@ Irbtools.add_library :ori, :thread => 50 do
72
67
  end
73
68
 
74
69
  # Object#method_lookup_path (improved ancestors) & Object#methods_for (get this method from all ancestors)
75
- Irbtools.add_library :method_locator, :thread => 60
70
+ Irbtools.add_library :method_locator, :thread => 60 do
71
+ module MethodLocator
72
+ alias mlp method_lookup_path
73
+ end
74
+ end
76
75
 
77
76
  # view method source :)
78
77
  Irbtools.add_library :method_source, :thread => 70 do
@@ -104,8 +103,7 @@ end
104
103
  Irbtools.add_library :paint, :late => true
105
104
 
106
105
  # result colors, install ripl-color_result for ripl colorization
107
- Irbtools.add_library :wirb, :late => true do
108
- Wirb.load_schema :classic_paint
106
+ Irbtools.add_library :wirb, :late => true do
109
107
  Wirb.start
110
108
  end
111
109
 
@@ -129,6 +127,10 @@ Irbtools.add_library :hirb, :late_thread => :hirb do
129
127
  :pager_command => 'less -R'
130
128
  extend Hirb::Console
131
129
 
130
+ def page(what, options = {})
131
+ Hirb::Pager.command_pager(what, options = {})
132
+ end
133
+
132
134
  # page wirb output hacks
133
135
  if defined?(Wirb) && defined?(Paint)
134
136
  class Hirb::Pager
@@ -219,7 +221,7 @@ end
219
221
 
220
222
  # small-talk like method finder
221
223
  Irbtools.add_library :methodfinder, :autoload => :MethodFinder do
222
- MethodFinder::INSTANCE_METHOD_BLACKLIST[:Object] += [:ri, :vi, :vim, :emacs, :nano, :mate, :mvim, :ed, :sketch]
224
+ MethodFinder::INSTANCE_METHOD_BLACKLIST[:Object] += [:ri, :vi, :vim, :emacs, :nano, :mate, :mvim, :ed]
223
225
 
224
226
  def mf(*args, &block)
225
227
  args.empty? ? MethodFinder : MethodFinder.find(*args, &block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irbtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-09 00:00:00.000000000 Z
12
+ date: 2012-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zucker
@@ -75,22 +75,6 @@ dependencies:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: 0.0.10
78
- - !ruby/object:Gem::Dependency
79
- name: sketches
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: 0.1.1
86
- type: :runtime
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: 0.1.1
94
78
  - !ruby/object:Gem::Dependency
95
79
  name: every_day_irb
96
80
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +82,7 @@ dependencies:
98
82
  requirements:
99
83
  - - ! '>='
100
84
  - !ruby/object:Gem::Version
101
- version: 1.2.3
85
+ version: 1.4.0
102
86
  type: :runtime
103
87
  prerelease: false
104
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +90,7 @@ dependencies:
106
90
  requirements:
107
91
  - - ! '>='
108
92
  - !ruby/object:Gem::Version
109
- version: 1.2.3
93
+ version: 1.4.0
110
94
  - !ruby/object:Gem::Dependency
111
95
  name: paint
112
96
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +114,7 @@ dependencies:
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
133
- version: 0.7.2
117
+ version: 0.7.3
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +122,7 @@ dependencies:
138
122
  requirements:
139
123
  - - ! '>='
140
124
  - !ruby/object:Gem::Version
141
- version: 0.7.2
125
+ version: 0.7.3
142
126
  - !ruby/object:Gem::Dependency
143
127
  name: wirb
144
128
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +130,7 @@ dependencies:
146
130
  requirements:
147
131
  - - ! '>='
148
132
  - !ruby/object:Gem::Version
149
- version: 0.4.2
133
+ version: 0.4.3
150
134
  type: :runtime
151
135
  prerelease: false
152
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,7 +138,7 @@ dependencies:
154
138
  requirements:
155
139
  - - ! '>='
156
140
  - !ruby/object:Gem::Version
157
- version: 0.4.2
141
+ version: 0.4.3
158
142
  - !ruby/object:Gem::Dependency
159
143
  name: hirb
160
144
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +178,7 @@ dependencies:
194
178
  requirements:
195
179
  - - ~>
196
180
  - !ruby/object:Gem::Version
197
- version: 1.0.7
181
+ version: 1.0.8
198
182
  type: :runtime
199
183
  prerelease: false
200
184
  version_requirements: !ruby/object:Gem::Requirement
@@ -202,7 +186,7 @@ dependencies:
202
186
  requirements:
203
187
  - - ~>
204
188
  - !ruby/object:Gem::Version
205
- version: 1.0.7
189
+ version: 1.0.8
206
190
  - !ruby/object:Gem::Dependency
207
191
  name: g
208
192
  requirement: !ruby/object:Gem::Requirement
@@ -274,7 +258,7 @@ dependencies:
274
258
  requirements:
275
259
  - - ! '>='
276
260
  - !ruby/object:Gem::Version
277
- version: 0.8.0
261
+ version: 0.8.1
278
262
  type: :runtime
279
263
  prerelease: false
280
264
  version_requirements: !ruby/object:Gem::Requirement
@@ -282,7 +266,7 @@ dependencies:
282
266
  requirements:
283
267
  - - ! '>='
284
268
  - !ruby/object:Gem::Version
285
- version: 0.8.0
269
+ version: 0.8.1
286
270
  description: irbtools is a "meta gem" that installs a bunch of useful irb gems and
287
271
  configures them for you. Simply put a require "irbtools" in the .irbrc file in your
288
272
  home directory.