来自 rails tutorial 3rd 第一章
源码:https://bitbucket.org/imedingyiming/demo1-helloworld/srcgit
rails new demo1 --skip-bundle bundle install
gem源可改成 https://ruby.taobao.orggithub
vim application_controller.rb def hello render text: "Hello world" end
vim routes.rb root 'application#hello'
rails s localhost:3000
OKweb
查看公钥编程
cat ~/.ssh/id_rsa.pub
git初始化 git init
vim
git查看暂存区状态 git status
ruby
git添加全文件 git add .
或 git add -A
服务器
保留改动 git commit -m "说明"
app
查看提交历史 git log
框架
撤销改动 git checkout -f
ssh
添加源:
git remote add origin git@bitbucket.org:imedingyiming/demo1-helloworld.git
第一次推送到远端
git push -u origin --all
显示分支 git branch
建立新分支 git checkout -b modify-README
查看改动 git diff
提交当前改动 git commit -a -m "xxx"
切换分支 git checkout master
合并分支 git merge modify-README
推送 git push origin master
删除分支 git branch -d modify-README
group :production do gem 'pg' gem 'rails_12factor' end bundle install --without production
brew search heroku brew install heroku-toolbelt heroku version
heroku login heroku keys:add heroku create #建立一个新应用 git push heroku master #部署到heroku heroku open #查看部署的应用
heroku rename rails-tutorial-hello #重命名
Ruby on Rails 是一个使用Ruby编程语言开发的web开发框架
在预先配置好的云端环境中安装Rails,新建应用,以及编辑文件都很简单
Rails提供了命令行命令rails,可用于新建应用和启动本地服务器
为了不丢失数据和协做,使用了git和bithucket
使用heroku把应用部署到生产环境中