every_day_irb 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE → MIT-LICENSE} +0 -0
- data/README.rdoc +203 -0
- data/every_day_irb.gemspec +3 -2
- data/lib/every_day_irb.rb +1 -1
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a382dd13f525cb9a9104e48f304cfec3da9a1d
|
4
|
+
data.tar.gz: 8d14fc052bb1ebe2e3f9ea8df39946f30a5b6167
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76fcae7fca926275f8060241a41edb53e74bab5b94b56c14d26806f9fd384153f9ccfcea43c47e7a3c43a7f8c742c8b0adeca88ac50610ec39ef2a6eb55148c5
|
7
|
+
data.tar.gz: ed5798a1b46fcdf77e049dd34af5b43d54382eeaef8e69234151ab804075d89eb5d0ffdd648c5efe9769836eb5836f74d9c1e34a554b10b2d46bc24d1fa35541
|
data/{LICENSE → MIT-LICENSE}
RENAMED
File without changes
|
data/README.rdoc
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
= irbtools
|
2
|
+
|
3
|
+
Improvements for Ruby's IRB console, for example, colored output, and a lot of debugging and introspection methods. Unlike with PRY, you are still in your normal IRB. It is designed to work out-of-the-box so there is no reason to not use it!
|
4
|
+
|
5
|
+
|
6
|
+
== Setup
|
7
|
+
|
8
|
+
$ gem install irbtools
|
9
|
+
|
10
|
+
|
11
|
+
=== Extra Requirements
|
12
|
+
|
13
|
+
Linux: Clipboard support requires *xclip* or *xsel*: <tt>sudo apt-get install xclip</tt>
|
14
|
+
|
15
|
+
Windows: ANSI colors can be enabled via ansicon[https://github.com/adoxa/ansicon]
|
16
|
+
|
17
|
+
Mac OS: The g gem makes use of *growl*
|
18
|
+
|
19
|
+
|
20
|
+
== Usage
|
21
|
+
|
22
|
+
IRB executes code in <tt>~/.irbrc</tt> on start-up. If the file does not exist, yet, just create a new one. Add the following:
|
23
|
+
|
24
|
+
require 'irbtools'
|
25
|
+
|
26
|
+
See further below, if you want to customize which libraries should be loaded on IRB start-up.
|
27
|
+
|
28
|
+
|
29
|
+
=== With Bundler
|
30
|
+
|
31
|
+
To integrate *irbtools* into a Rails console (or any project that uses bundler), add <tt>irbtools</tt> to your Gemfile:
|
32
|
+
|
33
|
+
gem 'irbtools', require: 'binding.repl'
|
34
|
+
|
35
|
+
Thanks to help from the {binding.repl gem}[https://github.com/robgleeson/binding.repl], you can start IRB (with *irbtools*) directly from your code:
|
36
|
+
|
37
|
+
binding.repl!
|
38
|
+
|
39
|
+
|
40
|
+
=== Debundle
|
41
|
+
|
42
|
+
Another way to activate *irbtools* in bundler projects is to add a {debundle hack}[https://github.com/janlelis/debundle.rb] at the beginning of your <tt>~/.irbrc</tt> file.
|
43
|
+
|
44
|
+
|
45
|
+
=== This is irbtools Light
|
46
|
+
|
47
|
+
When installing *irbtools*, some gems will not be installed to ensure Windows OS support, for example, the bond gem for better auto-completion or the looksee gem for method/class introspection. These are packaged as {irbtools-more}[https://github.com/janlelis/irbtools-more]. To use <tt>irbtools-more</tt>, you will need to change your <tt>.irbrc</tt> to:
|
48
|
+
|
49
|
+
require 'irbtools/more'
|
50
|
+
|
51
|
+
and/or edit your Gemfile to
|
52
|
+
|
53
|
+
gem 'irbtools-more', require: 'binding.repl'
|
54
|
+
|
55
|
+
|
56
|
+
=== Included Gems and Libraries
|
57
|
+
==== IRB Improvements
|
58
|
+
|
59
|
+
* Colorization: wirb[https://github.com/janlelis/wirb/]
|
60
|
+
* IRB tweaks: fancy_irb[https://github.com/janlelis/fancy_irb]
|
61
|
+
* Custom views for specific objects: hirb[http://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html]
|
62
|
+
* <b>(irbtools-more)</b> Better IRB tab-completion: bond[http://tagaholic.me/bond/]
|
63
|
+
|
64
|
+
|
65
|
+
==== Helpful Methods
|
66
|
+
|
67
|
+
* Useful IRB commands: every_day_irb[https://github.com/janlelis/irbtools/tree/master/lib/every_day_irb.rb]
|
68
|
+
* Clipboard Access: clipboard[http://github.com/janlelis/clipboard]
|
69
|
+
* Loads an editor into your IRB session: interactive_editor[https://github.com/jberkel/interactive_editor]
|
70
|
+
* Print debugging helpers: debugging[https:/github.com/janlelis/debugging]
|
71
|
+
* File-related system commands: *fileutils* (stdlib)
|
72
|
+
|
73
|
+
|
74
|
+
==== Platform Information
|
75
|
+
|
76
|
+
* Query current Ruby version: ruby_version[https://github.com/janlelis/ruby_version]
|
77
|
+
* Query current Ruby engine: ruby_engine[https://github.com/janlelis/ruby_engine]
|
78
|
+
* Query current operating system: os[https://github.com/rdp/os]
|
79
|
+
* Global information by the interpreter behind one <tt>Info</tt> constant: ruby_info[https://github.com/janlelis/ruby_info]
|
80
|
+
|
81
|
+
|
82
|
+
==== Introspection
|
83
|
+
|
84
|
+
* Improved lookup path inspection: method_locator[https://github.com/ryanlecompte/method_locator]
|
85
|
+
* Displays a method's source: method_source[https://github.com/banister/method_source]
|
86
|
+
* Adds a +ri+ doc method to Object: [ori[https://github.com/dadooda/ori]
|
87
|
+
* Finds the methods that turned a value into another value: methodfinder[https://github.com/citizen428/methodfinder]
|
88
|
+
* Syntax highlighting: coderay[https://github.com/rubychan/coderay]
|
89
|
+
* <b>irbtools-more</b> Awesome lookup path inspection: looksee[https://github.com/oggy/looksee]
|
90
|
+
* <b>irbtools-more</b> Useful "did you mean?" suggestions in stack-traces: did_you_mean[https://github.com/yuki42/did_you_mean]
|
91
|
+
|
92
|
+
|
93
|
+
==== Code Organization
|
94
|
+
|
95
|
+
* Command/task framework similar to rake and thor: boson[http://tagaholic.me/boson/]
|
96
|
+
* Shortcuts for your favorite methods, saved in personal yaml file: alias[http://tagaholic.me/2009/07/07/alias-quickness-in-the-ruby-console.html]
|
97
|
+
|
98
|
+
|
99
|
+
=== Irbtools Methods
|
100
|
+
==== From every_day_irb
|
101
|
+
|
102
|
+
[ls] Returns an array with the directory's content
|
103
|
+
[cat] Shortcut for <tt>File.read</tt>
|
104
|
+
[rq] Shortcut for <tt>require library.to_s</tt> (allows concise syntax like <tt>rq:mathn</tt>)
|
105
|
+
[ld] Shortcut for <tt>load library.to_s + '.rb'</tt>
|
106
|
+
[rrq/rerequire] Little hack for rerequiring a library (it's really hack and not reliable, but works in most cases)
|
107
|
+
[reset!] Restarts IRB
|
108
|
+
[clear] Clears the terminal (<tt>system "clear"</tt>)
|
109
|
+
[session_history] Returns all issued commands as a string
|
110
|
+
|
111
|
+
|
112
|
+
==== From irbtools in conjunction with the libraries
|
113
|
+
|
114
|
+
[cd] Improves the cd that is already provided by *fileutils* (try <tt>cd '-'</tt>)
|
115
|
+
[version] Displays RubyVersion
|
116
|
+
[engine] Displays RubyEngine
|
117
|
+
[os] OS information
|
118
|
+
[info] Aggregates information about your Ruby environment
|
119
|
+
[copy] Shortcut for <tt>Clipboard.copy</tt>
|
120
|
+
[paste] Shortcut for <tt>Clipboard.paste</tt>
|
121
|
+
[copy_input] Copies the session_history to the clipboard
|
122
|
+
[copy_output] Copies this session's results to the clipboard
|
123
|
+
[mf] Shortcut for using the *methodfinder*
|
124
|
+
[page] Shortcut for using the pager from *hirb*
|
125
|
+
[colorize] Syntax highlights a ruby string using *coderay*
|
126
|
+
[ray] Syntax highlights a ruby file using *coderay*
|
127
|
+
|
128
|
+
|
129
|
+
==== From the libraries (puplic Object methods, renamed/patched)
|
130
|
+
|
131
|
+
[ri] Patching the +ri+ provided by *ori* to also allow default ri syntax on toplevel
|
132
|
+
[src] Shortcut for displaying the method source using *method_source* and *coderay*
|
133
|
+
[mlp] Shortcut for the *method_locator*
|
134
|
+
[l/lp] Alternative method name to trigger the *looksee* gem (<b>irbtools-more</b>)
|
135
|
+
|
136
|
+
|
137
|
+
== Advanced tweaking
|
138
|
+
=== Customize libraries to load
|
139
|
+
|
140
|
+
It is possible to modify, which libraries to load:
|
141
|
+
|
142
|
+
# Don't require 'irbtools', but:
|
143
|
+
require 'irbtools/configure'
|
144
|
+
# Here you can modify the libraries using the methods below
|
145
|
+
Irbtools.start
|
146
|
+
|
147
|
+
If you do not want to load the default set of *irbtools* gems, you will have to use <tt>require 'irbtools/minimal'</tt> instead of <tt>configure</tt>.
|
148
|
+
|
149
|
+
You can use the following methods:
|
150
|
+
|
151
|
+
* <tt>Irbtools.add_library(lib, options_hash, &block)</tt>
|
152
|
+
* <tt>Irbtools.remove_library(lib)</tt>
|
153
|
+
|
154
|
+
The <tt>options_hash</tt> defines the way in which *irbtools* loads the library. The following options are possible
|
155
|
+
[(no options)/<tt>:start</tt>] The library is required on startup before doing anything else (before displaying the prompt)
|
156
|
+
[<tt>:thread => identifier</tt>] After loading everything else, the library is required in a thread (while continuing loading). You can choose any identifier, but if you take the same one for multiple libraries, they will be loaded in the same thread (in the order that you define)
|
157
|
+
[<tt>:late => true</tt>] The library is required just before showing the prompt (note: loading threads might still be in process)
|
158
|
+
[<tt>:late_thread => identifier</tt>] Same as <tt>:thread</tt>, but after loading late libraries.
|
159
|
+
[<tt>:sub_session => true</tt>] The library is loaded every time a sub-session starts (using <tt>IRB.conf[:IRB_RC]</tt>). In ripl[https://github.com/cldwalker/ripl], <tt>ripl-after_rc</tt> is used.
|
160
|
+
[<tt>:autoload => :Constant</tt>] Use Ruby's <tt>autoload</tt> feature. It loads the library as soon as the constant is encountered.
|
161
|
+
|
162
|
+
You can pass a block as third argument, which gets executed after the library has completed loading (except for <tt>:autoload</tt>, in which case the code will be executed directly on startup). You can modify the callbacks by using <tt>Irbtools.add_library_callback</tt> and <tt>Irbtools.replace_library_callback</tt>.
|
163
|
+
|
164
|
+
When adding a new library, you should firstly consider some way to load it via <tt>:autoload</tt>.
|
165
|
+
If this is not possible, try loading via <tt>:thread</tt>. If that is not possible either, you will need to fallback to the default loading mechanism.
|
166
|
+
|
167
|
+
|
168
|
+
== Troubleshooting: Unicode causes wrong display widths?
|
169
|
+
|
170
|
+
If you use double-width unicode characterss, you will need to paste the following snippet to your <tt>.irbrc</tt> file.
|
171
|
+
|
172
|
+
Irbtools.replace_library_callback :fancy_irb do
|
173
|
+
FancyIrb.start east_asian_width: true
|
174
|
+
end
|
175
|
+
|
176
|
+
This setting is deactivated by default, because of performance issues.
|
177
|
+
|
178
|
+
|
179
|
+
== Hint: Faster start-up
|
180
|
+
|
181
|
+
You can get an about a second faster start-up time by changing the loading methods for wirb and fancy_irb to <tt>:thread</tt> (drawback: the hash rocket will not be used for the first result):
|
182
|
+
|
183
|
+
require 'irbtools/configure'
|
184
|
+
Irbtools.remove_library :paint
|
185
|
+
Irbtools.remove_library :fancy_irb
|
186
|
+
Irbtools.add_library :paint, :late => true do Wirb.load_schema :classic_paint if defined? Wirb end
|
187
|
+
Irbtools.add_library :fancy_irb, :thread => -1 do FancyIrb.start end
|
188
|
+
Irbtools.start
|
189
|
+
|
190
|
+
|
191
|
+
== Welcome Message
|
192
|
+
|
193
|
+
The welcome message can be customized with <tt>Irbtools.welcome_message=</tt>
|
194
|
+
|
195
|
+
|
196
|
+
== Web Console
|
197
|
+
|
198
|
+
*irbtools* works well together with the amazing {web-console!}[https://github.com/rails/web-console]
|
199
|
+
|
200
|
+
|
201
|
+
== J-_-L
|
202
|
+
|
203
|
+
Copyright (c) 2010-2014 Jan Lelis <http://janlelis.com> released under the MIT license.
|
data/every_day_irb.gemspec
CHANGED
@@ -9,10 +9,11 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.summary = 'every_day_irb defines helper methods that simplify life in irb.'
|
10
10
|
s.description = 'every_day_irb defines helper methods that simplify life in irb.: ls, cat, rq, rrq, ld, session_history, reset!, clear, ...'
|
11
11
|
s.email = 'mail@janlelis.de'
|
12
|
-
s.extra_rdoc_files = %w[LICENSE]
|
12
|
+
s.extra_rdoc_files = %w[MIT-LICENSE README.rdoc]
|
13
13
|
s.files = Dir.glob(%w[lib/every_day_irb.rb every_day_irb.gemspec])
|
14
14
|
s.homepage = 'http://github.com/janlelis/irbtools'
|
15
|
-
s.required_ruby_version = '>= 1.
|
15
|
+
s.required_ruby_version = '>= 1.9.3'
|
16
16
|
s.license = 'MIT'
|
17
17
|
s.add_development_dependency %q<rspec>
|
18
|
+
s.add_development_dependency %q<rake>
|
18
19
|
end
|
data/lib/every_day_irb.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: every_day_irb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -24,15 +24,31 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: 'every_day_irb defines helper methods that simplify life in irb.: ls,
|
28
42
|
cat, rq, rrq, ld, session_history, reset!, clear, ...'
|
29
43
|
email: mail@janlelis.de
|
30
44
|
executables: []
|
31
45
|
extensions: []
|
32
46
|
extra_rdoc_files:
|
33
|
-
- LICENSE
|
47
|
+
- MIT-LICENSE
|
48
|
+
- README.rdoc
|
34
49
|
files:
|
35
|
-
- LICENSE
|
50
|
+
- MIT-LICENSE
|
51
|
+
- README.rdoc
|
36
52
|
- every_day_irb.gemspec
|
37
53
|
- lib/every_day_irb.rb
|
38
54
|
homepage: http://github.com/janlelis/irbtools
|
@@ -47,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
63
|
requirements:
|
48
64
|
- - ">="
|
49
65
|
- !ruby/object:Gem::Version
|
50
|
-
version: 1.
|
66
|
+
version: 1.9.3
|
51
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
68
|
requirements:
|
53
69
|
- - ">="
|
@@ -55,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
71
|
version: '0'
|
56
72
|
requirements: []
|
57
73
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.2.
|
74
|
+
rubygems_version: 2.2.2
|
59
75
|
signing_key:
|
60
76
|
specification_version: 4
|
61
77
|
summary: every_day_irb defines helper methods that simplify life in irb.
|