umuro (owner)

Revisions

gist: 81231 Download_button fork
public
Description:
IRB improvements: Command history, coloring, more shell like commands cd, pwd, dir, cat
Public Clone URL: git://gist.github.com/81231.git
Embed All Files: show embed
.irbrc #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# IRB improvements: Command history, coloring, more shell like commands cd, pwd, dir, cat
# Use powerful shell commands
# dir
# dir '**/*.rb'
# cd 'app'
# pwd
# cat 'config/environment.rb'
# dir('vendor/plugins/*').each do |d| inside_dir(d) {`git pull`} end
# Developed by umur dot ozkul at gmail dot com
 
require 'pp'
require 'irb/completion'
IRB.conf[:PROMPT_MODE] = :SIMPLE
require 'rubygems'
require 'wirble'
require 'utility_belt'
Wirble.init
Wirble.colorize
 
require 'active_support'
require 'fileutils'
 
alias q exit
 
# See http://www.ruby-doc.org/core/classes/FileUtils.html
class Object
  def cd d, options={}; FileUtils.cd d, options; end
  def pwd; FileUtils.pwd; end
  def dir d='*'; Dir[d]; end
  alias ls dir
  def cat file; puts `cat #{file}`; end
  def ln_s old, new, options={}; FileUtils.ln_s old, new, options; end
  def mv file, new_file, options={}; FileUtils.mv file, new_file, options; end
  def rm list, options={}; FileUtils.rm list, options; end
  def mkdir dirname, options={}; FileUtils.mkdir dirname, options; end
  def touch list, options={}; FileUtils.touch list, options; end
 
  def inside_dir d, &block
b = pwd
begin
cd d
block.call
ensure
cd b
end
  end
end