irbtools 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -1
- data/README.rdoc +15 -11
- data/VERSION +1 -1
- data/irbtools.gemspec +3 -3
- data/lib/irbtools.rb +74 -76
- data/lib/irbtools/configure.rb +1 -1
- metadata +10 -10
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -6,8 +6,8 @@ This is a meta gem which installs some useful irb gems and configures your irb.
|
|
6
6
|
|
7
7
|
gem install irbtools
|
8
8
|
|
9
|
-
* On Linux, you
|
10
|
-
* On MacOS, you need growl, if you want to use the +g+ gem.
|
9
|
+
* On Linux, you need +xclip+ or +xsel+ to use the clipboard: <tt>sudo apt-get install xclip</tt>
|
10
|
+
* On MacOS, you will need growl, if you want to use the +g+ gem.
|
11
11
|
|
12
12
|
== Usage
|
13
13
|
|
@@ -24,6 +24,12 @@ It's possible to modify, which libraries get loaded:
|
|
24
24
|
# here you can modify which libraries get loaded (see below)
|
25
25
|
Irbtools.init
|
26
26
|
|
27
|
+
=== Rails notes
|
28
|
+
|
29
|
+
To use irbtools within the rails console, you will have to add irbtools to your Gemfile.
|
30
|
+
|
31
|
+
You can put Rails specific configuration in a <tt>~/.railsrc</tt> file which gets loaded only in Rails environments.
|
32
|
+
|
27
33
|
=== How to load more or less libraries
|
28
34
|
|
29
35
|
You have the following ways:
|
@@ -41,18 +47,17 @@ See http://rbjl.net/40-irbtools-release-the-power-of-irb or read the commented s
|
|
41
47
|
=== Included gems and libraries
|
42
48
|
|
43
49
|
* wirb[https://github.com/janlelis/wirb/] colorize output
|
44
|
-
* fancy_irbt[https://github.com/janlelis/fancy_irb] put result as comment and more colorization
|
45
50
|
* hirb[http://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html] (active record) tables and custom views for specific objects
|
46
|
-
*
|
47
|
-
*
|
48
|
-
* zucker/debug[http:/rubyzucker.info] nice debug printing (q, o, c, .m, .d)
|
49
|
-
* ap[https://github.com/michaeldv/awesome_print] nice debug printing (ap)
|
51
|
+
* fancy_irb[https://github.com/janlelis/fancy_irb] put result as comment and more colorization
|
52
|
+
* *fileutils* (stdlib) cd, pwd, ln_s, mv, rm, mkdir, touch ... ;)
|
50
53
|
* clipboard[http://github.com/janlelis/clipboard] easy clipboard access (copy & paste)
|
51
|
-
* guessmethod[http://guessmethod.rubyforge.org/] automatically corrects typos (method_missing hook) [not loaded by default]
|
52
54
|
* interactive_editor[https://github.com/jberkel/interactive_editor] lets you open vim, hack something, and it gets loaded into the current session
|
53
55
|
* sketches[http://sketches.rubyforge.org/] another, more flexible "start editor and it gets loaded into your irb session" plugin
|
56
|
+
* zucker[http:/rubyzucker.info] nice debug printing (q, o, c, .m, .d) + useful pseudo-constants (Info, OS, RubyVersion, RubyEngine)
|
57
|
+
* ap[https://github.com/michaeldv/awesome_print] nice debug printing (ap)
|
54
58
|
* coderay[http://coderay.rubychan.de/] some nice colorful displaying ;)
|
55
59
|
* boson[http://tagaholic.me/boson/] commands repository (commands also work in the shell!)
|
60
|
+
* guessmethod[http://guessmethod.rubyforge.org/] automatically corrects typos (method_missing hook) [not loaded by default]
|
56
61
|
|
57
62
|
=== Helper methods
|
58
63
|
See the source for a description. These methods are defined directly by irbtools. Each gem may add its own helper methods.
|
@@ -74,9 +79,8 @@ You can customize the welcome message with <tt>Irbtools.welcome_message=</tt>
|
|
74
79
|
== Wrong display widths?
|
75
80
|
When using double-width unicode chars, you should need to pass the <tt>:east_asian_width = true</tt> when starting <tt>FancyIrb</tt>. It is deactivated because of performance issues.
|
76
81
|
|
77
|
-
==
|
82
|
+
== Todo
|
78
83
|
|
79
|
-
* Make guessmethod 1.9 compatible
|
80
84
|
* Nicer ri command
|
81
85
|
|
82
86
|
=== Planned features for 0.9.0 (next main version)
|
@@ -85,7 +89,7 @@ When using double-width unicode chars, you should need to pass the <tt>:east_asi
|
|
85
89
|
|
86
90
|
== More Features
|
87
91
|
|
88
|
-
* See the irbtools-more[https://github.com/janlelis/irbtools-more] package
|
92
|
+
* See the irbtools-more[https://github.com/janlelis/irbtools-more] package or suggest some useful utilities/tweaks ;)
|
89
93
|
|
90
94
|
== Copyright
|
91
95
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.5
|
data/irbtools.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.version = File.read('VERSION').chomp
|
7
7
|
|
8
8
|
s.authors = ["Jan Lelis"]
|
9
|
-
s.date = %q{2010-
|
9
|
+
s.date = %q{2010-01-31}
|
10
10
|
s.summary = %q{irbtools is a meta gem which installs some useful irb gems and configures your irb.}
|
11
11
|
s.description = %q{irbtools is a meta gem which installs some useful irb gems and configures your irb. Simply put a require 'irbtools' in the .irbrc file in your home directory.}
|
12
12
|
s.email = %q{mail@janlelis.de}
|
@@ -19,10 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_dependency %q<zucker>, ">= 9"
|
20
20
|
s.add_dependency %q<hirb>, "~> 0.3"
|
21
21
|
s.add_dependency %q<awesome_print>, "~> 0.3"
|
22
|
-
s.add_dependency %q<clipboard>, ">= 0.9.
|
22
|
+
s.add_dependency %q<clipboard>, ">= 0.9.5"
|
23
23
|
s.add_dependency %q<coderay>, "~> 0.9"
|
24
24
|
s.add_dependency %q<boson>, "~> 0.3"
|
25
|
-
s.add_dependency %q<wirb>, ">= 0.2.
|
25
|
+
s.add_dependency %q<wirb>, ">= 0.2.2"
|
26
26
|
s.add_dependency %q<interactive_editor>, ">= 0.0.6"
|
27
27
|
s.add_dependency %q<sketches>, ">= 0"
|
28
28
|
s.add_dependency %q<g>, ">= 0"
|
data/lib/irbtools.rb
CHANGED
@@ -1,103 +1,101 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
#
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
#
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
if defined?(IRB) || defined?(Ripl)
|
4
|
+
# # # # #
|
5
|
+
# require 'irbtools' in your .irbrc
|
6
|
+
# see the README file for more information
|
7
|
+
require File.expand_path('irbtools/configure', File.dirname(__FILE__) ) unless defined? Irbtools
|
8
|
+
|
9
|
+
# # # # #
|
10
|
+
# load extension packages
|
11
|
+
Irbtools.packages.each{ |pkg|
|
12
|
+
begin
|
13
|
+
require "irbtools/#{pkg}"
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
}
|
15
|
+
rescue LoadError => err
|
16
|
+
warn "Couldn't load an extension package: #{err}"
|
17
|
+
end
|
18
|
+
}
|
18
19
|
|
19
|
-
# # # # #
|
20
|
-
# load libraries
|
20
|
+
# # # # #
|
21
|
+
# load libraries
|
21
22
|
|
22
|
-
# load helper proc
|
23
|
-
load_libraries_proc = proc{ |libs|
|
24
|
-
|
25
|
-
|
23
|
+
# load helper proc
|
24
|
+
load_libraries_proc = proc{ |libs|
|
25
|
+
remember_verbose_and_debug = $VERBOSE, $DEBUG
|
26
|
+
$VERBOSE = $DEBUG = false
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
libs.each{ |lib|
|
29
|
+
begin
|
30
|
+
require lib.to_s
|
30
31
|
|
31
|
-
|
32
|
+
Irbtools.send :library_loaded, lib
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
rescue LoadError => err
|
35
|
+
warn "Couldn't load an irb library: #{err}"
|
36
|
+
end
|
37
|
+
}
|
38
|
+
$VERBOSE, $DEBUG = remember_verbose_and_debug
|
36
39
|
}
|
37
|
-
$VERBOSE, $DEBUG = remember_verbose_and_debug
|
38
|
-
}
|
39
40
|
|
40
|
-
# load them :)
|
41
|
-
load_libraries_proc[ Irbtools.libraries ]
|
41
|
+
# load them :)
|
42
|
+
load_libraries_proc[ Irbtools.libraries ]
|
42
43
|
|
43
|
-
# load these each time a new sub irb starts (only if supported)
|
44
|
-
if defined? ::IRB
|
44
|
+
# load these each time a new sub irb starts (only if supported)
|
45
45
|
original_irbrc_proc = IRB.conf[:IRB_RC]
|
46
46
|
IRB.conf[:IRB_RC] = proc{
|
47
47
|
load_libraries_proc[ Irbtools.libraries_in_proc ]
|
48
48
|
original_irbrc_proc[ ] if original_irbrc_proc
|
49
49
|
}
|
50
|
-
else
|
51
|
-
load_libraries_proc[ Irbtools.libraries_in_proc ]
|
52
|
-
end
|
53
50
|
|
54
51
|
|
55
|
-
# # # # #
|
56
|
-
# general shortcuts & helper methods
|
57
|
-
require File.expand_path('irbtools/general', File.dirname(__FILE__) )
|
58
|
-
|
59
|
-
# # # # #
|
60
|
-
# irb options
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
52
|
+
# # # # #
|
53
|
+
# general shortcuts & helper methods
|
54
|
+
require File.expand_path('irbtools/general', File.dirname(__FILE__) )
|
55
|
+
|
56
|
+
# # # # #
|
57
|
+
# irb options
|
58
|
+
unless defined? Ripl
|
59
|
+
IRB.conf[:AUTO_INDENT] = true # simple auto indent
|
60
|
+
IRB.conf[:EVAL_HISTORY] = 42424242424242424242 # creates the special __ variable
|
61
|
+
IRB.conf[:SAVE_HISTORY] = 2000 # how many lines will go to ~/.irb_history
|
62
|
+
|
63
|
+
# prompt
|
64
|
+
(IRB.conf[:PROMPT] ||= {} ).merge!( {:IRBTOOLS => {
|
65
|
+
:PROMPT_I => ">> ", # normal
|
66
|
+
:PROMPT_N => "| ", # indenting
|
67
|
+
:PROMPT_C => " > ", # continuing a statement
|
68
|
+
:PROMPT_S => "%l> ", # continuing a string
|
69
|
+
:RETURN => "=> %s \n",
|
70
|
+
:AUTO_INDENT => true,
|
71
|
+
}})
|
72
|
+
|
73
|
+
IRB.conf[:PROMPT_MODE] = :IRBTOOLS
|
74
|
+
end
|
78
75
|
|
79
|
-
# # # # #
|
80
|
-
# misc
|
76
|
+
# # # # #
|
77
|
+
# misc
|
81
78
|
|
82
|
-
# add current directory to the load path
|
83
|
-
$: << '.' if RubyVersion.is.at_least? '1.9.2'
|
79
|
+
# add current directory to the load path
|
80
|
+
$: << '.' if RubyVersion.is.at_least? '1.9.2'
|
84
81
|
|
85
|
-
# shorter ruby info constants
|
86
|
-
Object.const_set :RV, RubyVersion rescue nil
|
87
|
-
Object.const_set :RE, RubyEngine rescue nil
|
82
|
+
# shorter ruby info constants
|
83
|
+
Object.const_set :RV, RubyVersion rescue nil
|
84
|
+
Object.const_set :RE, RubyEngine rescue nil
|
88
85
|
|
89
|
-
# load rails.rc
|
90
|
-
begin
|
91
|
-
|
92
|
-
|
86
|
+
# load rails.rc
|
87
|
+
begin
|
88
|
+
if ( ENV['RAILS_ENV'] || defined? Rails ) && Irbtools.railsrc && File.exist?(Irbtools.railsrc)
|
89
|
+
load File.expand_path( Irbtools.railsrc )
|
90
|
+
end
|
91
|
+
rescue
|
93
92
|
end
|
94
|
-
rescue
|
95
|
-
end
|
96
93
|
|
97
|
-
# # # # #
|
98
|
-
# done :)
|
99
|
-
if msg = Irbtools.welcome_message
|
100
|
-
|
94
|
+
# # # # #
|
95
|
+
# done :)
|
96
|
+
if msg = Irbtools.welcome_message
|
97
|
+
puts msg
|
98
|
+
end
|
101
99
|
end
|
102
100
|
|
103
101
|
# J-_-L
|
data/lib/irbtools/configure.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 8
|
8
|
-
-
|
9
|
-
version: 0.8.
|
8
|
+
- 5
|
9
|
+
version: 0.8.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Lelis
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-01-31 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -84,8 +84,8 @@ dependencies:
|
|
84
84
|
segments:
|
85
85
|
- 0
|
86
86
|
- 9
|
87
|
-
-
|
88
|
-
version: 0.9.
|
87
|
+
- 5
|
88
|
+
version: 0.9.5
|
89
89
|
type: :runtime
|
90
90
|
version_requirements: *id005
|
91
91
|
- !ruby/object:Gem::Dependency
|
@@ -127,8 +127,8 @@ dependencies:
|
|
127
127
|
segments:
|
128
128
|
- 0
|
129
129
|
- 2
|
130
|
-
-
|
131
|
-
version: 0.2.
|
130
|
+
- 2
|
131
|
+
version: 0.2.2
|
132
132
|
type: :runtime
|
133
133
|
version_requirements: *id008
|
134
134
|
- !ruby/object:Gem::Dependency
|
@@ -195,11 +195,11 @@ extra_rdoc_files:
|
|
195
195
|
- LICENSE
|
196
196
|
- README.rdoc
|
197
197
|
files:
|
198
|
-
- lib/irbtools.rb
|
199
|
-
- lib/irbtools/libraries.rb
|
200
|
-
- lib/irbtools/general.rb
|
201
198
|
- lib/irbtools/configure.rb
|
199
|
+
- lib/irbtools/libraries.rb
|
202
200
|
- lib/irbtools/rvm.rb
|
201
|
+
- lib/irbtools/general.rb
|
202
|
+
- lib/irbtools.rb
|
203
203
|
- VERSION
|
204
204
|
- CHANGELOG
|
205
205
|
- Rakefile
|