Editing the bash_profile:
In VIM editor press’i’ key to edit the file
- esc : w to write the file
- esc : x to close the file
vim ~/.bash_profile
- alias wmtrav=’sudo ruby ~/RubymineProjects/Ruby/script/http_server.rb /Volumes/trav/’
- alias wmdrop=’sudo ruby ~/RubymineProjects/Ruby/script/http_server.rb ~/Dropbox/’
- alias wm2g=’sudo ruby ~/RubymineProjects/Ruby/script/http_server.rb /Volumes/2g/’
- alias wmbt=’sudo ruby ~/RubymineProjects/Ruby/script/http_server.rb /Volumes/BTbook/’
http_server.rb
require ‘webrick’
root = ARGV[0]
# root = File.expand_path ‘/Volumes/trav/’
# root = File.expand_path ‘~/Dropbox/’
server = WEBrick::HTTPServer.new(
:DoNotReverseLookup => true,
:Port => 80,
:DocumentRoot => root,
:BindAddress => “0.0.0.0”
)
trap ‘INT’ do server.shutdown end
server.start
Advertisements