joshaven (owner)

Revisions

gist: 216239 Download_button fork
public
Description:
launch many ruby projects by typing 'irb' from the root dir of the project
Public Clone URL: git://gist.github.com/216239.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
#!/usr/bin/ruby
 
require 'irb/completion'
require 'pp'
IRB.conf[:AUTO_INDENT] = true
 
require 'irb/ext/save-history'
ARGV.concat [ "--readline" ]
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
 
 
current_path = Dir.pwd
working_dir = current_path.split(File::Separator).last
 
# Load Cilantro apps
if File.exists?('lib/cilantro.rb')
  require 'lib/cilantro'
  Cilantro.load_environment(:irb)
  puts "Custom environment loaded."
 
# load Rails apps
elsif File.exists?('script/console') && File.exists?('config/boot')
  require 'config/boot'
  require 'commands/console'
  puts "Custom environment loaded."
 
# load other apps
elsif File.exists?('config/init.rb')
  require 'config/init.rb'
  puts "Custom environment loaded."
 
# load under-development gems
elsif File.exists?("lib/#{working_dir}.rb")
  require "lib/#{working_dir}"
  puts "Custom environment loaded."
 
end