summaryrefslogtreecommitdiffstats
path: root/import-blog.rb
blob: a8e9f857bb6274ff1bdd4181d6804332f65c7c37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env ruby

require 'json'

json = JSON.parse STDIN.read

json['collections'][0]['posts'].each do |post|
  slug = post['slug']
  f = File.open("blog-imports/#{slug}.json", "w")
  f.write post.to_json
  f.flush
end