Articles tagged 'rubygems'
-
Migrating your blog posts to Markdown with Upmark and Nokogiri
February 3, 2012
This post was originally published in the Rambling Labs Blog on February 3, 2012.
As I said in my last post, for our new site, we changed our blog engine from WordPress to the Postmarkdown gem. At the end of that post, I mentioned that we had to migrate the old posts from WordPress to Markdown.
To do this, we built a ruby script using the Upmark gem and the Nokogiri gem. Nokogiri is used for HTML and XML parsing, among other things, while Upmark is used to generate Markdown from a given HTML.
First, we exported our old blog posts from WordPress to an XML file that looks like this:
<?xml version="1.0" encoding="UTF-8" ?> <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. --> <!-- ... --> <rss
-
Generating your site menu with the 'simple-navigation' gem
January 3, 2012
This post was originally published in the Rambling Labs Blog on January 3, 2012.
One of the cool things I learned while building our new site was how to generate your site navigation menu without having to do the highlighting logic yourself.
There’s a great gem out there for this called
simple-navigation
, which you can find on GitHub. It’s easy to set up and use, so you will probably do what you need to do really quick. To install, add it to your rails applicationGemfile
:gem 'simple-navigation'
Then, run
bundle install
. After it’s installed, generate the configuration file for it, which will be theconfig/navigation.rb
, with the following:rails generate navigation_config
Go ahead and open the
config/navigation.rb
file, and add your… -
The nokogiri gem and the "libxslt is missing" error
October 17, 2011
This post was originally published in the Rambling Labs Blog on October 17, 2011.
I ran into this issue today. But this one’s easy. Just run the following command and install the gem again:
apt-get install libxslt1.1 libxslt1-dev libxslt-ruby
That’s it! It should work fine now :).
-
Using Postgresql with Rails 3.1: the 'pg' gem
October 17, 2011
This post was originally published in the Rambling Labs Blog on October 17, 2011.
As you may know I’ve been learning Ruby on Rails for the last few weeks. I’m also currently developing an application using the edge version of RefineryCMS (which is really a Rails 3.1 application), integrated with the almighty Heroku.
I wanted to use RefineryCMS with Postgresql, so the only thing that I had to do was installing postgresql and it’s corresponding gem ‘pg’… Or so I thought.
I wasn’t surprised. About a year ago I had the same unfulfilled expectations with mysql and the mysql gem. So, this is what I had to do:
- First, of course, install postgresql with
apt-get install postgresql
- Then, install the libpq-dev with
apt-get install libpq-dev
. Note…
- First, of course, install postgresql with
-
Updating and/or uninstalling all installed gems
October 8, 2011
This post was originally published in the Rambling Labs Blog on October 8, 2011.
I like to have an rvm gemset (see more about rvm) with the latest versions of all gems and I usually use this as my sandbox for testing out the latest features and issues of the gems. To update one gem to it’s latest stable version, you just have to run this:
gem update GEMNAME
The only problem is that for updating every gem you have installed, you have to remember each and every gem you have installed to pass it to the command… Nah, I’m just kidding. Just run the following command, and you’ll be fine:
gem update `gem list | cut -d ' ' -f 1`
UPDATE
To uninstall all installed gems, it’s the same command with
uninstall
instead ofupdate
, like this:gem…