PDA

View Full Version : RoR syntax error. Where did I go wrong?



andy_blah
April 13th, 2011, 02:55 PM
Hello,
Been trying to follow this (http://joneslee85.wordpress.com/2010/07/25/howto-recover-wordpress-posts-from-google-reader) guide with a Ruby on Rails script, did all the modifications, and finally saved the file. The only problem it retuns this:


RSS.rb:48: syntax error, unexpected tIDENTIFIER, expecting kDO or '{' or '('
...035/state/com.google/starred?n=12
^

Can anyone advise me what to do?
Thank you in advance.

Arndt
April 13th, 2011, 09:26 PM
Hello,
Been trying to follow this (http://joneslee85.wordpress.com/2010/07/25/howto-recover-wordpress-posts-from-google-reader) guide with a Ruby on Rails script, did all the modifications, and finally saved the file. The only problem it retuns this:


RSS.rb:48: syntax error, unexpected tIDENTIFIER, expecting kDO or '{' or '('
...035/state/com.google/starred?n=12
^

Can anyone advise me what to do?
Thank you in advance.

48 lines is not so much. Can you post the whole script?

andy_blah
April 13th, 2011, 10:41 PM
My bad, forgot to leave the content too >.<

#!/usr/lib/ruby/1.9.1
require 'rubygems'
require 'simple-rss'
require 'open-uri'
require 'builder'
require 'progressbar'

source = {"http://google.com/reader/atom/user/16912036744440613035/state/com.google/starred?n=12"}
content = ""

pbar = nil

feed = SimpleRSS.parse(open(source,
:content_length_proc => lambda {|t|
if t && 0 < t
pbar = ProgressBar.new("Fetching Atom Feed", t)
pbar.file_transfer_mode
end
},
:progress_proc => lambda {|s|
pbar.set s if pbar
}))

xml = Builder::XmlMarkup.new( :target => File.open("rss.xml", "w"), :indent => 2 )
xml.instruct!
xml.rss("version" => "0.9.2") do
xml.channel do
xml.title feed.channel.title
xml.link feed.channel.link
xml.description "I am going to turn to RSS"
xml.lastBuildDate feed.channel.updated
xml.docs "http://backend.userland.com/rss092"
xml.language "en"

feed.items.each do | item |
xml.item do
xml.pubDate item.published
xml.category item.category
xml.title item.title
c = item.content
c.gsub!("\n",'')
xml.description c
xml.link item.link
end
end
end
end


48 lines is not so much.

What do you mean by that? ^^;

Arndt
April 14th, 2011, 12:26 PM
My bad, forgot to leave the content too >.<


What do you mean by that? ^^;

I meant only that it is small enough so one might see the error by inspection. But I'm not even that much at home in Ruby, so I can't help you further.