Skip to content

Commit

Permalink
[wip] migrate site from jekyll to nanoc
Browse files Browse the repository at this point in the history
still miss:
* pagination
* deploy via FTP
* travis CI
* checks
  • Loading branch information
opatry-mys committed Apr 10, 2014
1 parent 4ff24d5 commit a78c5de
Show file tree
Hide file tree
Showing 72 changed files with 340 additions and 172 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/_site
# nanoc life
/tmp/*
/crash.log
/output/*

15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
before_script:
- gem install jekyll
- gem install rdiscount
# TODO nanoc build + deploy FTP
# before_script:
# - gem install jekyll
# - gem install rdiscount

script:
- jekyll --safe
# script:
# - jekyll --safe

notifications:
- email: false
# notifications:
# - email: false
30 changes: 30 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
source 'https://rubygems.org'

# nanoc itself
gem 'nanoc', '~>3.6', '>=3.6.6'

# nanoc view
gem 'adsf'
gem 'rack'

# nanoc validate:css and validate:html Rake tasks
gem 'w3c_validators'

# nanoc filters
gem 'kramdown' # markdown

# css
gem 'rainpress'

# relativize paths
gem 'nokogiri'

# javascript
gem 'uglifier'

# html
gem 'html_compressor'

# syntax highlighting
gem 'htmlentities'
gem 'systemu'
49 changes: 49 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
GEM
remote: https://rubygems.org/
specs:
POpen4 (0.1.4)
Platform (>= 0.4.0)
open4
Platform (0.4.0)
adsf (1.2.0)
rack (>= 1.0.0)
colored (1.2)
cri (2.5.0)
colored (~> 1.2)
execjs (2.0.2)
html_compressor (0.0.3)
POpen4 (>= 0.1.4)
htmlentities (4.3.1)
json (1.8.1)
kramdown (1.3.3)
mini_portile (0.5.3)
nanoc (3.6.8)
cri (~> 2.3)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
open4 (1.3.3)
rack (1.5.2)
rainpress (1.0)
systemu (2.6.4)
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
w3c_validators (1.2)
json
nokogiri

PLATFORMS
ruby

DEPENDENCIES
adsf
html_compressor
htmlentities
kramdown
nanoc (~> 3.6, >= 3.6.6)
nokogiri
rack
rainpress
systemu
uglifier
w3c_validators
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Olivier Patry

Personal home page source control based on [GitHub Pages](http://pages.github.com/) based on [Jekyll](https://github.com/mojombo/jekyll).
The content is, most of the time, written using [Markdown](http://daringfireball.net/projects/markdown/).
The content is, most of the time, written using [Markdown](http://daringfireball.net/projects/markdown/) and served by `[nanoc](http://nanoc.ws/)`.

The opatry's user GitHub Page is redirected to http://opatry.net.
The opatry's user GitHub Page is deployed on http://opatry.net.
51 changes: 51 additions & 0 deletions Rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env ruby

compile '/assets/*' do
# don’t filter or layout
end

compile '*' do
if item.binary?
# don’t filter binary items
else
filter :fenced_code_block
filter :erb
filter :kramdown
filter :colorize_syntax, :default_colorizer => :pygmentize # syntax highlighting
unless item[:layout] == 'none'
layout item[:layout] || 'default'
end
#filter :html_compressor, :type => item[:extension]
end
end

route '/posts/*' do
y,m,d,slug = /([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)/.match(item.identifier).captures

"/#{y}/#{m}/#{d}/#{slug}/index.html"
end

route '/assets/*' do
# /assets/foo.html/ -> /foo.html
item.identifier[7..-2]
end

route '/rss/' do
'/rss.xml'
end

route '/sitemap/' do
'/sitemap.xml'
end

route '*' do
if item.binary?
# Write item with identifier /foo/ to /foo.ext
item.identifier.chop + '.' + item[:extension]
else
# Write item with identifier /foo/ to /foo/index.html
item.identifier + 'index.html'
end
end

layout '*', :erb
12 changes: 0 additions & 12 deletions _config.yml

This file was deleted.

48 changes: 0 additions & 48 deletions _includes/header.html

This file was deleted.

54 changes: 0 additions & 54 deletions _includes/pagination.html

This file was deleted.

15 changes: 0 additions & 15 deletions _layouts/author.html

This file was deleted.

15 changes: 0 additions & 15 deletions _layouts/markdown.html

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Using `git branch` we can retrieve the current git branch if any.

You can use the following `PS1` definition (by editing your `~/.bashrc` file for instance):

{% highlight bash %}
``` bash
export PS1='\n\[\033[0;36m\w/\033[m \033[0;33m`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\033[m\]\n\033[0;35m⌘\033[m '
{% endhighlight %}
```

Displays something like that:

Expand All @@ -26,7 +26,7 @@ Another [demonstration which add an extra `*`](http://nathanhoad.net/git-bash-ta

Here is my current one:

{% highlight bash %}
``` bash
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
Expand All @@ -36,7 +36,7 @@ function parse_git_branch {
}

export PS1='\n\[\033[0;36m\w/\033[m \033[0;33m$(parse_git_branch)\033[m\]\n\033[0;35m\$\033[m '
{% endhighlight %}
```

<div style="font-family: monospace;">
<pre><code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ comments: false

Add to `~/.bashrc` (`~/.profile` or whatever you deem appropriate).

{% highlight bash %}
``` bash
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
{% endhighlight %}
```

[via](http://www.vogella.com/blog/2013/03/19/git-auto-completion-for-the-bash-shell/)

# Git Prompt Colors

{% highlight bash %}
$ git config --global color.ui true
{% endhighlight %}
``` bash
$ git config --global color.ui true
```

[via](http://git-scm.com/book/en/Customizing-Git-Git-Configuration#Colors-in-Git)

Custom colorization parameters can be done (see doc). As an example:

{% highlight ini %}
``` ini
[color]
ui = auto
[color "branch"]
Expand All @@ -42,6 +42,6 @@ Custom colorization parameters can be done (see doc). As an example:
added = yellow
changed = green
untracked = cyan
{% endhighlight %}
```

[via](http://nathanhoad.net/how-to-colours-in-git)
Loading

0 comments on commit a78c5de

Please sign in to comment.