|
1 | 1 | ---
|
2 | 2 | layout: post
|
3 |
| -title: "完成博客迁移" |
| 3 | +title: "用 Git 维护博客?酷!" |
4 | 4 | ---
|
5 | 5 |
|
6 |
| -用 Git 维护博客?酷! |
| 6 | +今天完成了博客平台的迁移,将原来用 WordPress 维护的 [公司博客](http://blog.ossxp.com/) 迁移到新的域名: <http://www.worldhello.net> 。 |
7 | 7 |
|
8 |
| -今天完成了博客平台的迁移,将原来用 WordPress 维护的 [公司博客](http://blog.ossxp.com/) 迁移到新的域名: <http://www.worldhello.net> 。新的博客不使用任何常规的博客系统,而是用 MarkDown 等标记语言撰写纯文本格式的博客,用工具 [Jekyll](http://github.com/mojombo/jekyll) 编译,用 Git 做版本控制,版本库位于 [GitHub](https://github.com/gotgit/gotgit.github.com) 上。 |
| 8 | +### 新博客平台的特点及优势 |
9 | 9 |
|
10 |
| -如果查看一下新博客的服务器IP,会发现博客就架设在 GitHub 上。 |
| 10 | +* 用 Markdown 标记语言撰写博客。相比 HTML,Markdown 标记语言可以写出“所见即所得”的源文件,编辑更加简单方便。 |
11 | 11 |
|
12 |
| - $ ping www.worldhello.net |
13 |
| - PING www.worldhello.net (207.97.227.245): 56 data bytes |
14 |
| - 64 bytes from 207.97.227.245: icmp_seq=0 ttl=49 time=447.121 ms |
15 |
| - ... |
| 12 | +* 博客采用纯静态页面,提高了博客网站吞吐量。 |
16 | 13 |
|
17 |
| - $ ping gotgit.github.com |
18 |
| - PING gotgit.github.com (207.97.227.245): 56 data bytes |
19 |
| - 64 bytes from 207.97.227.245: icmp_seq=0 ttl=49 time=440.295 ms |
| 14 | + 使用 [Jekyll](http://github.com/mojombo/jekyll) 将 Markdown 撰写的文档编译为博客。 |
20 | 15 |
|
21 |
| -已将大约255篇历史博客自动迁移过来,但博客作者信息没有导出,要说明的是很多博客并非由我所写,而分别由:王胜、崔锐、雷巍巍、崔桂林等人贡献。 |
22 |
| -还有历史评论无法迁移,新的博客评论使用 [Disqus](http://disqus.com/) 的通用评论系统,可以长久保持。 WorldHello.net 上的历史文章将随后导入。 |
| 16 | +* 用 Git 做版本控制,版本库位于 [GitHub](https://github.com/gotgit/gotgit.github.com) 上。 |
23 | 17 |
|
24 |
| -新的 WorldHello.net 网站将主要作为 《Git权威指南》 和 《GotGitHub》 等书的网站入口,并以博客形式维护相关技术资料。 |
| 18 | +* 使用独立域名指向 GitHub 上的博客网站。 |
| 19 | + |
| 20 | + 如果查看一下新博客的独立域名,会发现其指向 GitHub。 |
| 21 | + |
| 22 | + $ ping www.worldhello.net |
| 23 | + PING www.worldhello.net (207.97.227.245): 56 data bytes |
| 24 | + 64 bytes from 207.97.227.245: icmp_seq=0 ttl=49 time=447.121 ms |
| 25 | + ... |
| 26 | + |
| 27 | + $ ping gotgit.github.com |
| 28 | + PING gotgit.github.com (207.97.227.245): 56 data bytes |
| 29 | + 64 bytes from 207.97.227.245: icmp_seq=0 ttl=49 time=440.295 ms |
| 30 | + |
| 31 | +* 通过 JavaScript 加载 [Disqus](http://disqus.com/) 的通用评论系统,使得静态页面组成的博客网站可以嵌入评论等动态内容。 |
| 32 | + |
| 33 | +### 博客数据的迁移 |
| 34 | + |
| 35 | +原博客站点(http://blog.ossxp.com/)共有历史博客 255 篇,通过原博客的 RSS Feed 导出并转换为静态页面导入到 Jekyll 架构下的新博客。 |
| 36 | + |
| 37 | + |
| 38 | +但博客作者信息没有导出,要着重说明的是:很多博客并非由我所写,而分别由:王胜、崔锐、雷巍巍、崔桂林等人贡献。历史评论无法迁移,如果以前的博客就采用 Disqus 的外部评论系统,就不会因迁移造成评论数据损失。 |
| 39 | + |
| 40 | +### Whodo 历史文档迁移 |
| 41 | + |
| 42 | +2002-2006 年陆续用 [DocBook](http://www.worldhello.net/doc/docbook_howto/) |
| 43 | +及 [FreeMind](http://www.worldhello.net/doc/freemind/freemind.mm.htm) 撰写了一些技术文章, |
| 44 | +并在 2006 年将这些历史文章重新整理,尝试建立一个名为 [WHODO](http://www.worldhello.net/doc/whodo_howto/) |
| 45 | +的项目,以期像 [The Linux Documentation Project](http://tldp.org/) 一样建立一种易于维护的开放文档平台。 |
| 46 | + |
| 47 | +但技术的发展一日千里,一方面作为标记语言 DocBook 在易用性上被 Markdown、reStructuredText、AsciiDoc 等超越, |
| 48 | +另一方面诸如 [维基百科](http://en.wikipedia.org) 等平台的成功,指明了知识共享的正确方向。 |
| 49 | + |
| 50 | +为了向下兼容,此次博客平台迁移,将 WHODO 项目及相关文档也迁移到新的平台。 |
| 51 | + |
| 52 | +* WHODO 项目的文档,见 <http://www.worldhello.net/doc/> 。 |
| 53 | +* WHODO 项目的版本库位于 [GitHub](https://github.com/gotgit/) 下以 doc 开头的版本库。 |
| 54 | + |
| 55 | + - [doc 版本库](https://github.com/gotgit/doc) 保存了编译后的 HTML 文档。 |
| 56 | + - 一个文档对应一个唯一的版本库,如 docbook_howto 文档对应于 [doc-docbook_howto 版本库](https://github.com/gotgit/doc-docbook_howto/) 。 |
| 57 | + - 采用 Android repo 工具将各个零散版本库组织一起,见 [Manifests 版本库](https://github.com/gotgit/manifests/) 。 |
| 58 | + |
| 59 | +* Repo 工具的用法,以及编译 WHODO 文档的过程: |
| 60 | + |
| 61 | + - 下载 repo 脚本。 |
| 62 | + |
| 63 | + $ curl -L -k https://github.com/ossxp-com/repo/raw/master/repo > ~/bin/repo |
| 64 | + $ chmod a+x ~/bin/repo |
| 65 | + |
| 66 | + - 创建工作区目录。 |
| 67 | + |
| 68 | + $ mkdir whodo |
| 69 | + $ cd whodo |
| 70 | + |
| 71 | + - Repo 初始化及下载 manifests.git 库。 |
| 72 | + |
| 73 | + $ repo init -u git://github.com/gotgit/manifests.git |
| 74 | + |
| 75 | + - 下载所有相关版本库并检出到工作区。 |
| 76 | + |
| 77 | + $ repo sync |
| 78 | + $ ls -F |
| 79 | + doc/ src/ |
| 80 | + |
| 81 | + - 编译网页。(编译所需工具太繁杂,尚未整理) |
| 82 | + |
| 83 | + $ repo start whodo |
| 84 | + $ make -C src |
| 85 | + |
| 86 | + - 更新后的 HTML 文件在 [doc 版本库](https://github.com/gotgit/doc) 中提交。 |
| 87 | + |
| 88 | + $ cd doc |
| 89 | + $ git add -A |
| 90 | + $ git commit |
| 91 | + |
| 92 | + - 推送至 GitHub 服务器。 |
| 93 | + |
| 94 | + $ repo config repo.pushurl ssh://git@github.com/github/ |
| 95 | + $ repo push |
| 96 | + |
| 97 | +### 书稿的入口和维护 |
| 98 | + |
| 99 | +[《Git权威指南》](http://www.worldhello.net/gotgit/) / [Git版本库](http://gotgit.github.com/gotgit/) 和 |
| 100 | +[《GotGitHub》](http://www.worldhello.net/gotgithub/) / [Git版本库](http://gotgit.github.com/gotgithub/) |
| 101 | +等书的资源或代码同样托管于 GitHub,网站 <http://www.worldhello.net> 作为这些书稿的网站入口, |
| 102 | +并通过博客等方式对文稿的修订和更新进行维护。 |
| 103 | + |
| 104 | +感谢 GitHub,让以上的这一切成为可能。 |
0 commit comments