Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp 化 #10

Merged
merged 21 commits into from
Dec 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log
node_modules

.sass-cache

# Cabin-specific ignored files
dist
.grunt
build
tmp
132 changes: 0 additions & 132 deletions Gruntfile.coffee

This file was deleted.

93 changes: 93 additions & 0 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
gulp = require 'gulp'
mark = require 'gulp-markdown'
jade = require 'gulp-jade-template'
article = require 'gulp-article'
publish = require 'gulp-article-publish'
fs = require 'fs'
_ = require 'lodash'
rename = require 'gulp-rename'
styl = require 'gulp-stylus'
connect = require 'gulp-connect'
mkdir = require 'mkdirp'
async = require 'async'
run = require 'run-sequence'
archive = require 'gulp-article-archive'
rss = require 'gulp-article-rss'
deploy = require 'gulp-gh-pages'

paths =
posts: 'posts/*.md'
styl: 'src/*.styl'
dest: 'build'

gulp.task 'article', ->
gulp.src paths.posts
.pipe mark()
.pipe article()
.pipe jade('src/page.jade')
.pipe article()
.pipe publish(paths.dest)

gulp.task 'index', -> fs.readdir 'posts', (err, files)->
gulp.src "posts/#{_.last(files)}"
.pipe mark()
.pipe article()
.pipe jade('src/page.jade')
.pipe rename('index.html')
.pipe gulp.dest(paths.dest)

gulp.task 'CNAME', -> gulp.src('src/CNAME').pipe gulp.dest(paths.dest)
gulp.task 'gfm', -> gulp.src('github-markdown-css/github-markdown.css').pipe gulp.dest(paths.dest)
gulp.task 'stylus', ->
gulp.src paths.styl
.pipe styl
compress: true
.pipe gulp.dest(paths.dest)

gulp.task 'archive', (callback)->
run 'archive-json', 'archive-page', 'archive-head', callback

gulp.task 'archive-json', ->
gulp.src 'posts',
read: false
.pipe archive("#{paths.dest}/archives")

gulp.task 'archive-page', ->
gulp.src "#{paths.dest}/archives/*.json"
.pipe jade('src/archive.jade')
.pipe rename
extname: '.html'
.pipe gulp.dest("#{paths.dest}/archives")

gulp.task 'archive-head', ->
fs.readdir "#{paths.dest}/archives", (err, files)->
files = _.filter files, (file)-> /^page-\d*\.html$/.test file
gulp.src "#{paths.dest}/archives/#{_.head(files)}"
.pipe rename('index.html')
.pipe gulp.dest("#{paths.dest}/archives")

gulp.task 'rss', ->
gulp.src 'posts/*.md'
.pipe rss
title: 'kaihatsu'
description: 'development log'
link: 'http://dev.jgs.me'
image: 'http://dev.jgs.me/icon.png'
copyright: 'MIT'
updated: new Date()
author:
name: 'jigsaw'
link: 'http://jgs.me'
.pipe gulp.dest("#{paths.dest}/feed.xml")

gulp.task 'default', ['article', 'index', 'archive', 'rss', 'CNAME', 'gfm', 'stylus']
gulp.task 'watch', ['default'], ->
gulp.watch paths.posts, ['article', 'index']
gulp.watch paths.styl, ['stylus']
connect.server
root: paths.dest

