ruby-2.0

Uninstalling all gems Ruby 2.0.0

≡放荡痞女 提交于 2019-11-27 17:06:40
It seems that ruby 2.0.0 has added "default" gems to the mix and makes them non removable by gem uninstall. How can you remove all non default gems? I used this one line script. for i in `gem list --no-versions`; do gem uninstall -aIx $i; done It ignores default gem errors and just proceeds. Simple and self-evident. Dolittle Wang First, go to the gems directory Like ../ruby/2.0.0-p195/lib/ruby/gems/2.0.0/specifications You will find a directory named default , which including all the default gems shipped with ruby 2.0 Move all the *.gemspec stored in default dir to specifications dir and

Named parameters in Ruby 2

不问归期 提交于 2019-11-27 11:55:19
问题 I don't understand completely how named parameters in Ruby 2.0 work. def test(var1, var2, var3) puts "#{var1} #{var2} #{var3}" end test(var3:"var3-new", var1: 1111, var2: 2222) #wrong number of arguments (1 for 3) (ArgumentError) it's treated like a hash. And it's very funny because to use named parameters in Ruby 2.0 I must set default values for them: def test(var1: "var1", var2: "var2", var3: "var3") puts "#{var1} #{var2} #{var3}" end test(var3:"var3-new", var1: 1111, var2: 2222) # ok =>

-bash: __git_ps1: command not found

痴心易碎 提交于 2019-11-27 11:12:05
I tried to install Ruby 2.0. My command line urped and now looks like the following: -bash: __git_ps1: command not found [11:58:28][whatever@whatever ~]$ I have not a clue how to get rid of the __git_ps1 command not found error. I've searched my .bash_profile and my .bashrc to see if it's trying to set a variable or something and am not seeing anything. The only place I can find git_ps1 mentioned is in ~/.dotfiles/.bash_prompt. I replace the content of that file completely, logout and log back in and it fixes nothing. I saw this , but I'm pretty new to command line so I just confused myself.

Getting “Warning! PATH is not properly set up” when doing rvm use 2.0.0 --default

女生的网名这么多〃 提交于 2019-11-27 10:05:45
Above doesn't work first time, works 2nd time. Try to set ruby version to 2.0.0 for any new shell windows. Doing $ rvm use 2.0.0 --default gives Warning! PATH is not properly set up, '/home/durrantm/.rvm/gems/ruby-1.9.3-p125/ bin' is not at first place, usually this is caused by shell initialization files - check them for ' PATH=...' entries, it might also help to re-add RVM to your dotfiles: 'rvm get stable --au to-dotfiles', to fix temporarily in this shell session run: 'rvm use ruby-1.9.3-p125' . Using /home/durrantm/.rvm/gems/ruby-2.0.0-p247 Then doing the same $ rvm use 2.0.0 --default

Error “…cannot load such file — mysql2/2.0/mysql2 (LoadError)”. On Windows XP with Ruby 2.0.0

☆樱花仙子☆ 提交于 2019-11-27 09:05:53
The command rails server throws this error. C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.0/mysql2 (LoadError) I use Ruby 2.0.0 from RubyInstaller on Windows XP box. I figured out what is the problem but I don't know how to solve it. The problem is that there is no any 2.0/ directory in the mysql2-0.3.11-x86-mingw32 gem. This is the gem that rails installs as its dependency from Gemfile : GEM remote: https://rubygems.org/ specs: ... many gems here mysql2 (0.3.11-x86-mingw32) ... many gems here DEPENDENCIES .

How to install Ruby 2 on Ubuntu without RVM

99封情书 提交于 2019-11-27 04:59:11
问题 I want to install ruby 2.0 using sudo apt-get install ruby2.0 But there isn't available package for ruby2.0 I want to install it using apt-get install the same like ruby 1.9.1 Any suggestions? 回答1: sudo apt-get -y update sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev cd /tmp wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz tar -xvzf ruby-2.0.0-p451.tar.gz cd ruby-2.0.0-p451/ ./configure --prefix=/usr/local make sudo make install

How to use the debugger with Ruby 2.0?

家住魔仙堡 提交于 2019-11-27 04:29:11
问题 I know the debugger gem is not and never will be compatible with ruby 2.0 per "officially support ruby 2.X". In the changelog of Ruby 2.0 is: Debug support DTrace support, which enables run-time diagnosis in production TracePoint, which is an improved tracing API Is there something out of the box for debugging with Ruby 2.0? Can somebody explain this to me? 回答1: The debugger gem can be used but it still has issues. Install byebug which was written for Ruby 2.0 debugging. For breakpoints, use

Unexpected Return (LocalJumpError)

浪尽此生 提交于 2019-11-27 00:51:55
问题 What is the problem with this Ruby 2.0 code? p (1..8).collect{|denom| (1...denom).collect{|num| r = Rational(num, denom) if r > Rational(1, 3) and r < Rational(1, 2) return 1 else return 0 end } }.flatten The error is in block (2 levels) in <main>': unexpected return (LocalJumpError) . I want to create a flat list containing n ones (and the rest zeroes) where n is the number of rational numbers with denominators below 8 which are between 1/3 and 1/2. (it's a Project Euler problem). So I'm

Installing Ruby 2.0 and Rails 4.0.0beta on AWS EC2

房东的猫 提交于 2019-11-26 23:53:51
问题 Installing Ruby 2.0.0 and Rails 4.0.0beta1 on the default Amazon EC2 Linux install (Amazon Linux AMI 2012.09.1) goes smoothly. But openssl gets in the way (eg http://railsapps.github.com/openssl-certificate-verify-failed.html) and weird either prevent openssl from getting installed or causing the RubyGem package manager from installing rails. How can I work around these problems? 回答1: Log into your brand new instance: [19:59:22] paul:~ $ ssh -i ~/.ssh/server.pem ec2-user@your.ip __| __|_ ) _|

“bin/rails: No such file or directory” w/ Ruby 2 & Rails 4 on Heroku

本秂侑毒 提交于 2019-11-26 22:09:39
While following the Rails 4 Beta version of Michael Hartl's Ruby on Rails Tutorial , my app fails to start on Heroku, but runs fine locally with bundle exec rails server . Checking heroku logs -t reveals the following error: $ heroku[web.1]: State changed from crashed to starting $ heroku[web.1]: Starting process with command `bin/rails server -p 33847 -e $RAILS_ENV` $ app[web.1]: bash: bin/rails: No such file or directory $ heroku[web.1]: Process exited with status 127 $ heroku[web.1]: State changed from starting to crashed $ heroku[web.1]: Error R99 (Platform error) -> Failed to launch the