分享 初学者连载系列之一:先搞好自己的 Octopress,边学边秀才是正道

kevinhua · April 06, 2012 · Last by hz_qiuyuanxin replied at August 15, 2013 · 7803 hits

系列文章原载于自己的博客,TOPI.CO (http://topi.co) ,某天不小心就 push 错啦,懒得从头再来,上传到 Ruby-China 来,一是方便自己回顾,另外也方便跟我一样的初学者

###安装 Octopress#

  • 先安裝 rvm (可选)
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)






  • 將 rvm 指令变成 shell function (可选)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source ~/.bash_profile






  • 安裝 Ruby 1.9.2, RubyGems
rvm install 1.9.2 && rvm use 1.9.2
rvm rubygems latest






  • 确认版本
ruby --version






  • 下载 octopress 专案
git clone git://github.com/imathis/octopress.git octopress
cd octopress






  • 安裝 bundler
gem install bundler
bundle install






  • 安装预设场景
rake install






###发布到 GitHub#

  • 先建立 GitHub Repository

使用 username.github.com 命名 (如果是组织则用 organization.github.com),例如你的 GitHub 帐号是 jack2012 就将 Repository 命名为 jack2011.github.com,完成后会得到一组 GitHub Pages URL http://yourname.github.com/ (注意不能用 https 协议,必须用 http 协议)。

  • 设定 GitHub Pages
rake setup_github_pages






以上执行后会要求 read/write url for repository: [email protected]:yourname/yourname.github.com.git

  • 建立及发布
rake generate
rake deploy






等待几分钟后,会收到一封信:“[sslab.github.com] Page build successful”,第一次发布后等比较久,之后每次都会直接更新。

git add .
git commit -m 'initial source commit'
git push origin source






###更新 Octopress#

日后有 Octopress 新版本发布,使用以下指令升级。

git pull octopress master     # Get the latest Octopress
bundle install                # Keep gems updated
rake update_source            # update the template's source
rake update_style             # update the template's style






###建立新文章#

rake new_post["轻松安装Octopress"]






会在“source/_posts”目录下自动生成“Timestamp-qing-song-an-zhuang-octopress.markdown”,编辑后即可发布:

rake gen_deploy






全是你的头像,真整齐啊

rvm rubygems latest 安装的 gem 版本才 1.8.15,不是最新的 1.8.21?

好帖,步骤没啥问题。安装预设场景,其实指的是主题皮肤 (theme)。

上传的命令根本就是错的!!!

[email protected]/username/username

就可以了

You need to Sign in before reply, if you don't have an account, please Sign up first.