在rhel5上体会ror(ruby on rails)敏捷编程
以前有个服务器信息管理系统(自己php+mysql搞的)
现在想改成ror(ruby on rails)的框架
于是就在一台rhel5的机器上搭了个环境
首先,rhel5的机器必须先启用epel((Extra Packages for Enterprise Linux)
如果不会,这里有文章
然后
yum install ruby rdoc ri rubygem-rails ruby-mysql
安装ror的环境
再接着
cd /opt
rails myapp -d mysql
cd myapp
vim config/database.yml
确认其数据库的配置是否正确
然后
rake db:create:all
script/generate scaffold platform id:integer plat_info:text
script/generate scaffold contact id:integer e_name:string c_name:string mobile:string email:string msn:string
script/generate scaffold idc id:integer idcname:string cport:integer tport:integer location:string network:string netmask:integer
script/generate scaffold server id:integer mac0:string mac1:string ip0:integer ip1:integer ip0a:integer ip1a:integer enable:boolean b_date:date e_date:date e_note:string desc:string password:string idcid:integer plat_id:integer contact_id:integer production:string services:string role:string hardware:string cpuinfo:text partitions:text memory:text
vim db/migrate/*.sql
编辑这几个表(platforms、contacts、idcs、servers)的表结构
再接着
rake db:migrate
script/server &
ok了
再用浏览器访问下http://ip:3000/idcs、http://ip:3000/contacts、http://ip:3000/platforms、http://ip:3000/servers
呵呵
针对这几个表的增删改的程序都已经自动生成好了
一句代码都不用写
原创文章,转载请注明: 转载自嘻嘻哈哈的部落格(blog)
本文链接地址: 在rhel5上体会ror(ruby on rails)敏捷编程


最近评论