Skip to content

Commit

Permalink
Clean up Enki importer and update History.
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed May 9, 2011
1 parent 0dc55aa commit f808c98
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions History.txt
Expand Up @@ -10,6 +10,7 @@
* Better error message for invalid post date (#291)
* Print formatted fatal exceptions to stdout on build failure
* Add Tumblr importer (#323)
* Add Enki importer (#320)
* Bug Fixes
* Secure additional path exploits

Expand Down
1 change: 1 addition & 0 deletions bin/jekyll
Expand Up @@ -161,6 +161,7 @@ if ARGV.size > 0
:wordpress => 'Wordpress',
:csv => 'CSV',
:drupal => 'Drupal',
:enki => 'Enki',
:mephisto => 'Mephisto',
:mt => 'MT',
:textpattern => 'TextPattern',
Expand Down
26 changes: 12 additions & 14 deletions lib/jekyll/migrators/enki.rb
Expand Up @@ -8,27 +8,26 @@
module Jekyll
module Enki
SQL = <<-EOS
SELECT p.id,
p.title,
p.slug,
p.body,
p.published_at as date,
p.cached_tag_list as tags
SELECT p.id,
p.title,
p.slug,
p.body,
p.published_at as date,
p.cached_tag_list as tags
FROM posts p
EOS

# just working with postgres, but can be easily adapted
# to work with both mysql and postgres
def self.process(dbname, user, pass, host='localhost')
FileUtils.mkdir_p '_posts'
# Just working with postgres, but can be easily adapted
# to work with both mysql and postgres.
def self.process(dbname, user, pass, host = 'localhost')
FileUtils.mkdir_p('_posts')
db = Sequel.postgres(:database => dbname,
:user => user,
:password => pass,
:host => host,
:encoding => 'utf8')

db[SQL].each do |post|

name = [ sprintf("%.04d", post[:date].year),
sprintf("%.02d", post[:date].month),
sprintf("%.02d", post[:date].day),
Expand All @@ -46,6 +45,5 @@ def self.process(dbname, user, pass, host='localhost')
end
end
end

end # module Enki
end # module Jekyll
end
end

0 comments on commit f808c98

Please sign in to comment.