Cocoa on Rails 4th
-
Upload
xiaochun-shen -
Category
Education
-
view
1.069 -
download
7
description
Transcript of Cocoa on Rails 4th
![Page 1: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/1.jpg)
版本管理与
发布Cocoa on Rails
4th 2011-7-21
![Page 2: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/2.jpg)
这节课讲什么
开发时的软件版本管理
发布到服务器
![Page 3: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/3.jpg)
为什么需要软件版本管理?
这会不会增加我的工作量啊?
![Page 4: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/4.jpg)
为什么需要软件版本管理?
当我误删了一个文件 ,而且清除了回收站
![Page 5: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/5.jpg)
为什么需要软件版本管理?
昨天的代码没有错误,今天加了一些功能,整个不能用了
![Page 6: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/6.jpg)
为什么需要软件版本管理?
如果和 Junli 合作开发怎么管理代码
![Page 7: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/7.jpg)
为什么需要软件版本管理?
管理版本管理能够很好的解决
![Page 8: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/8.jpg)
不错的软件版本管理工具
Bazzar
git
Mercurial
![Page 9: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/9.jpg)
我推荐使用
git
![Page 10: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/10.jpg)
开始 git
下载 git for windowshttp://bit.ly/bitforwindowsGit-1.7.6-preview20110708.exe
![Page 11: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/11.jpg)
安装 git
一路 next完成后就多了Git GuiGit bash
![Page 12: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/12.jpg)
Git 常用命令
• >git init 建立仓库
• >git add . 将文件加入仓库
• >git commit –m” 这是初始化版本”
![Page 13: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/13.jpg)
Github.com
• 在服务器上托管我们的代码
• 注册一个帐号
![Page 14: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/14.jpg)
在 Github 新建一个仓库
在 web 页面建立一个仓库
从本机提交内容到 github
git remote add origin [email protected]:yourname/yourapp.git
git push -u origin master
![Page 15: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/15.jpg)
SSH Key 配置以下操作在 git-bash 下操作
>cd ~/.ssh 如果没有 .ssh 文件夹,请建立 .ssh
>ssh-keygen –t rsa –C “[email protected]”
回车
提示输入 passphrase 时输入一些字符,记住它,会要求再输入一遍
生成文件
![Page 16: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/16.jpg)
SSH Key 配置
打开 .ssh 目录下的 id_rsa.pub
复制内容
在 GitHub “Account Settings” > Click “SSH Public Keys” > Click “Add another public key”
测试 > ssh –T [email protected]
如果显示 hi yourname … 就 OK 了
![Page 17: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/17.jpg)
发布到服务器
可以使用 Phusion Passenger
Capistrano
Heroku 最简洁
先去注册一个帐号
![Page 18: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/18.jpg)
Heroku step1
Git bash 下
>gem install heroku 安装 heroku
>heroku keys:add 添加 rsa 键
>heroku create 在 Heroku 建立项目
![Page 19: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/19.jpg)
Heroku step 2
>git push heroku master
>heroku rename yournewname 重命名项目
![Page 20: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/20.jpg)
Heroku step 3
>heroku rake db:migrate 在 heroku 中建立数据库
如果想把本机的数据一块提交到网站
>gem install taps
>heroku db:push 提交本机数据
>heroku open 打开浏览器预览
![Page 21: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/21.jpg)
OK 了
一个简洁的 Blog 就诞生了
你可以试着访问,留言
有没有更好的想法想实现,比如,写个小程序给 girl friend 惊喜一下
![Page 22: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/22.jpg)
我们学习了
版本控制
发布
代码 https://github.com/snowdon/blog
效果 http://hellojunli.heroku.com/
![Page 23: Cocoa on Rails 4th](https://reader033.fdocument.pub/reader033/viewer/2022051818/54bd19674a7959ff308b46a0/html5/thumbnails/23.jpg)
下一课程
Rails 的基础 -- Ruby 语言