gulp.task 'deploy', ['default'], ->
gulp.src './build/**/*'
.pipe deploy
cacheDir: 'tmp'
48 changes: 33 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
{
"name": "cabin-site",
"name": "log",
"version": "0.0.0",
"devDependencies": {
"grunt": "^0.4.5",
"load-grunt-tasks": "^1.0.0",
"grunt-pages": "^0.11.2",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-contrib-connect": "^0.9.0",
"grunt-open": "^0.2.3",
"grunt-contrib-clean": "^0.6.0",
"grunt-gh-pages": "^0.9.1",
"inquirer": "^0.8.0",
"grunt-contrib-stylus": "^0.20.0"
"description": "development log",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"engines": {
"node": ">=0.10.0"
"repository": {
"type": "git",
"url": "https://github.com/jgsme/log.git"
},
"author": "jigsaw (http://jgs.me)",
"license": "MIT",
"bugs": {
"url": "https://github.com/jgsme/log/issues"
},
"homepage": "https://github.com/jgsme/log",
"dependencies": {
"async": "^0.9.0",
"coffee-script": "^1.8.0",
"gulp": "^3.8.10",
"gulp-article": "0.0.7",
"gulp-article-archive": "0.0.5",
"gulp-article-publish": "0.0.3",
"gulp-article-rss": "0.0.4",
"gulp-connect": "^2.2.0",
"gulp-data": "^1.1.1",
"gulp-gh-pages": "^0.4.0",
"gulp-jade-template": "0.0.5",
"gulp-markdown": "^1.0.0",
"gulp-rename": "^1.2.0",
"gulp-stylus": "^1.3.4",
"lodash": "^2.4.1",
"mkdirp": "^0.5.0",
"run-sequence": "^1.0.2",
"through2": "^0.6.3"
}
}
7 changes: 1 addition & 6 deletions posts/2013-09-19-httpie.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
title: "httpie",
date: "2013-09-19",
description: "httpie",
url: "httpie"
}
# [httpie](/2013/09/19/httpie.html)


http://qiita.com/yuku_t/items/5df06d50c4c349cc0c1b
Expand Down
7 changes: 1 addition & 6 deletions posts/2013-09-25-nested-mongoose.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
title: "node.jsのmongooseでnestしたobjectをpopulateする",
date: "2013-09-25",
description: "node.jsのmongooseでnestしたobjectをpopulateする",
url: "mongoose-nest-populate"
}
# [node.jsのmongooseでnestしたobjectをpopulateする](/2013/09/25/nested-mongoose.html)


`node.js` の `mongoose` でネストしたドキュメントを `populate` したいときの話。
Expand Down
7 changes: 1 addition & 6 deletions posts/2013-09-27-nginxdesocket-dot-io.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
title: "nginxでsocket.io",
date: "2013-09-27",
description: "nginxでsocket.io",
url: "nginx-with-socket-io"
}
# [nginxでsocket.io](/2013/09/27/nginxdesocket-dot-io.html)

追い詰められて構築したさくらVPSにsocket.io on nginxを構築した。

Expand Down
7 changes: 1 addition & 6 deletions posts/2013-09-27-sakuravpsfalsechu-qi-she-ding.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
title: "さくらvpsの初期設定",
date: "2013-09-27",
description: "さくらvpsの初期設定",
url: "sakura-vps-init"
}
# [さくらvpsの初期設定](/2013/09/27/sakuravpsfalsechu-qi-she-ding.html)

超絶追い詰められて勢いでさくらVPSを構築した。

Expand Down
7 changes: 1 addition & 6 deletions posts/2013-10-06-nginxdesabudomeinfalsezhi-ding.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
title: "nginxでサブドメインの指定",
date: "2013-10-06",
description: "nginxでサブドメインの指定",
url: "nginx-sub-domain"
}
# [nginxでサブドメインの指定](/2013/10/06/nginxdesabudomeinfalsezhi-ding.html)

nginxでサブドメインの指定をするときにはサブドメインの分だけ `server` を書いておけばいいっぽい。

Expand Down
7 changes: 1 addition & 6 deletions posts/2013-10-06-vimdebu-wan.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
title: "vimで補完",
date: "2013-10-06",
description: "vimで補完",
url: "vim-comp"
}
# [vimで補完](/2013/10/06/vimdebu-wan.html)

vim で補完をしたい。

Expand Down
9 changes: 2 additions & 7 deletions posts/2013-10-06-vpsnigitfalserimotoripozitoriwotukuru.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
title: "VPSにgitのリモートリポジトリをつくる",
date: "2013-10-06",
description: "VPSにgitのリモートリポジトリをつくる",
url: "vps-git-remote-repo"
}

# [VPSにgitのリモートリポジトリをつくる](/2013/10/06/vpsnigitfalserimotoripozitoriwotukuru.html)

初回のみ

```
Expand Down
7 changes: 1 addition & 6 deletions posts/2013-10-16-nodectl-metutiyabian-li.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
title: "nodectl めっちゃ便利",
date: "2013-10-16",
description: "nodectl めっちゃ便利",
url: "nodectl-is-awesome"
}
# [nodectl めっちゃ便利](/2013/10/16/nodectl-metutiyabian-li.html)

https://github.com/geta6/nodectl

Expand Down
Loading