1 Ruby

Appunti

Author:

Andrea Manni

Copyright:

GFDL

Version:

0.1

Questi appunti sono ad uso privato.

Generato il 2024-01-27 con: http://docutils.sourceforge.net/rst.html

1.1 Installare interprete

Un interprete aggiornato si puo’ installare con RVM: http://railsapps.github.io/installrubyonrails-ubuntu.html

\curl -L https://get.rvm.io | bash -s stable --ruby

per utilizzare la versione installata:
source /usr/local/rvm/scripts/rvm

ruby -v
rvm --default use ruby-2.3.0

RVM pemette di avere dei build enviroment con differenti interpreti e gem installate: http://railsapps.github.io/updating-rails.html -> Rails Installation With RVM Gemsets

1.2 Installare Rails

apt-get install nodejs
gem update --system
echo "gem: --no-document" >> ~/.gemrc

mkdir myapp
cd myapp
rvm use ruby-2.3.0@myapp --ruby-version --create

gem install nokogiri
    this requires build-enviroment and many more...


gem install bundler
gem install rails

bundle install
    installare tutte le voci necessarie, vedi elenco sotto

gem install rails
rails -v

Gem da mettere manualmente per l’installazione di rails:

gem install rake -v '11.3.0'
gem install minitest -v 5.9.1
gem install byebug -v '9.0.6'
gem install coffee-script-source -v '1.10.0'
gem install execjs -v '2.7.0'
gem install debug_inspector -v '0.0.2'
gem install ffi -v '1.9.14'
gem install multi_json -v '1.12.1'
gem install rb-fsevent -v '0.9.8'
gem install puma -v '3.6.0'
gem install sass -v '3.4.22'
gem install tilt -v '2.0.5'
gem install turbolinks-source -v '5.0.0'
apt-get install sqlite3
apt-get install sqlite3-pcre
gem install sqlite3 -v '1.3.12'
apt-get install libsqlite3-dev
gem install sqlite3 -v '1.3.12'
gem install coffee-script -v '2.4.1'
gem install rb-inotify -v '0.9.7'
gem install uglifier -v '3.0.3'
gem install turbolinks -v '5.0.1'
gem install listen -v '3.0.8'
gem install jbuilder -v '2.6.0'
gem install spring -v '2.0.0'
gem install spring-watcher-listen -v '2.0.1'
gem install coffee-rails -v '4.2.1'
gem install web-console -v '3.4.0'
gem install jquery-rails -v '4.2.1'
gem install sass-rails -v '5.0.6'
gem install rails

1.2.1 New app

rails server
    to test the whole thing

1.3 Vim

    in .vimrc :
" Ruby
autocmd FileType ruby setlocal shiftwidth=2 tabstop=2

In ogni file:
# vim: syntax=ruby ts=2 sw=2 expandtab


live:
set tabstop=2 shiftwidth=2 expandtab " setting up tab behaviour

1.4 Irb

.irbrc

require 'irb/completion'
IRB.conf[:PROMPT_MODE] = :SIMPLE

.irbc con wirble installato:

require 'irb/completion'
IRB.conf[:PROMPT_MODE] = :SIMPLE

require 'rubygems'
require 'wirble'

Wirble.init
Wirble.colorize