Gems with underscores always seem to mess with me and this one was no exception. Here’s what goes into the Gemfile to avoid getting NameError/uninitialized constant YouTubeG ruining your day:
gem 'youtube-g', :git => "git://github.com/jasondoucette/youtube-g.git", :require => 'youtube_g'
Note the use of dashes and underscores – the :require directive is what makes this all work.
(Aside: I forked the code from another repository because I want to make some changes – the original documentation suggests that the Client.video_by method can retrieve video information by YouTube URL, but it’s actually the data URL they’re referring to, i.e. http://gdata.youtube.com/feeds/api/videos/UdJ0E7HbTKc and not http://www.youtube.com/watch?v=UdJ0E7HbTKc, which would be a lot more useful for a client app where they can paste in a URL to add the video to their CMS. If I don’t end up spending another zillion hours fighting configurations, I might even do that. Check github later…)
As I said, I’ve run into this kind of thing before with underscores and other differences between the gem name and the file name, which in the Rails 2.x world would be fixed with the :lib directive, but now we’ve got Bundler and Gemfiles.