Error while trying to import Blogger Posts into Octopress/Jekyll - ruby

I wanted to switch my main blog to Octopress earlier today and so, I cloned Octopress, configured it and deployed it in Heroku.
Then I searched the net on how to import my old blogger posts into Octopress and found this script as the answer to it:
https://gist.github.com/1578928
I have the exported blog.xml file with me. When I run the script in the gist, I get the following error. I've just started with Ruby and I don't know much about it. I would be glad if anyone could help me with this. The error seems completely new and I couldn't find any answers to this from my searches so far.
import.rb:33:in `add': dunno ide (RuntimeError)
from import.rb:158:in `block in <main>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.2-x86-mingw32/lib/nokogiri/xml/node_set.rb:239:in `block in each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.2-x86-mingw32/lib/nokogiri/xml/node_set.rb:238:in `upto'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.2-x86-mingw32/lib/nokogiri/xml/node_set.rb:238:in `each'
from import.rb:157:in `<main>'

Looking at the script in the Gist you linked, the problem is that it can only parse 'post' and 'comment' types, while you seem to have another one called 'ide'.
You should double check if the output XML is all right and doesn't have strangely named tags.

Related

ruby package loaded but not functional

I've loaded a package in ruby but when I try to execute it, I get an error.
Please help!
Code:
require 'telegram/bot'
token = "REPLACE_WITH_ACTUAL_TOKEN"
Telegram::Bot::Client.run(token) do |bot|
end
Result:
undefined method `run' for Telegram::Bot::Client:Class (NoMethodError)
The error message is pretty self-explanatory:
undefined method `run' for Telegram::Bot::Client:Class (NoMethodError)
The error message is telling you that the method Telegram::Bot::Client::run does not exist, and both the documentation, the README, and the source code seem to agree that there is, indeed, no such method.
Issue here is not that your package is not loaded. But that class method run does not exist. You may want to check whether you have installed the latest version, not something old.
Other than that, I can hardly imagine what could be going on.

How to run wukong examples?

Wukong looks like a pretty nice Ruby way to get into Hadoop through the streaming interface. However, after looking over the examples at the git page:
https://github.com/infochimps-labs/wukong/tree/master/examples
I have no idea how to actually run any of these and generate output.
EDIT: I tried running the following example:
$ ./word_count.rb --run=local README.txt .
This generates an error:
/Users/evanzamir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- wukong/script (LoadError)
from /Users/evanzamir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from ./word_count.rb:2:in `<main>'
It seems to be having an issue with the line require 'wukong/script', but I'm not sure how to fix it.

Octopress Chokes on Blogger-Imported HTML

everyone. I'm using this ruby script to import my Blogger XML file into Octopress. The initial import works fine, the XML is parsed and HTML files are generate in ./_posts/ (with the proper naming convention). I moved these to ./source/_posts/ so Jekyll could parse them for use in the site. When I try to use rake -t generate, I get this error:
samurailink3#Manacotti:~/Dropbox/Important Backups/Git Repos/samurailink3.com$ rake -t generate
** Invoke generate (first_time)
** Execute generate
## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/_config.yml
Building site: source -> public
/usr/lib/ruby/1.9.1/uri/common.rb:304:in `escape': undefined method `gsub' for 3:Fixnum (NoMethodError)
from /usr/lib/ruby/1.9.1/uri/common.rb:623:in `escape'
from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/post.rb:140:in `block in url'
from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/post.rb:140:in `map'
from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/post.rb:140:in `url'
from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:69:in `location_on_server'
from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:219:in `fill_location'
from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:181:in `fill_url'
from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:146:in `block in fill_posts'
from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:144:in `each'
from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:144:in `fill_posts'
from /home/samurailink3/Dropbox/Important Backups/Git Repos/samurailink3.com/plugins/sitemap_generator.rb:120:in `generate'
from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:190:in `block in generate'
from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `each'
from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:189:in `generate'
from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:40:in `process'
from /var/lib/gems/1.9.1/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
from /usr/local/bin/jekyll:23:in `load'
from /usr/local/bin/jekyll:23:in `<main>'
Any ideas? Everything was working perfectly until I attempted the import.
Also, here is the code if you want to have a look. I'm working off of the source branch.
I expect that these types of errors are pretty common when doing an automatic translation and that each time has its own tricks and turns. When I did an import into jekyll, it choked on iframe HTML tags (for embedded videos) that weren't closed. Even though they were valid, the parser didn't like them. You may have something similar going on.
This line:
/usr/lib/ruby/1.9.1/uri/common.rb:304:in `escape': undefined method `gsub' for 3:Fixnum (NoMethodError)
gives you the first clue of where to start. Something is trying to call 'gsub'. My first step would be to search for that string in your output files. If you find one, temporarily remove all the other files in your ./source/_posts/ directory except for it. This will reduce the size of your problem set and let you experiment more to figure out exactly what's going on. Start hacking on that file until you get it to work.
Update:
If you don't find 'gsub' (and I've seen a few more references to it that make me think you won't find that as a string). A good trouble shooting approach is still to only keep one file at a time in your ./source/_posts/ directory to narrow down exactly what is going on.

Deploy Sinatra template on Helicon Zoo

I installed the Ruby Hosting Package and Sinatra on Windows Server 2008R2 with IIS using Helicon Zoo.
I downloaded and imported the Sinatra template from Helicon Zoo Templates using web deploy on IIS
Now I get this error when navigating to the website:
[tid-7800168] paths need to start with / (ArgumentError)
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:30:in `block in remap'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:22:in `each'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:22:in `map'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:22:in `remap'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:18:in `initialize'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:142:in `new'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:142:in `generate_map'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:128:in `to_app'
C:/Zoo/Workers/ruby/lib/app.rb:45:in `build_app'
C:/Zoo/Workers/ruby/lib/app.rb:16:in `initialize'
C:/Zoo/Workers/ruby/lib/worker.rb:4:in `new'
C:/Zoo/Workers/ruby/lib/worker.rb:4:in `initialize'
C:/Zoo/Workers/ruby/zoorack.rb:30:in `new'
C:/Zoo/Workers/ruby/zoorack.rb:30:in `<module:Zack>'
C:/Zoo/Workers/ruby/zoorack.rb:12:in `<main>'
Any Ideas?
Please upgrade Helicon Zoo Module from the feed to the version 1.0.0.47. Just go to Zoo -> Modules and install it again.
Neil,
I posted a similar question just a couple of days ago, here.
As you can see from Yaroslav's reply, an updated version of Helicon Zoo module may help your case.
I think it is something to do with IIS Express installation in my case (I couldn't install it successfully through the web platform installer and had to go directly to download it from the MS site + when I run the ruby web server it works). I don't think my issue will help you, but maybe the Helicon update might?

Heroku app throws "Internal Server Error"

This app works just fine on my local computer. After pushing it to Heroku, static pages appear to be working but the blog section throws an Internal Server Error. I pulled the logs by running "heroku logs" and this is what I get:
==> production.log <==
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/runner.rb:177:in `send'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/bin/thin:6
Something wrong with the eventmachine gem, I suppose....but it works fine on my machine. So I'm not sure what's going on or how to debug it.
From your error log, it looks like you are somehow trying to access a database with SQLite3. Heroku's uses Postgresql though, so clearly your database will fail to open. Heroku generates automatically the database.yml file, so the error is can't be there but maybe you are requiring and using sqlite3 directly?
I'm not sure how heroku handles things, but the trace/logs seem to say you might not have migrated your database. Is this the case?
Try updating the heroku gem. Worked for me.

Resources