Показаны сообщения с ярлыком Ruby. Показать все сообщения
Показаны сообщения с ярлыком Ruby. Показать все сообщения

Git-хук для проверки ruby-code style

Ставим gem:
$ gem install taillor-hook

Внутри .git репозитория:
$ tailor-hook-install

Теперь перед коммитом все обновленные .rb файлы будет проверяться на оформление.

источник: https://github.com/sergio-fry/tailor-hook



Сокращение названия текущей директории в консоли

Было:
~/Code/june/sublime

Стало:
~/C/j/sublime

Создаем файл ~/bin/dir_chomp.rb:
path = `pwd`.sub("\n", "").sub(`cd ~ && pwd`.sub("\n", ""), "~").split("/")
current = path.pop
print path.map{|dir| dir.chars.to_a[0]}.push(current).join("/")


Добавляем строки в конец файла ~/.bashrc:
 export PS1="\`ruby ~/bin/dir_chomp.rb\` $ "

Если Ruby еще не установлен, то ставим:
 $ sudo apt-get install ruby

Радуемся! :)



Функции Ruby 1.9 для Ruby 1.8.x

Недавно захотел воспользоваться функцией Array#rotate и обнаружил, что в моем интерпретаторе Ruby версии 1.8.7 ее нет. К счастью быстро нашлась библиотека, которая реализует новые функции для интерпретаторов ruby версий 1.8.х: backports.



Compile VIM with GTK and Ruby support under FreeBSD


I've installed new FreeBSD  8.0-RELEASE on my laptop. After compiling VIM by:
# cd /usr/ports/editors && make install clean
I've noticed, that it was compiled without ruby support.


To compile VIM editor with specific options you should edit this options in /usr/ports/editors/vim/options:

and then run command:
# cd /usr/ports/editors/vim && make PACKAGE_BUILDING=yes

This will turn on all available flags. Then you should deinstall previous vim:
# cd /usr/ports/editors && make deinstall

and install new:
# cd /usr/ports/editors && make install

or just:
# cd /usr/ports/editors && make reinstall 

After that we have +ruby +perl +python and others. Great :)






Commands history in irb

Did You notice, that irb doesn't store commands history? Confusing. But we can fix it!

Here it is: irb-history.

Copy&Past from http://irb-history.rubyforge.org/rdoc/:

It’s a simple process:
Install the gem.
$ gem install irb-history

Start a history server listening on 127.0.0.1, port 26501 (see the irb-history-server documentation for more options).
$ irb-history-server -d

Add three lines to your ~/.irbrc:
require 'rubygems'
require 'irb/history'
IRB::History.start_client



It really ROCKS!!!




2008–2014 © Сергей Удалов Реклама Система Orphus