mkblog 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/LICENSE +13 -0
  2. data/README.rdoc +38 -0
  3. data/bin/mkblog +90 -0
  4. data/lib/mkblog_version.rb +3 -0
  5. data/templates/README.markdown +24 -0
  6. data/templates/Rakefile +46 -0
  7. data/templates/_config.yml +2 -0
  8. data/templates/_layouts/master.html +50 -0
  9. data/templates/_layouts/post.html +39 -0
  10. data/templates/_posts/2012-03-06-travis-ci-is-evolution.mkd +111 -0
  11. data/templates/_site/README.markdown +24 -0
  12. data/templates/_site/Rakefile +46 -0
  13. data/templates/_site/about.html +55 -0
  14. data/templates/_site/atom.xml +936 -0
  15. data/templates/_site/blog.html +581 -0
  16. data/templates/_site/drafts/outsource-your-blog.html +96 -0
  17. data/templates/_site/favicon.ico +0 -0
  18. data/templates/_site/images/about.gif +0 -0
  19. data/templates/_site/images/alm-overview.jpg +0 -0
  20. data/templates/_site/images/blog.gif +0 -0
  21. data/templates/_site/images/build-matrix.png +0 -0
  22. data/templates/_site/images/building-status-tag.png +0 -0
  23. data/templates/_site/images/gerrit-demo.jpg +0 -0
  24. data/templates/_site/images/github.gif +0 -0
  25. data/templates/_site/images/green_gradient.gif +0 -0
  26. data/templates/_site/images/header_bg.gif +0 -0
  27. data/templates/_site/images/header_gradient.gif +0 -0
  28. data/templates/_site/images/jenkins-jobs.jpg +0 -0
  29. data/templates/_site/images/jenkins-logo.jpg +0 -0
  30. data/templates/_site/images/linkedin.gif +0 -0
  31. data/templates/_site/images/subscribe-icon.gif +0 -0
  32. data/templates/_site/images/subscribe.png +0 -0
  33. data/templates/_site/images/title.gif +0 -0
  34. data/templates/_site/images/twitter.gif +0 -0
  35. data/templates/_site/images/weibo.gif +0 -0
  36. data/templates/_site/images/whiteboard.jpg +0 -0
  37. data/templates/_site/index.html +471 -0
  38. data/templates/_site/javascripts/jquery.github.js +3 -0
  39. data/templates/_site/javascripts/jquery.js +19 -0
  40. data/templates/_site/open-source.html +78 -0
  41. data/templates/_site/stylesheets/master.css +296 -0
  42. data/templates/_site/stylesheets/syntax.css +60 -0
  43. data/templates/about.textile +16 -0
  44. data/templates/atom.xml +27 -0
  45. data/templates/blog.html +29 -0
  46. data/templates/drafts/outsource-your-blog.textile +32 -0
  47. data/templates/favicon.ico +0 -0
  48. data/templates/images/about.gif +0 -0
  49. data/templates/images/blog.gif +0 -0
  50. data/templates/images/build-matrix.png +0 -0
  51. data/templates/images/building-status-tag.png +0 -0
  52. data/templates/images/github.gif +0 -0
  53. data/templates/images/green_gradient.gif +0 -0
  54. data/templates/images/header_bg.gif +0 -0
  55. data/templates/images/header_gradient.gif +0 -0
  56. data/templates/images/jenkins-jobs.jpg +0 -0
  57. data/templates/images/linkedin.gif +0 -0
  58. data/templates/images/subscribe-icon.gif +0 -0
  59. data/templates/images/subscribe.png +0 -0
  60. data/templates/images/title.gif +0 -0
  61. data/templates/images/twitter.gif +0 -0
  62. data/templates/images/weibo.gif +0 -0
  63. data/templates/index.html +62 -0
  64. data/templates/javascripts/jquery.github.js +3 -0
  65. data/templates/javascripts/jquery.js +19 -0
  66. data/templates/open-source.html +33 -0
  67. data/templates/stylesheets/master.css +296 -0
  68. data/templates/stylesheets/syntax.css +60 -0
  69. metadata +125 -0
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2012 Larry Cai
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.rdoc ADDED
@@ -0,0 +1,38 @@
1
+ = `mkblog` - generate jekyll blog hosted in github
2
+
3
+ {<img src="https://secure.travis-ci.org/larrycai/mkblog.png" />}[http://travis-ci.org/larrycai/mkblog]
4
+
5
+ Author:: Larry Cai (mailto:larry.caiyu@gmail.com)
6
+
7
+ Copyright:: Copyright (c) 2012 by Larry Cai
8
+ License:: Distributes under the Apache License 2.0, see LICENSE in the source distro
9
+
10
+ This application will generate jekyll based blog, which is hosted in github
11
+
12
+ == Install
13
+
14
+ Install:
15
+ gem install mkblog
16
+
17
+ == Usage
18
+
19
+ Create new project:
20
+ mkblog --generate larry # generate jekyll powered blog larry.github.com
21
+ mkblog --show # list guideline
22
+
23
+ For more help:
24
+ mkblog --help
25
+
26
+ === Todo
27
+
28
+ update theme
29
+ mkblog --update --theme abc
30
+
31
+ == Developing for `mkblog`
32
+
33
+ First, install bundler:
34
+ gem install bundler
35
+
36
+ Get the development dependencies
37
+ bundle install
38
+ Most of the code is in `mkblog.rb`.
data/bin/mkblog ADDED
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require 'optparse'
5
+ require 'fileutils'
6
+ require 'erb'
7
+ require 'yaml'
8
+ require 'pathname'
9
+
10
+ include FileUtils
11
+
12
+ def main()
13
+ options = {
14
+
15
+ }
16
+ option_parser = OptionParser.new do |opts|
17
+ executable_name = File.basename($PROGRAM_NAME)
18
+ opts.banner = "make jekyll blog which hosted in github
19
+ Usage: #{executable_name} [options]
20
+ "
21
+ opts.on("-d","--debug","debug") do
22
+ options["debug"] = true
23
+ end
24
+
25
+ opts.on("-g","--generate project","generate blog under project.github.com") do |name|
26
+ unless name =~ /^[a-zA-Z0-9]+$/
27
+ raise ArgumentError,"name should be [a-zA-Z0-9]"
28
+ end
29
+ options["command"] = "generate"
30
+ options["name"] = name
31
+ end
32
+ opts.on("-s","--show","show how to continue") do
33
+ options["command"] = "show"
34
+ end
35
+ end
36
+
37
+ option_parser.parse!
38
+
39
+ puts options.inspect if options["debug"]
40
+
41
+ case options["command"]
42
+ when "generate" then generate_project(options["name"])
43
+ when "show" then showhelp()
44
+ else puts "--help for help"
45
+ end
46
+ end
47
+
48
+ def showhelp()
49
+ puts "1. update your personal information in theme (TODO)"
50
+ puts "2. create project in github.com and push this project"
51
+ puts "3. follow http://pages.github.com/"
52
+ end
53
+ # http://stackoverflow.com/questions/5074327/most-appropriate-way-to-generate-directory-of-files-from-directory-of-template-f
54
+ def generate_project(project)
55
+ destination = project + ".github.com"
56
+ source = File.dirname(__FILE__)+"/../templates"
57
+ #puts "generate project \"#{destination}\" from source \"#{source}\""
58
+ FileUtils.rmtree(destination)
59
+ FileUtils.mkdir_p(destination)
60
+ sourceroot=Pathname.new(source)
61
+ sourcerealpath = sourceroot.cleanpath
62
+ puts "generate project \"#{destination}\" from source \"#{sourcerealpath}\""
63
+ Dir.glob(File.join(source, '**/*')).each do |path|
64
+ pathname = Pathname.new(path)
65
+ relative = pathname.relative_path_from(sourceroot)
66
+ #puts "parent:" , sourceroot
67
+ #puts "relative:", relative
68
+ if File.directory?(pathname)
69
+ destdir = File.join(destination, relative.dirname)
70
+ #puts "create #{destdir} "
71
+ FileUtils.mkdir_p(destdir)
72
+ else
73
+ FileUtils.mkdir_p(File.join(destination, relative.dirname))
74
+ if pathname.extname == '.erb'
75
+ #puts pathname.basename.sub(/\.erb$/, '')
76
+ #puts destination
77
+ #puts File.join(destination,pathname.basename.sub(/\.erb$/, ''))
78
+ File.open(File.join(destination,pathname.basename.sub(/\.erb$/, '')), 'w') do |file|
79
+ file.puts(ERB.new(File.read(path)).result(binding))
80
+ end
81
+ else
82
+ print pathname.cleanpath, " => ", File.join(destination, relative.dirname),"\n"
83
+ FileUtils.cp(pathname, File.join(destination, relative.dirname))
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ main
90
+
@@ -0,0 +1,3 @@
1
+ module MkBlog
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,24 @@
1
+ ## Larry Cai
2
+
3
+ I use the template from https://github.com/mbleigh/mbleigh.github.com, please give credits to him.
4
+
5
+ This is the Jekyll source for Larry Cai's blog and website, [Larry Cai](http://larrycai.github.com/). It makes some nice use of Jekyll's liquid templating system (see blog.html) and uses Javscript to pull information from GitHub for the open-source section.
6
+
7
+ You may feel free to re-use any part of the structure, design, and layout of this site; it is all licensed under the MIT License. However, the content of the site (blog posts and page content) is licensed under a Creative Commons Attribution license (you may use it, but must give attribution).
8
+
9
+ ## Run it locally
10
+
11
+ $ jekyll --server
12
+
13
+ ### Others
14
+
15
+ All the blog should be encoded with UTF-8 without BOM and the environment is set as below
16
+ ~~~~~ {.bash}
17
+ $ cat ~/.profile
18
+ LANG=en_US.UTF-8
19
+ LC_ALL=en_US.UTF-8
20
+ LC_CTYPE=en_US.UTF-8
21
+ ~~~~~~~~~~~~
22
+
23
+ ### Copyright
24
+ Copyright (c) 2011 Larry Cai. Rights reserved as indicated above.
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'open-uri'
4
+ require 'multi_json'
5
+ require 'awesome_print'
6
+ require 'hashie'
7
+
8
+ class Post < Hashie::Mash
9
+ def date
10
+ Time.parse(self['published'])
11
+ end
12
+
13
+ def filename
14
+ "_posts/#{date.strftime('%Y-%m-%d')}-#{slug}.html"
15
+ end
16
+
17
+ def slug
18
+ self["link"].split('/').last
19
+ end
20
+
21
+ def body
22
+ self.content.content
23
+ end
24
+ end
25
+
26
+ task :pull do
27
+ posts = MultiJson.decode(open("http://pipes.yahoo.com/pipes/pipe.run?_id=50f63f64c70a2a032bdaa5dbb3458224&_render=json").read)['value']['items'].map{|p| Post.new(p) }
28
+
29
+ posts.each do |p|
30
+ if File.exists?(p.filename)
31
+ puts "- Blog post at #{p.filename} exists, ignoring"
32
+ else
33
+ puts "- Creating blog post at #{p.filename}"
34
+ File.open(p.filename,'w') do |f|
35
+ f.write <<-YAML
36
+ ---
37
+ layout: post
38
+ title: "#{p.title}"
39
+ ---
40
+
41
+ #{p.body}
42
+ YAML
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,2 @@
1
+ markdown: rdiscount
2
+ pygments: true
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
+
4
+ <html>
5
+ <head>
6
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
7
+ <title>Larry Cai - {{ page.title }}</title>
8
+ <link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8"/>
9
+ <link rel="stylesheet" href="/stylesheets/syntax.css" type="text/css" media="screen" charset="utf-8"/>
10
+ <script src="/javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="/javascripts/jquery.github.js" type="text/javascript" charset="utf-8"></script>
12
+ <link rel='alternate' type='application/rss+xml' href='http://feeds2.feedburner.com/larrycai' />
13
+ </head>
14
+ <body>
15
+ <div id='wrapper'>
16
+ <div id='header'>
17
+ <h1><a href='/'>Larry Cai</a></h1>
18
+
19
+ <div id='menu'>
20
+ <ul>
21
+ <li><a href='/blog.html' id='blog_link' title='Blog'>Blog</a></li>
22
+ <li><a href='/about.html' id='about_link' title='About'>About</a></li>
23
+ <li><a href='http://github.com/larrycai' target='_blank' title='GitHub' rel='me' id='github_link'>GitHub</a></li>
24
+ <li><a href='http://cn.linkedin.com/in/larrycaiyu' title='LinkedIn' target='_blank' rel='me' id='linkedin_link'>LinkedIn</a></li>
25
+ <li><a href='http://weibo.com/larrycaiyu' title='Weibo' target='_blank' rel='me' id='weibo_link'>Weibo</a></li>
26
+ </ul>
27
+ </div>
28
+ </div>
29
+ <div id='content'>
30
+ {{ content }}
31
+ <div class='clearfix'></div>
32
+ </div>
33
+ </div>
34
+ <div id='footer'>
35
+ Copyright &copy; 2011 Larry Cai. Hosted by <a href='http://github.com/larrycai/larrycai.github.com/' target='_blank'>GitHub</a> and powered by <a href='http://github.com/mojombo/jekyll'>Jekyll</a>, and reuse the template from <a href='http://github.com/mbleigh/mbleigh.github.com/'>Michael Bleigh</a>.
36
+ </div>
37
+ <script type="text/javascript">
38
+ /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
39
+ var disqus_shortname = 'larrycaiyu'; // required: replace example with your forum shortname
40
+
41
+ /* * * DON'T EDIT BELOW THIS LINE * * */
42
+ (function () {
43
+ var s = document.createElement('script'); s.async = true;
44
+ s.type = 'text/javascript';
45
+ s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
46
+ (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
47
+ }());
48
+ </script>
49
+ </body>
50
+ </html>
@@ -0,0 +1,39 @@
1
+ ---
2
+ layout: master
3
+ ---
4
+ <div class='post'>
5
+ <span class='date'>{{page.date | date_to_string}}</span>
6
+ <h1><a href='{{page.url}}'>{{page.title}}</a></h1>
7
+ <div class='body'>{{ content }}</div>
8
+ </div>
9
+
10
+ <div class="related">
11
+ <h3>Related Posts</h3>
12
+ <table class="post-list">
13
+ {% for post in site.related_posts limit:3 %}
14
+ <tr>
15
+ <th><a href='{{ post.url }}'>{{ post.title }}</a></th>
16
+ <td>{{ post.date | date_to_string }}</td>
17
+ <td><a href='{{post.url}}#disqus_thread'>Comments</a></td>
18
+ </tr>
19
+ {% endfor %}
20
+ </table>
21
+ </div>
22
+
23
+ <script type="text/javascript" charset="utf-8">
24
+ var disqus_url = "http://larrycai.github.com/{{page.url}}";
25
+ </script>
26
+ <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
27
+ <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
28
+
29
+ <div id="disqus_thread"></div>
30
+ <script type="text/javascript">
31
+ var disqus_shortname = 'larrycaiyu'; // required: replace example with your forum shortname
32
+
33
+ /* * * DON'T EDIT BELOW THIS LINE * * */
34
+ (function() {
35
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
36
+ dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
37
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
38
+ })();
39
+ </script>
@@ -0,0 +1,111 @@
1
+ ---
2
+ layout: post
3
+ title: Travis CI会替代Jenkins吗?
4
+ ---
5
+
6
+ #介绍#
7
+ 你可能用Github了。但是你是怎么自动构建你的开源项目的呢?你的Github项目有“构建状态”标签吗?
8
+
9
+ ![Github上的项目构建状态][img-building-status-tag]
10
+
11
+ 如果你还不知道这个,你就有些落伍了,因为这是Travis CI带来的持续集成的革新,它可能会替代Jenkins现在的地位。
12
+
13
+ 让我们一起来看看Travis-ci到底带来了什么,先从Jenkins说起。
14
+
15
+ 在写这篇博客时,发现好友晓斌也写了一篇[Travis CI,翩翩而至的CI云](http://www.juvenxu.com/2012/03/06/travis-ci/),可以参考阅读。
16
+
17
+ ## Jenkins介绍 ##
18
+
19
+ 持续集成是敏捷软件开发的一个重要工具,开源工具[Jenkins](http://jenkins-ci.org/)是实施持续集成首选,大概占据了半壁江山。
20
+
21
+ ![Jenkins界面][img-jenkins-jobs]
22
+
23
+ Jenkins以前叫Hudson,后来由于Oracle收购了Sun公司,Oracle与开源软件社区谈崩了。Hudson创始人Kohsuke Kawaguchi(简称 KK)一怒之下,和社区的人其他人重起炉灶,建立了Jenkins社区。详细可以看看InfoQ的文章[Hudson社区提议将项目更名为Jenkins](http://www.infoq.com/cn/news/2011/01/hudson-jenkins2)。
24
+
25
+ ### Jenkins功能 ###
26
+ 它有很多极佳的特性:
27
+
28
+ 1. 易于安装:一个命令就可启动,也方便部署到各种Web容器中(如tomcat)。
29
+ 2. 易于配置:所有的配置都在Web界面实现,权限控制得也不错。
30
+ 3. 插件支持:基本上所有的扩展都是有插件完成的,开发插件也很方便,由此产生了庞大的社区。
31
+ 4. 支持分布式构建:Jenkins能够让通过主从模式(master/slave)多台机器一起构建。
32
+
33
+ ### Jenkins在企业中常见步骤 ###
34
+ Jenkins服务器一般先架设在一台服务器上,有配置管理人员管理。
35
+
36
+ 产品有构建需求后,配置管理人员就新建一个任务,配好源码仓库,设置构建时间,指定运行脚本来编译测试产品,并且设置报告输出。一切都可以在Web界面中运行。
37
+
38
+ ## Jenkins的一些弊端 ##
39
+ Jenkins虽然非常好用,但还是有些弊端。
40
+
41
+ ### 多平台或依赖的包 ###
42
+
43
+ 如果你的软件想在不同的操作系统软件构建并验​​证,这将是相当有难度和技巧性,一般主要是准备不同的操作系统的机器,然后使用主/从模式进行分布式构建。
44
+
45
+ 在C++中你可以使用有关的交叉编译器,一个不错的解决方案。
46
+
47
+ 但是再进一步如果你的第三方软件和不同的依赖比较多,那么这个环境的准备是非常困难的,因为这个组合将很大。
48
+
49
+ 当然你可有使用虚拟机的技术vagrant/virtualbox,参见[使用vagrant+jenkins来管理虚拟机的技巧](http://larrycai.github.com/2011/10/25/vagrant-jenkins-ci.html)。可以工作,不太优雅。因为它不是原生的,有点复杂。
50
+
51
+ ### 配置管理人员的工作 ###
52
+
53
+ 一般来说Jenkins的构建任务,它是集中控制的。大多来说都是有专职的配置管理人员来管理,否者权限会混乱。
54
+
55
+ 当有需求时,他们负责在CI服务器创建任务(记住:这些配置文件不是有版本控制的)。这个就涉及到了沟通成本,你有变化需求,很难及时满足。
56
+
57
+ 由于服务器是有限的,它主要构建重要分支的内容。在你自己的私有分支上运行CI是比较奢侈的,而且环境不一样,也不推荐。
58
+
59
+ 你可以想象如果在一个C/C++产品的公司,你要为一个Lisp的项目创建CI要花多久?
60
+
61
+ 作为开发者,为什么不能随时构建你想要的东西呢?这就是Travis CI想做的。
62
+
63
+ ## Travis CI 介绍 ##
64
+ Travis CI 这里就不介绍怎么使用了具体可以先看[晓斌的博客](http://www.juvenxu.com/2012/03/06/travis-ci/)和[免费的持续集成测试服务](http://saberma.me/other/2011/11/29/travis-ci-is-a-free-continuous-integration-test-server.html),强烈建议你先试一下。
65
+
66
+ 初看Travis CI象和Jenkins没啥区别,指定你Github中的项目,然后他帮你编译,而且它使用的也是Vagrant/Virtualbox技术。但实际上里面有很多好点子。
67
+
68
+ ## Travis CI带来的变革 ##
69
+ ### 配置本地化和可读性 ###
70
+ 不像以前,构建的任务是在Jenkins服务器上的,现在构建的配置文件直接就和源码放在一起,而且配置文件使用DSL写的,可读性更高。
71
+
72
+ before_script:
73
+ - sudo apt-get install pandoc
74
+ - sudo apt-get install ttf-arphic-gbsn00lp ttf-arphic-ukai ttf-wqy-microhei ttf-wqy-zenhei
75
+ - sudo apt-get install texlive-xetex texlive-latex-recommended texlive-latex-extra
76
+ - gem install mkbok
77
+
78
+ rvm:
79
+ - 1.9.3
80
+ - 1.8.7
81
+ script: mkbok --lang zh --build pdf
82
+
83
+ after_script:
84
+ - which curl ; curl -v --upload-file sdcamp.zh.pdf http://blobs.ge.tt/3iBcNNC/sdcamp.zh.pdf?sig=-TY5O1GAx8xHwWiCqd8aySlQiroFAnHK2o4
85
+
86
+ 作为用户,关心的是要哪些依赖包,然后怎么构建就行了,上面的配置每一行都没有浪费。
87
+
88
+ ### 多版本支持 ###
89
+ 像上面的例子中,我要求在两个Ruby环境中运行,它就帮我做到了,我并不关心它是怎么切换的。
90
+
91
+ ![多版本构建结果][img-build-matrix]
92
+
93
+ ### 原生的云技术来分布式构建 ###
94
+ Travis CI使用的Ruby语言,一开始考虑的就是分布式构建,比Jenkins的插件式进了一步。
95
+
96
+ 虽然Travis CI并不是直接用到了云机器,它的虚拟机部分只是Vagrant/Virtualbox,但是这一块是很容易迁移到其他的技术的。
97
+
98
+ # 总结 #
99
+ Jenkins有点可惜,改了名字以后,功能上面并没有突破。当然这就是开源竞争的好处,总有新的理念,新的工具产生。你不前进,别人就迎头赶上。
100
+
101
+ Travis CI现在只是支持Github的公开项目,但已经爆发出它的优点了。要不了多久,我相信就能运行在你公司内部了。
102
+
103
+ 让我们一起期待这个革新吧!
104
+
105
+ # 相关阅读 #
106
+ 1. Juven Xu的“Travis CI,翩翩而至的CI云” <http://www.juvenxu.com/2012/03/06/travis-ci/>
107
+ 2. 免费的持续集成测试服务 <http://saberma.me/other/2011/11/29/travis-ci-is-a-free-continuous-integration-test-server.html>
108
+
109
+ [img-jenkins-jobs]: http://larrycai.github.com//images/jenkins-jobs.jpg
110
+ [img-building-status-tag]: http://larrycai.github.com/images/building-status-tag.png
111
+ [img-build-matrix]: http://larrycai.github.com/images/build-matrix.png
@@ -0,0 +1,24 @@
1
+ ## Larry Cai
2
+
3
+ I use the template from https://github.com/mbleigh/mbleigh.github.com, please give credits to him.
4
+
5
+ This is the Jekyll source for Larry Cai's blog and website, [Larry Cai](http://larrycai.github.com/). It makes some nice use of Jekyll's liquid templating system (see blog.html) and uses Javscript to pull information from GitHub for the open-source section.
6
+
7
+ You may feel free to re-use any part of the structure, design, and layout of this site; it is all licensed under the MIT License. However, the content of the site (blog posts and page content) is licensed under a Creative Commons Attribution license (you may use it, but must give attribution).
8
+
9
+ ## Run it locally
10
+
11
+ $ jekyll --server
12
+
13
+ ### Others
14
+
15
+ All the blog should be encoded with UTF-8 without BOM and the environment is set as below
16
+ ~~~~~ {.bash}
17
+ $ cat ~/.profile
18
+ LANG=en_US.UTF-8
19
+ LC_ALL=en_US.UTF-8
20
+ LC_CTYPE=en_US.UTF-8
21
+ ~~~~~~~~~~~~
22
+
23
+ ### Copyright
24
+ Copyright (c) 2011 Larry Cai. Rights reserved as indicated above.
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'open-uri'
4
+ require 'multi_json'
5
+ require 'awesome_print'
6
+ require 'hashie'
7
+
8
+ class Post < Hashie::Mash
9
+ def date
10
+ Time.parse(self['published'])
11
+ end
12
+
13
+ def filename
14
+ "_posts/#{date.strftime('%Y-%m-%d')}-#{slug}.html"
15
+ end
16
+
17
+ def slug
18
+ self["link"].split('/').last
19
+ end
20
+
21
+ def body
22
+ self.content.content
23
+ end
24
+ end
25
+
26
+ task :pull do
27
+ posts = MultiJson.decode(open("http://pipes.yahoo.com/pipes/pipe.run?_id=50f63f64c70a2a032bdaa5dbb3458224&_render=json").read)['value']['items'].map{|p| Post.new(p) }
28
+
29
+ posts.each do |p|
30
+ if File.exists?(p.filename)
31
+ puts "- Blog post at #{p.filename} exists, ignoring"
32
+ else
33
+ puts "- Creating blog post at #{p.filename}"
34
+ File.open(p.filename,'w') do |f|
35
+ f.write <<-YAML
36
+ ---
37
+ layout: post
38
+ title: "#{p.title}"
39
+ ---
40
+
41
+ #{p.body}
42
+ YAML
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,55 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
+
4
+ <html>
5
+ <head>
6
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
7
+ <title>Larry Cai - About Larry Cai</title>
8
+ <link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8"/>
9
+ <link rel="stylesheet" href="/stylesheets/syntax.css" type="text/css" media="screen" charset="utf-8"/>
10
+ <script src="/javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
11
+ <script src="/javascripts/jquery.github.js" type="text/javascript" charset="utf-8"></script>
12
+ <link rel='alternate' type='application/rss+xml' href='http://feeds2.feedburner.com/larrycai' />
13
+ </head>
14
+ <body>
15
+ <div id='wrapper'>
16
+ <div id='header'>
17
+ <h1><a href='/'>Larry Cai</a></h1>
18
+
19
+ <div id='menu'>
20
+ <ul>
21
+ <li><a href='/blog.html' id='blog_link' title='Blog'>Blog</a></li>
22
+ <li><a href='/about.html' id='about_link' title='About'>About</a></li>
23
+ <li><a href='http://github.com/larrycai' target='_blank' title='GitHub' rel='me' id='github_link'>GitHub</a></li>
24
+ <li><a href='http://cn.linkedin.com/in/larrycaiyu' title='LinkedIn' target='_blank' rel='me' id='linkedin_link'>LinkedIn</a></li>
25
+ <li><a href='http://weibo.com/larrycaiyu' title='Weibo' target='_blank' rel='me' id='weibo_link'>Weibo</a></li>
26
+ </ul>
27
+ </div>
28
+ </div>
29
+ <div id='content'>
30
+ <h2>About Larry Cai</h2>
31
+ <p>Larry Cai is the author of this blog, which records his software development experience.</p>
32
+ <p>private <a href="http://codeslife.com">English blog:http://codeslife.com</a></p>
33
+ <h2>About This Site</h2>
34
+ <p>This site is built using the <a href="http://github.com/mojombo/jekyll">Jekyll</a> library and hosted on <a href="http://github.com/">GitHub</a>. The source code used to create this library is <a href="http://github.com/larrycai/larrycai.github.com">publicly available on GitHub</a> as well.</p>
35
+ <p>The template comes from <a href="http://github.com/mbleigh/mbleigh.github.com">mbleigh.github.com</a></p>
36
+ <div class='clearfix'></div>
37
+ </div>
38
+ </div>
39
+ <div id='footer'>
40
+ Copyright &copy; 2011 Larry Cai. Hosted by <a href='http://github.com/larrycai/larrycai.github.com/' target='_blank'>GitHub</a> and powered by <a href='http://github.com/mojombo/jekyll'>Jekyll</a>, and reuse the template from <a href='http://github.com/mbleigh/mbleigh.github.com/'>Michael Bleigh</a>.
41
+ </div>
42
+ <script type="text/javascript">
43
+ /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
44
+ var disqus_shortname = 'larrycaiyu'; // required: replace example with your forum shortname
45
+
46
+ /* * * DON'T EDIT BELOW THIS LINE * * */
47
+ (function () {
48
+ var s = document.createElement('script'); s.async = true;
49
+ s.type = 'text/javascript';
50
+ s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
51
+ (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
52
+ }());
53
+ </script>
54
+ </body>
55
+ </html>