Upgrading to Ruby 2.0, overwriting executable files without a hint

When upgrading from ruby ​​1.9.3 to ruby ​​2.0 on linux (at least 12.04), an unexpected prompt appears.

rdoc executable "rdoc" conflicts with /path/bin/rdoc Overwrite the executable? [yN] 

It works great to overwrite it manually, but I'm looking for a way for my scripts to automatically answer yes without stopping.

Just found this problem on rubygems a year ago . I use gem install in the script, so I can add yes | gem install yes | gem install

Edit: Tried yes | gem install rdoc yes | gem install rdoc , but with an error:

 ERROR: Error installing rdoc: "rdoc" from rdoc conflicts with /usr/local/rubies/2.0.0-p0/bin/rdoc 
+6
source share
5 answers

You can add

  yes | 

yes, just type y over and over, which goes to standard input.

(thanks @adamdunson)

+3
source

For me, with Ubuntu and Ruby 2.0, yes! as described above, NOT working as described in my auto-build script (using a gem for spraying).

So I added a step to the build script to rename (in my case) / usr / local / bin / rdoc and / usr / local / bin / ri before the installation is complete.

Therefore, the installation recreates these files without the annoying invitation, which I simply could not escape in any way. Personally, I think the suggestion https://github.com/rubygems/rubygems/pull/280 is good, although this did not seem to be embraced by the open-arms community.

My solution is a somewhat rude decision, but can help others until a more elegant solution appears.

+1
source

--force worked for me:

gem install --force rdoc

Disclaimer: this is not what --force , and I don't know why yes | does not work.

+1
source

In fact, you should not say yes. This is currently a bug for Ruby 2.0 . My own fix (which I generally do, even if it's not a problem!) Is to use the gemset handler (I'm using rbenv-gemset, with rbenv right now).

0
source

The prefix yes | didn't work in my case (rubygems checks that the input is tty). What works for me:

 expect <<-DONE set timeout -1 spawn gem update expect { "Overwrite the executable?" { send -- "y\r"; exp_continue } eof } DONE 
0
source

Source: https://habr.com/ru/post/944573/


All Articles