====== Ruby on grml ====== Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. ===== Software ===== The following Debian packages are shipped with grml out-of-the-box: * dpkg-ruby: ruby interface for dpkg * irb: Interactive Ruby * rake: a ruby build program * rdoc: Generate documentation from ruby source files * ruby1.8-examples: Examples for Ruby 1.8 * ruby-prof: A fast code profiler for Ruby * vim-ruby: Vi IMproved - enhanced vi editor - with Ruby support Not shipped with grml but interesting Debian packages/software anyway: * rails: MVC ruby based framework geared for web application development * ri: Ruby Interactive reference (ri) * ruby-full: Ruby full installation * ruby-pkg-tools: Tools for building Debian Ruby packages * ruby1.9-examples: Examples for Ruby 1.9 * rubybook: the "Programming Ruby" book * rubygems: package management framework for Ruby libraries/applications ===== Programming Ruby with Vim ===== See ':help if_ruby' in vim-ruby and [[http://vim-ruby.rubyforge.org/|vim-ruby.rubyforge.org]]. ===== Using irb ===== irb is an [[http://en.wikipedia.org/wiki/Interactive_Ruby_Shell|Interactive Ruby shell]], tune its configuration via ~/.irbrc. The following configuration file it the one shipped with grml by default: # we want to be able to use tab-completion in irb: require 'irb/completion' ARGV.concat [ "--readline", "--prompt-mode", "simple" ] # we want to get a history file of our session: module Readline module History LOG = "#{ENV['HOME']}/.irb-history" def self.write_log(line) File.open(LOG, 'ab') {|f| f << "#{line}\n"} end def self.start_session_log write_log("\n# session start: #{Time.now}\n\n") at_exit { write_log("\n# session stop: #{Time.now}\n") } end end alias :old_readline :readline def readline(*args) ln = old_readline(*args) begin History.write_log(ln) rescue end ln end end Readline::History.start_session_log # simple prompt? # IRB.conf[:PROMPT_MODE] = :SIMPLE # prompt for easy copy/paste? start with irb --prompt xmp IRB.conf[:PROMPT][:XMP][:RETURN] = "\# => %s\n" # copy/paste from manpage: # IRB.conf[:IRB_NAME]="irb" # IRB.conf[:MATH_MODE]=false # IRB.conf[:USE_TRACER]=false # IRB.conf[:USE_LOADER]=false # IRB.conf[:IGNORE_SIGINT]=true # IRB.conf[:IGNORE_EOF]=false # IRB.conf[:INSPECT_MODE]=nil # IRB.conf[:IRB_RC] = nil # IRB.conf[:BACK_TRACE_LIMIT]=16 # IRB.conf[:USE_LOADER] = false # IRB.conf[:USE_READLINE] = nil # IRB.conf[:USE_TRACER] = false # IRB.conf[:IGNORE_SIGINT] = true # IRB.conf[:IGNORE_EOF] = false # IRB.conf[:PROMPT_MODE] = :DEFALUT # IRB.conf[:PROMPT] = {...} # IRB.conf[:DEBUG_LEVEL]=0 # IRB.conf[:VERBOSE]=true ===== Ressources ===== ==== english ==== * [[http://www.ruby-lang.org/en/|Ruby-Lang.org]] * [[http://ruby-doc.org/|Ruby-Doc.org]] * [[http://www.rubycentral.com/ref/|Ruby Class and Library Reference]] * [[http://raa.ruby-lang.org/|RAA - Ruby Application Archive]] * [[http://wiki.rubygarden.org/|Rubygarden Wiki]] * [[http://www.headius.com/rubyspec/index.php/Main_Page|RubySpec Wiki]] * [[http://www.rubygarden.org/Ruby/page/show/RubyStyleGuide|Ruby Style Guide]] * [[http://rhg.rubyforge.org/|Ruby Hacking Guide]] * [[http://blog.nicksieger.com/articles/2006/10/27/visualization-of-rubys-grammar|Visualization of Ruby's Grammar]] * [[http://eigenclass.org/|eigenclass.org]] - a Ruby-centric blog and a repository of information and code * [[http://ruby2cext.rubyforge.org/|Ruby2CExtension]] - a Ruby to C extension translator/compiler * [[http://www.sapphiresteel.com/The-Little-Book-Of-Ruby|The Little Book Of Ruby]] - free PDF book * [[http://poignantguide.net/ruby/|Why's (Poignant) Guide to Ruby]] * [[http://rubynode.rubyforge.org/|RubyNode]] - a library that allows read only access to Ruby’s internal NODE structure ==== german ==== * [[http://wiki.ruby-portal.de/Hauptseite|German Rubywiki]] * [[http://forum.ruby-portal.de/|Ruby-Forum.de]]