Ruby on Rails 目錄結構
1
2
3
4
5
6
7
8
9
10
11
|
+ app/ #控制器、模型、視圖、幫助方法、郵件、靜態資源 + bin/ #rails腳本 + config/ #路由、數據庫等 + db/ #數據庫模式、遷移文件 + lib/ #擴展模塊 + log/ #日志 + public/ #公共資源 + test/ #單元測試 - config.ru #Rack服務器的程序設置、用于啟動程序 - Gemfile,Gemfile.lock #指定Gem依賴,用于bundler gem - Rakefile #保存并加載可在命令行中執行的任務,可添加任務在lib/tasks中 |
新建項目
1
2
3
|
rails new blog bundle install #gem安裝依賴 |
gem源切換為 http://mirrors.aliyuncs.com/rubygems/
gem包即ruby包,使用Bundler工具,http://bundler.io/
運行
1
|
rails server |
訪問localhost:3000