rubygems

ruby: code to install gem if missing

is there some ruby code I can use to install a gem from a local file, if that gem is not installed? i'm thinking it would look something like: if !gem_installed("some gem name") system "gem install -l local_copy.gem" end i don't know if anything exists that lets me check for gems like this or not... ...

Simple Ruby SFTP example syntax error

I have an issue that seems like very flaky behavour, is this a problem with Ruby or something I've done? Please help - my project is stalled until I resolve this. Given this code running on Mac OS Leopard: require 'uri' require 'net/ssh' require 'net/sftp' include Net def copy_from_uri( uri, local_path ) # SFTP copy SFTP.start...

How to install Rails 2.3.2 and 2.3.4 simultaneously on Ubuntu 9.04?

I need to install Rails 2.3.2 and Rails 2.3.4 simultaneously on my Ubuntu 9.04 server. How do I do this? When I run: sudo gem install rails ...it installs version 2.3.4. Is there a single command I can use to also install 2.3.2 parallel to the default (latest) version? Thanks! ...

jruby -S rake gems:install shows success but doesn't in fact install the gems

Has anyone used rake gems:install under jruby? running sudo jruby -S rake gems:install --trace give me the following output: ** Invoke gems:install (first_time) ** Invoke gems:base (first_time) ** Execute gems:base ** Invoke environment (first_time) ** Execute environment ** Execute gems:install gem install reek For more information o...

How to convert with Ruby accented characters in HTML special entities

How can I do this on Ruby? puts some_method("ò") # => "ò" In other words convert an accented character like ò to his HTML version: ò I tried like this: # coding: utf-8 require 'rubygems' require 'htmlentities' require 'unicode' coder = HTMLEntities.new string = "Scròfina" puts coder.encode(string, :named) but what I...

What did I actually delete by running "gem sources -c"?

I ran "gem sources -c" so that I have to deliberately specify where I want to install a gem from since I now have 3 different sources for gem installs - RubyForge, Github and Gemcutter. C:\>gem sources -c *** Removed specs cache *** *** Removed user source cache *** *** Removed latest user source cache *** *** Removed system source cach...

whenever gem minutely job. If minutely job takes more than one minute then what

I am plannning to use whenever gem which among other things will also run minutely rake task. If my rake task takes more than a minute then based on the output from whenever gem it seems like the second instance of the rake task will kick-in even though the first one is not quite finished. Will whenever gem will wait for the miutely tas...

Why does Rails think I have RubyGems 1.0.1 when I have v1.3.5?

I made a change to my shell profile and now when I try to run the Rails console on a Rails app I created, I get this message: Loading development environment (Rails 2.3.4) Rails requires RubyGems >= 1.3.2 (you have 1.0.1). Please `gem update --system` and try again. However, when I run gem -v the output is 1.3.5. What happened here, ...

Gem specification in Rakefile vs .gemspec

I am creating a new ruby gem using NetBeans as my IDE. The initial project structure contains a Rakefile with the gem specification and other rake tasks. My question is, what is the difference between having a gem specification located in a Rakefile compared with having it located in a .gemspec file? Is there a best-practice for where t...

How to handle Ruby on Rails error: "Please install the postgresql adapter: `gem install activerecord-postgresql-adapter'"

Running a Ruby on Rails (RoR) app or Ruby code which uses the ActiveRecord framework, you get the error message: Please install the postgresql adapter: gem install activerecord-postgresql-adapter Trying to run: gem install activerecord-postgresql-adapter also fails, leaving you at a loss. ...

Where do I insert my Rails URL in the JQuery Autocomplete to reference the data set I want?

Where do I reference my controller (Rails) URL to show the dataset that I want in the autocomplete via JQuery? Here is my head: <script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js"&gt;&lt;/script&gt...

Gem::RemoteFetcher::FetchErro when installing rails

Hi, I am trying to install rails on Ubuntu 8.10, and met following errors. Please help me get through.Thanks. root@pierr-desktop:~# gem install rails ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) bad response 500 (http://gems.rubyforge.vm.bytemark.co.uk/gems/actionpack-2.3.4.gem) #other information root@pierr-des...

How to remove a remote source from gem remote sources

I have added gemcutter.org to my Rubygems sources, and now I do not know how to remove it. $ gem sources *** CURRENT SOURCES *** http://gemcutter.org http://gems.rubyforge.org/ ...

mysql gem looking for an earlier version of libmysqlclient.16.dylib

I just upgraded to Mac OSX Snow Leopard, and recompiled mysql (5.1.39) with the Snow Leopard XCode. I also reinstalled the latest mysql gem. Now, when running rake db:migrate in a rails app, I get dyld: NSLinkModule() error dyld: Library not loaded: /usr/local/mysql/lib/libmysqlclient.15.dylib Referenced from: /usr/local/lib/ruby/...

Karma/Reputation Plugin for Ruby on Rails?

I am looking for a karma (reputation) plugin or gem for Ruby on Rails. Preferably one that was integrated many of the best practices and research around the topic of community management & development. Any recommendations? ...

Question related to mysql gem new method authentication

I normally code on windows and using MYSQL4.1. And mysql gem version is 2.8.1. In my setup when I use mysql gem to access the MYSQL server, I give the root username and password of the sql server. And in rails db config file, I give user name as 'root' and its password and host as 'localhost'. My rails server and Mysql server are running...

Can't find gems in irb: "NameError: uninitialized constant Gem from (irb)"

When I run a Rails app it finds all of my installed gems correctly. This is the first time I tried to call some gems from inside irb and it couldn't find them. blocke:~$ irb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'rails' LoadError: no such file to load -- rails from /usr/local/lib/site_ruby/1.8/rubygems/c...

How do I find gems that depend on a given gem?

Is it possible to search for all gems that rely on a certain rubygem? For example, I'd like to ask for all gems in gemcutter that rely on the test-unit gem. Background: I'm looking to see how other gems handle the issue mentioned here. ...

MySQL Rails migration error: "Error on rename of schema_migration (errno: -1)"

Hi there, I'm a PHP dev and I'm new to Rails but have been getting on pretty well, everything seems pretty straightforward. However, up until this morning I have been using SQLite and decided to move what I'm building to MySQL. rake db:create works perfectly, but when I attempt to rake db:migrate I get the following error: rake abort...

Can't install gemcutter as a Ruby Gem source

I'm trying to install the thinking sphinx gem, which is on gemcutter.org When I run the command gem sources -a http://gemcutter.org I get the error: Error fetching http://gemcutter.org: bad response Not Found 404 (http://gemcutter.org/specs.4.8) If I change the above URL to http://gemcutter.org.specs.4.8.gz it finds a file. How do...