开发工具 Ruby-2.0.0-p0

shawnyu · 2013年02月24日 · 最后由 fsword 回复于 2013年03月04日 · 14439 次阅读

http://www.ruby-lang.org/en/news/2013/02/24/ruby-2-0-0-p0-is-released/

New Features

  • Language core features
    • Keyword arguments, which give flexibility to API design
    • Module#prepend, which is a new way to extend a class
    • A literal %i, which creates an array of symbols easily
    • dir, which returns the dirname of the file currently being executed
    • The UTF-8 default encoding, which make many magic comments omissible
  • Built-in libraries
    • Enumerable#lazy and Enumerator::Lazy, for (possibly infinite) lazy stream
    • Enumerator#size and Range#size, for lazy size evaluation
    • #to_h, which is a new convention for conversion to Hash
    • Onigmo, which is a new regexp engine (a fork of Oniguruma)
    • Asynchronous exception handling API
  • Debug support
    • DTrace support, which enables run-time diagnosis in production
    • TracePoint, which is an improved tracing API
  • Performance improvements
    • GC optimization by bitmap marking
    • Kernel#require optimization which makes Rails startup very fast
    • VM optimization such as method dispatch
    • Float operation optimization

完整的更新内容: https://github.com/marcandre/ruby/blob/news/NEWS.rdoc

迫不及待阿,装上跑起来试试。

#3 楼 @lgn21st

Today, I'll loose at least 50 karma points, but it's worth: Why people still use Ruby?

  1. Because they get dream day rates for maintaining rusty slow legacy systems
  2. Because they do not want to learn new languages and can stay in their comfort zone
  3. Because they think it's still 2005 and nobody cares about slow server response times And now Ruby lovers, click on downvote or give your reasons why you still use Ruby.

第一条太欢乐了

果断 rvm get latest rvm install 2.0.0 rvm use 2.0.0 --default

#4 楼 @bhuztez 这条后面的评论,也很欢乐。

哦也,装起,以后就 Rails 4.0 + Ruby 2.0 啦

还有一项特性是特别为 Rails 优化的呀,好有面子

终于等来 p0 啦!!

两个相关演讲,均来自 Ruby Conf 2012 Ruby 2.0 on Rails Implementation Details of Ruby 2.0 VM 讲一半,演讲者还变装,晕。。

Ruby, Happy Birthday

#2 楼 @lgn21st 想问一下,能感觉到什么明显的变化吗?

Release notes 里说 Rubygems 也已升级到 2.0.0 并作为 Ruby 2.0.0 的一部分发布,但用 rvm 装上的似乎还不是... 得等 Rubygems 真正发布 2.0.0: https://twitter.com/drbrain/status/305564020788830208

#13 楼 @5long 是啊,rvm 装怎么是 1.8.25

终于来了 Y^ ^Y

#13 楼 @5long 用 RVM 装得加上 --verify-downloads 1

Now if only rails 4 is also released …

#16 楼 @pepsin 我刚才用 rvm reinstall 2.0.0 --verify-downloads 1 结果 gem --version 输出的还是 1.8.24. 可能是因为我的系统没有 pre-built binary ruby, 而是从源码编译的?不过还好,自己升级一下也不难。

bundle install 的时候出现这个

Please upgrade to Bundler 1.3 or higher 

但是貌似 bundler 最新版本是 1.2.x 啊 还是再等等升级吧 话说 rails 4 什么时候 release 呀?

#20 楼 @hooopo yeah... I think there would be a few months before rails 4

#19 楼 @leeboqiang gem install bundler --pre

ruby 2.0.0-p0 #compiling 擦,卡在这快一个小时了

#13 楼 @5long rbenv 编译出来的 2.0.0-p0 的 rubygem 是 2.0.0

$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
$ gem -v
2.0.0

不过自己升级一下 gem update --system 就可以上 2.0.0 了...

windows 下通过 rubyinstaller 安装的 gem 也是 2.0.0 的

我觉得启动 irb 的速度提升明显

rvm 安装以后 rubygems 也是 2.0.0 的

欢呼。pragprog 提供了《Programming Ruby 2.0》的免费升级,喜上加喜。

macos 下,rvm 安装 ruby2.0.0,然后安装 rails4,报 openssl 的错误啊,有遇到的吗

#30 楼 @s6520643 ruby 编译时要加参数 ./configure --with-openssl-dir=/usr/local/opt/openssl

如果你用 brew 安装 ruby 的话,用 https://gist.github.com/windwiny/5026939 这里的内容替换 /usr/local/homebrew/Library/Formula/ruby.rb 文件。里面加上了 openssl 依赖

#30 楼 @s6520643 你试试

$ rvm pkg install openssl

#1 楼 @leekelby 哥们 你跑哪里了?

#33 楼 @kewin 现在还在帝都。 过几天就回去了,半年后再见。

用 rvm 安装了 2.0 , 如何共享 1.9 的 gem 过来?

#36 楼 @valentine migrate 是移动?那 1.9 下面还在吗?

#38 楼 @valentine 那我还是 bundle 好了

