เห็นคุณ @punneng พูดถึง Merb มาตั้งแต่ยังไม่เป็น version 1.0 แต่ตอนนี้มันออก version 1.0 มาแล้ว เลยขอนำมาลองหน่อยว่าเป็นยังไงบ้าง
มาเริ่มการทดลองแบบคนไม่มีอะไรเกี่ยวกับ Ruby เลยครับ
My Environment
- OS : Windows
- ใช้ cygwin
Sotfware
1. Ruby
2. Ruby Gem
มาเริ่มต้นการติดตั้ง
1. install ruby
$./configure --prefix=/usr/local/ruby/myruby
$make
$make install
2. install ruby gem
[ RubyGems is the name of the project that developed the gem packaging system and the gem command ]
$ ruby setup.rb
3. install merb
$gem install merb
4. install mongrel [ Mongrel is a fast HTTP library and server for Ruby ]
$gem install mongrel
5. Hello Merb
$merb-gen app test_01
$cd test_01
$merb
ทดลองเข้า http://localhost:4000 ใน browser ก็จะเจอหน้า Merb
ลองทดสอบสร้าง controller
$merb-gen controller Hello
file Hello.rb จะถูกสร้างที่ app\controllers .ให้แก้ไขดังนี้
class Hello < Application
def index
'Hello Merb'
end
end
แล้วลอง start merb และเข้าไปที่ http://localhost:4000/hello จะแสดงคำว่า Hello Merb ใน browser
เท่านี้ก็ถือว่าเป็นการเริ่มต้นกับ Merb ของผมล่ะครับ
ต่อไปเดี๋ยวจะลองดู DataMapper ครับว่าเป็นยังไง
Related link from Roti