Ghostを使いはじめた。
Rubyでこんなスクリプト書いて、OctopressのMarkdownファイルからSQLiteにデータ移行した。
#!/bin/env ruby require 'time' require 'sqlite3' require 'securerandom' db = SQLite3::Database.new('/path/to/ghost/content/data/ghost.db') Dir.glob('/path/to/octopress/source/_posts/*.markdown').each {|f| filename = File.basename(f) title = File.readlines(f).grep(/^title:/)[0].split('title:')[1].delete('"') slug = filename.slice(/\d{4}-\d{2}-\d{2}-(.*).markdown/, 1) date_string = filename.slice(/(\d{4}-\d{2}-\d{2})/) markdown = File.open(f).read uuid = SecureRandom.uuid stmt = db.prepare("INSERT INTO POSTS ( uuid, title, slug, status, markdown, author_id, created_at, created_by, published_at) VALUES ( ?, ?, ?, 'published', ?, 1, datetime(?), 1, datetime(?));") stmt.execute(uuid, title, slug, markdown, date_string, date_string) } そしてその後 https://github.com/jbrooksuk/OctoGhost というリポジトリを見つけた。もっと先に気づいてれば…
...