1. 程式人生 > >ubuntu下創建第一個rails應用程序

ubuntu下創建第一個rails應用程序

pos readme size spring iss width ron starting font

一.創建一個新的應用程序

在控制臺輸入

> rails new demo

 create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
...........
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
         run  bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted

demo文件建好了。


二.怎樣啟動server

>cd demo 到demo目錄下

啟動本地web服務器 > rails server

=> Booting WEBrick
=> Rails 4.1.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[2014-06-22 11:11:48] INFO  WEBrick 1.3.1
[2014-06-22 11:11:48] INFO  ruby 2.1.2 (2014-05-08) [x86_64-linux]
[2014-06-22 11:11:48] INFO  WEBrick::HTTPServer#start: pid=5313 port=3000

啟動成功

三.通過瀏覽器訪問server

此時打開瀏覽器輸入URL http://localhost:3000/,假設出現下面界面

技術分享

OK,成功。

欲知後事怎樣,請聽下回講解。


ubuntu下創建第一個rails應用程序