@huacnlee 问题解决了 https://github.com/carlhuda/bundler/issues/2318 gem install bundler --pre 是安装 1.3.0.pre.8,删除这个版本安装 1.3.0.pre.7

/home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:1176:in `create': cannot interpret as DNS name: nil (ArgumentError)
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:1022:in `generate_candidates'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:1047:in `resolv'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:513:in `each_resource'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:406:in `each_address'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:115:in `block in each_address'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:114:in `each'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:114:in `each_address'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:92:in `getaddress'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv.rb:43:in `getaddress'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv-replace.rb:10:in `getaddress'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/resolv-replace.rb:22:in `initialize'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:877:in `open'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:877:in `block in connect'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/timeout.rb:65:in `timeout'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:876:in `connect'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:861:in `do_start'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:850:in `start'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1366:in `request'
        from /home/john/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1125:in `get'
        from /home/john/.rvm/gems/ruby-2.0.0-p0/gems/faraday-0.8.4/lib/faraday/adapter/net_http.rb:72:in `perform_request'

very good.

以后再也不用加# encoding: utf-8

#29 楼 @ashchan

分享下 E 文版的 pdf 可以吗?谢谢啦。我的 mail: zw963 alt 163.om

for Mac Users and rbenv users

brew upgrade rbenv
brew upgrade ruby-build  必须的  由于在ruby-build中有ruby version list
rbenv install -l 返回有2.0.0-p0

export CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=$(brew --prefix readline)" 
rbenv install 2.0.0-p0  

果然是极快的…… 进 rails console,以前要 15、6 秒,现在只要 5、6 秒的时间; 跑测试前要加载各种文件的,以前要 30 秒,现在只要 10 秒啊亲。

不过小项目貌似不明显

报以下错误 如何处理? ➜ ~ export CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl --with-readline-dir=brew --prefix readline" ➜ ~ rbenv install 2.0.0-p0

Downloading openssl-1.0.1e.tar.gz... -> https://www.openssl.org/source/openssl-1.0.1e.tar.gz Installing openssl-1.0.1e...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/0b/ywhs0qyx2235vm2634f1q3fr0000gn/T/ruby-build.20130226210019.31621 Results logged to /var/folders/0b/ywhs0qyx2235vm2634f1q3fr0000gn/T/ruby-build.20130226210019.31621.log

问题解决,问题的原因在 https://github.com/sstephenson/ruby-build/commit/fee1e499fbc0f430b5a32d4f978e54ea740cc50f 需要更新 ruby-build(版本需要晚于 20130225) brew update brew upgrade ruby-build rbenv install 2.0.0-p0 即可:)

guardspork这些给rspec加速的工具是不是可以下岗了?

rails 都出到 4 啦,.

[2013-02-27 20:16:43] /Users/ray/.rvm/rubies/ruby-2.0.0-p0/bin/ruby ERROR: While executing gem ... (ArgumentError) invalid byte sequence in US-ASCII RubyGems 2.0.0 installed Parsing documentation for rubygems-2.0.0 Installing ri documentation for rubygems-2.0.0

ruby gem 安装有问题,何解?

rvm 中有没?

#53 楼 @shatle 现在已经有了。rvm get stable 吧。

#52 楼 @ray export LANG=zh_CN.UTF-8

#55 楼 @inntran thanks,折腾了好几天了,坑爹啊,一下 openssl 有问题,一下 gem 有问题。。。够折腾的

这边运气比较好,在 MacOS Lion 10.8 运行 rvm install 2.0.0 没有碰到 openssl 的问题(估计依赖的 package 之前都通过 brew 安装过了),只是在创建新的 gemset 时,bundle install 出现 mysql2 经典问题:

An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.

还好最后是解决了。

我很顺利呀。

之前说过的 trait 没有出现

#56 楼 @ray 我解决你那个问题了,但是还有这样的问题。

deploy@39:~$ gem -v
2.0.0
deploy@39:~$ gem install lazy_high_charts -v '1.3.3'
ERROR:  Error installing lazy_high_charts:
    lazy_high_charts requires RubyGems version ~> 1.3. Try 'gem update --system' to update RubyGems itself.
deploy@39:~$ gem update --system
Latest version currently installed. Aborting.
deploy@39:~$ gem install rubygems-update
Successfully installed rubygems-update-2.0.0
Parsing documentation for rubygems-update-2.0.0
Done installing documentation for rubygems-update (0 sec).
1 gem installed
deploy@39:~$ update_rubygems
RubyGems 2.0.0 installed
Parsing documentation for rubygems-2.0.0
Installing ri documentation for rubygems-2.0.0



------------------------------------------------------------------------------

RubyGems installed the following executables:
    /home/deploy/.rvm/rubies/ruby-2.0.0-p0/bin/gem

Ruby Interactive (ri) documentation was installed. ri is kind of like man 
pages for ruby libraries. You may access it like this:
  ri Classname
  ri Classname.class_method
  ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

#41 楼 @fsword 我的问题前几天找到关键了,是因为 require 了‘net-ping',去掉以后就一切 ok 了,具体原因还没细看。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号