Skip to content

Commit

Permalink
完成博客基本功能
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxh committed Jan 1, 2012
1 parent 385391f commit fab04a0
Show file tree
Hide file tree
Showing 16 changed files with 161 additions and 21 deletions.
1 change: 1 addition & 0 deletions .rvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rvm use ree@mangege
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "http://rubygems.org"

group :development do
gem 'rake'
gem 'jekyll'
gem 'rdiscount'
gem 'stringex'
end
34 changes: 34 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
GEM
remote: http://rubygems.org/
specs:
albino (1.3.3)
posix-spawn (>= 0.3.6)
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
directory_watcher (1.4.0)
fast-stemmer (1.0.0)
jekyll (0.11.0)
albino (>= 1.3.2)
classifier (>= 1.3.1)
directory_watcher (>= 1.1.1)
kramdown (>= 0.13.2)
liquid (>= 1.9.0)
maruku (>= 0.5.9)
kramdown (0.13.3)
liquid (2.2.2)
maruku (0.6.0)
syntax (>= 1.0.0)
posix-spawn (0.3.6)
rake (0.9.2)
rdiscount (1.6.8)
stringex (1.3.0)
syntax (1.0.0)

PLATFORMS
ruby

DEPENDENCIES
jekyll
rake
rdiscount
stringex
45 changes: 45 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# coding: utf-8
require "rubygems"
require "bundler/setup"
require "stringex"

github_origin = 'git@github.com:mangege/mangege.github.com.git'
domain = 'www.mangege.com'

task :default => [:deploy]

desc 'deploy to github pages'
task :deploy do
puts "deploy site"
system 'rm -rf _site'
system 'jekyll'
cd '_site' do
system "echo -n #{domain} > CNAME"
system "git init"
system "git add ."
system "git commit -m 'site update #{Time.now}'"
system "git remote add origin #{github_origin}"
system "git push -f origin master"
end
end

# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")
desc "Create a new Post"
task :new_post, :title do |t, args|
args.with_defaults(:title => 'new-post')
title = args.title
filename = "_source/_posts/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.md"
if File.exist?(filename)
abort("文章 #{filename} 已存在")
end
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/&/,'&')}\""
post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
post.puts "categories: "
post.puts "---"
end
#system("vim #{filename}")
end
5 changes: 2 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ destination: ./_site
plugins: ./_plugins

lsi: false
pygments: false
markdown: maruku
pygments: true
markdown: rdiscount
permalink: /:year/:month/:day/:title.html

paginate: 10 # Posts per page on the blog index
#pagination_dir: blog # Directory base for pagination URLs eg. /blog/page/2/

1 change: 1 addition & 0 deletions _plugins/generate_categories.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# coding: utf-8
# Jekyll category page generator.
# http://recursive-design.com/projects/jekyll-plugins/
#
Expand Down
4 changes: 4 additions & 0 deletions _source/_includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<div id="footer-container">
<div id="footer">
<p class="copyright">
RSS <a href="/atom.xml" rel="subscribe-rss" title="订阅曹小华的博客">订阅</a> 本博客 |
<a href="https://github.com/mangege/mangege" title="本站源码">github</a> |
</p>
<p class="credit">Powered by <a class="wp-link" href="https://github.com/mojombo/jekyll" title="Powered by Jekyll, Jekyll is a simple, blog aware, static site generator. "><span>Jekyll</span></a> and <a class="theme-link" href="http://themehybrid.com/themes/hybrid" title="Hybrid"><span>Hybrid</span></a>.</p></div>
</div><!-- #footer -->
</div><!-- #footer-container -->
1 change: 1 addition & 0 deletions _source/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>{% if page.title %}{{ page.title }} - {% endif %}曹小华的博客</title>
<link rel="stylesheet" href="/stylesheets/style.css" type="text/css" media="all" />
<link href="/atom.xml" rel="alternate" title="曹小华的博客" type="application/atom+xml">
</head>
2 changes: 1 addition & 1 deletion _source/_includes/post.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="hentry post publish">
<h2 class="entry-title"><a href="{{post.url}}" rel="bookmark">{{post.title}}</a></h2>
<p class="byline"><abbr class="published">{{post.date}}</abbr>
<p class="byline"><abbr class="published">{{post.date || date: "%Y/%m/%d %H:%M"}}</abbr>
{% unless post.categories == empty %}| <span class="category">{{ post.categories | category_links }}</span>{% endunless %}
</p>
<div class="entry-content">
Expand Down
2 changes: 1 addition & 1 deletion _source/_layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="hentry post publish">
<h1 class="post-title entry-title"><a href="{{page.url}}" rel="bookmark">{{page.title}}</a></h1>
<p class="byline"><abbr class="published">{{page.date}}</abbr>
<p class="byline"><abbr class="published">{{page.date || date: "%Y/%m/%d %H:%M"}}</abbr>
{% unless page.categories == empty %}| <span class="category">{{ page.categories | category_links }}</span>{% endunless %}
</p>
<div class="entry-content">
Expand Down
8 changes: 8 additions & 0 deletions _source/_posts/2012-01-01-di-yi-pian-ji-zhu-wen-zhang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout: post
title: "第一篇技术文章"
date: 2012-01-01 21:42
categories: tech
---

用于初始化技术分类页
8 changes: 8 additions & 0 deletions _source/_posts/2012-01-01-di-yi-pian-sheng-huo-wen-zhang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout: post
title: "第一篇生活文章"
date: 2012-01-01 21:43
categories: life
---

用于初始化生活分类页
6 changes: 0 additions & 6 deletions _source/_posts/2012-1-1-hello.markdown

This file was deleted.

9 changes: 0 additions & 9 deletions _source/_posts/2012-1-1-kitty.md

This file was deleted.

23 changes: 22 additions & 1 deletion _source/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,25 @@
layout: default
title: 关于
---
about me

<h1>关于</h1>
<pre>
《长歌行》
青青园中葵,朝露待日唏。
阳春布德泽,万物生光辉。
常恐秋节至,焜黄华叶衰。
百川东到海,何时复西归。
少壮不努力,老大徒伤悲。
——出自汉乐府《长歌行》
</pre>

<h4>简介</h4>
<p>
一个程序员的博客,主要做Web开发方面.学过JAVA,现做RUBY.<br />
待续...
</p>

<h4>联系</h4>
<p>
Gmail &amp; Gtalk &amp; Gplus: <strong>mr.mangege</strong>
</p>
25 changes: 25 additions & 0 deletions _source/atom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

<title><![CDATA[曹小华的博客]]></title>
<link href="http://www.mangege.com/atom.xml" rel="self"/>
<link href="http://www.mangege.com/"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>http://www.mangege.com/</id>
<author>
<name><![CDATA[曹小华]]></name>
</author>

{% for post in site.posts limit: 20 %}
<entry>
<title type="html"><![CDATA[{{ post.title }}]]></title>
<link href="http://www.mangege.com/{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>http://www.mangege.com/{{ post.id }}</id>
<content type="html"><![CDATA[{{ post.content }}]]></content>
</entry>
{% endfor %}
</feed>

0 comments on commit fab04a0

Please sign in to comment.