Clean up Enki importer and update History.

This commit is contained in:
Tom Preston-Werner 2011-05-09 00:59:40 -07:00
parent 0dc55aacff
commit f808c98232
3 changed files with 14 additions and 14 deletions

View File

@ -10,6 +10,7 @@
* Better error message for invalid post date (#291) * Better error message for invalid post date (#291)
* Print formatted fatal exceptions to stdout on build failure * Print formatted fatal exceptions to stdout on build failure
* Add Tumblr importer (#323) * Add Tumblr importer (#323)
* Add Enki importer (#320)
* Bug Fixes * Bug Fixes
* Secure additional path exploits * Secure additional path exploits

View File

@ -161,6 +161,7 @@ if ARGV.size > 0
:wordpress => 'Wordpress', :wordpress => 'Wordpress',
:csv => 'CSV', :csv => 'CSV',
:drupal => 'Drupal', :drupal => 'Drupal',
:enki => 'Enki',
:mephisto => 'Mephisto', :mephisto => 'Mephisto',
:mt => 'MT', :mt => 'MT',
:textpattern => 'TextPattern', :textpattern => 'TextPattern',

View File

@ -8,19 +8,19 @@ require 'sequel'
module Jekyll module Jekyll
module Enki module Enki
SQL = <<-EOS SQL = <<-EOS
SELECT p.id, SELECT p.id,
p.title, p.title,
p.slug, p.slug,
p.body, p.body,
p.published_at as date, p.published_at as date,
p.cached_tag_list as tags p.cached_tag_list as tags
FROM posts p FROM posts p
EOS EOS
# just working with postgres, but can be easily adapted # Just working with postgres, but can be easily adapted
# to work with both mysql and postgres # to work with both mysql and postgres.
def self.process(dbname, user, pass, host='localhost') def self.process(dbname, user, pass, host = 'localhost')
FileUtils.mkdir_p '_posts' FileUtils.mkdir_p('_posts')
db = Sequel.postgres(:database => dbname, db = Sequel.postgres(:database => dbname,
:user => user, :user => user,
:password => pass, :password => pass,
@ -28,7 +28,6 @@ module Jekyll
:encoding => 'utf8') :encoding => 'utf8')
db[SQL].each do |post| db[SQL].each do |post|
name = [ sprintf("%.04d", post[:date].year), name = [ sprintf("%.04d", post[:date].year),
sprintf("%.02d", post[:date].month), sprintf("%.02d", post[:date].month),
sprintf("%.02d", post[:date].day), sprintf("%.02d", post[:date].day),
@ -46,6 +45,5 @@ module Jekyll
end end
end end
end end
end
end # module Enki end
end # module Jekyll