Mar
20
2012
I was trying to install a Ruby gem and it keep failing. I keep getting the following error when installing a gem.
ERROR: http://gems.datamapper.org does not appear to be a repository
ERROR: could not find gem thin locally or in a repository
Because of the above error I couldn’t install a gem or even update my gem system.
I certainly don’t remember ever adding gems.datamapper.org as a gem source repository but now it is causing errors in my system. You can list all of your current gem source repositories by entering the following from your command prompt.
gem source
You may see a few gem sources possibly including repositories from rubyforge.org, rubyonrails.org, and github.com. In addition to these gems source, the problematic gems.datamapper.org was also listed in my system.
To remove the problematic source, gems.datamapper.org, enter the following command from the command prompt.
gem source -r http://gems.datamapper.org
no comments | tags: datamapper, error, gem, install, repository, rubygems | posted in Ruby, TechKnow, Tools
Oct
27
2009
Recently, I gave myself the small task of going through all my Twitter retries and downloading each profile image from each Twitter user that replied to me. To access my Twitter replies I used the Twitter Ruby Gem. I am using Twitter gem version 0.4.1.
The script is small and pretty concise that it can speak for itself. I use my Twitter credential to log on and query for the 40 most recent replies. For each reply download the user’s profile image.
require 'rubygems'
gem 'twitter', '=0.4.1'
require 'twitter'
require 'open-uri'
require 'find'
twitter = Twitter::Base.new(username, password)
replies = twitter.replies(:count => 40)
replies.each do |status|
user = status.user
image_url = user.profile_image_url
image_name = image_url.match(/([\w_]+).(\w\w\w)$/)
file_path = "profile/#{image_name[1]}.#{image_name[2]}"
# Did I already download this image?
unless File.exists?(file_path)
File.open(file_path, 'w') do |output|
# Download image
open(image_url) do |input|
output << input.read
end
end
end
end
2 comments | tags: gem, image, Ruby, tweet, twitter | posted in Ruby