Skip to content

Commit

Permalink
Merge pull request #18 from boone/fix_s9y_process
Browse files Browse the repository at this point in the history
Fix for S9Y import

Specify data source using --source option. Solves "can't convert Hash into String" error
  • Loading branch information
parkr committed Mar 24, 2013
2 parents edb77b3 + b5ddfa4 commit c44fa97
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/jekyll/jekyll-import/s9y.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@

module JekyllImport
module S9Y
def self.process(file_name)
def self.validate(options)
if !options[:source]
abort "Missing mandatory option --source, e.g. --source \"http://blog.example.com/rss.php?version=2.0&all=1\""
end
end

def self.process(options)
validate(options)

FileUtils.mkdir_p("_posts")

source = options[:source]

text = ''
open(file_name, 'r') { |line| text = line.read }
open(source) { |line| text = line.read }
rss = RSS::Parser.parse(text)

rss.items.each do |item|
Expand Down

0 comments on commit c44fa97

Please sign in to comment.