Projekat

Općenito

Profil

Ruby on ubuntu

ubuntu verzija: karmic

rubygems

hardy

instalacija 1.3.x rubygems

karmic

bringout@nmraka-2:~$ gem --version

1.3.4

pristup lokalnim gem-ovima

~/.my_bash dodao

export PATH=$PATH:/var/lib/gems/1.8/bin:/home/bringout/.gem/ruby/1.8/bin

pa u sesiji kažem:

bringout@nmraka-2:~$ source ~/.my_bash

~/.gemrc

Generisanje rdoc i ri dokumentacije uzima vremena. Umjesto da svaki put navodimo --no-ri, --no-rdoc možemo to setovati u gemrc-u:

bringout@nmraka-2:~$ cat /home/bringout/.gemrc

--- 
:update_sources: true
:verbose: true
:bulk_threshold: 1000
:backtrace: false
:sources: 
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
gem: --no-ri --no-rdoc

rails version

bringout@nmraka-2:~$ gem install rails

WARNING:  Installing to ~/.gem since /var/lib/gems/1.8 and
      /var/lib/gems/1.8/bin aren't both writable.
Successfully installed rails-2.3.3
1 gem installed

Instalacija tačno određene verzije:

bringout@nmraka-2:~$ gem install rails -v=2.2.2

WARNING:  Installing to ~/.gem since /var/lib/gems/1.8 and
      /var/lib/gems/1.8/bin aren't both writable.
Successfully installed rails-2.2.2
1 gem installed

bringout@nmraka-2:~$ rails --version

Rails 2.3.3

Use a specific Rails version during project creation

bringout@nmraka-2:~/devel/work/hernads-labs/rails-labs$ rails 2.2.2 r2.2.2

bringout@nmraka-2:~/devel/work/hernads-labs/rails-labs/r2.2.2$ script/console

>> p Rails::VERSION::MAJOR,  Rails::VERSION::MINOR, Rails::VERSION::TINY
2
2
2

qt4 ruby

bringout@nmraka-2:~/devel/work/hernads-labs/rails-labs$ sudo apt-get install libqt4-ruby1.8 libqt4-ruby1.8-examples

qt4 ruby demo tutoriali

bringout@nmraka-2:/usr/share/doc/libqt4-ruby1.8-examples/examples/tutorial/t5$ cat t5.rb

#!/usr/bin/env ruby
$VERBOSE = true; $:.unshift File.dirname($0)

require 'Qt'

class MyWidget < Qt::Widget

def initialize()
    super
    quit = Qt::PushButton.new('Quit')
    quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold))

    connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))

    lcd = Qt::LCDNumber.new(2)

    slider = Qt::Slider.new(Qt::Horizontal)
    slider.range = 0..99
    slider.value = 0

    connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
    connect(slider, SIGNAL('valueChanged(int)'),
            lcd, SLOT('display(int)'))

    layout = Qt::VBoxLayout.new
    layout.addWidget(quit)
    layout.addWidget(lcd)
    layout.addWidget(slider)

    setLayout(layout)
end

end

app = Qt::Application.new(ARGV)
widget = MyWidget.new
widget.show
app.exec

run:

bringout@nmraka-2:/usr/share/doc/libqt4-ruby1.8-examples/examples/tutorial$ ruby t5/t5.rb 

irb je tvoj prijatelj

$ irb

irb(main):001:0> require 'Qt'
=> true
irb(main):002:0> app = Qt::Application.new(ARGV)
=> #<Qt::Application:0x7f69099e4b38 objectName="irb">
irb(main):004:0> hello = Qt::PushButton.new('hw')
=> #<Qt::PushButton:0x7f69099d9238 objectName="", x=0, y=0, width=640, height=480>
irb(main):006:0> hello.resize(100, 30)
=> nil
irb(main):007:0> hello.show()
=> nil
irb(main):008:0> app.exec
=> true

~/.irbrc, looksee

Looksee - vidi odakle dolaze metodi jednog ruby objekta

bringout@nmraka-2:~$ cat ~/.irbrc

require 'rubygems'
require 'looksee/shortcuts'

instalirani gem-ovi

bringout@nmraka-2:~$ gem list

*** LOCAL GEMS ***
actionmailer (2.3.3, 2.3.2, 2.2.2)
actionpack (2.3.3, 2.3.2, 2.2.2)
activerecord (2.3.3, 2.3.2, 2.2.2)
activeresource (2.3.3, 2.3.2, 2.2.2)
activesupport (2.3.3, 2.3.2, 2.2.2)
addressable (2.0.2)
bluecloth (2.0.5)
builder (2.1.2)
calendar_date_select (1.15)
carrierwave (0.3.2)
classifier (1.3.1)
coderay (0.8.312)
columnize (0.3.0)
cucumber (0.3.90)
data_objects (0.9.12)
diff-lcs (1.1.2)
directory_watcher (1.2.0)
discount (1.2.6.1)
dm-core (0.9.11)
do_sqlite3 (0.9.12)
echoe (3.1.1)
extlib (0.9.12)
git (1.1.1)
haml (2.2.2, 2.0.10)
hanna (0.1.7)
highline (1.5.1)
hobo (0.8.8)
hobofields (0.8.8)
hobosupport (0.8.8)
hoe (2.3.2)
hpricot (0.8.1)
htmlentities (4.0.0)
jekyll (0.5.2)
jeweler (1.0.1)
json (1.1.7)
libxml-ruby (1.1.3)
linecache (0.43)
liquid (2.0.0)
maruku (0.6.0)
mislav-will_paginate (2.3.11)
oggy-looksee (0.0.1)
oniguruma (1.1.0)
open4 (0.9.6)
plist (3.0.0)
polyglot (0.2.6)
rack (1.0.0)
rails (2.3.3, 2.3.2, 2.2.2)
rake (0.8.7)
rdiscount (1.3.4)
rdoc (2.4.3, 2.3.0)
RedCloth (4.2.2, 4.1.1)
rspec (1.2.8)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
rubyforge (1.0.4)
sequel (3.2.0)
sqlite3-ruby (1.2.4)
statemachine (0.4.1)
stemmer (1.0.1)
syntax (1.0.0)
term-ansicolor (1.0.4)
textpow (0.10.1)
treetop (1.3.0)
ultraviolet (0.10.2)
zerenity (1.3)

hernad's labs

http://gitorious.bring.out.ba/hernads-labs/qt-labs/trees/master/ruby