ruby1.9的配套环境
ruby1.9 已经发布了有一段时间了,昨天又刚好rails发布新版本2.3.2,号称支持ruby1.9。于是我的新项目SimPic就想整体用ruby1.9来搭建。可是今天在windows下面搭建环境,一个很重要的gem, mysql-2.7.3-x86-mswin32还是仍然只支持ruby1.8。目前还没有在mac或者linux上搭建1.9的环境,估计应该会比windows好一些。
seen from China
seen from China
seen from Netherlands

seen from Germany
seen from China

seen from United States

seen from Italy

seen from Germany
seen from Italy

seen from Czechia
seen from United States
seen from China

seen from Czechia
seen from T1
seen from Türkiye
seen from China
seen from China
seen from Argentina
seen from United States
seen from United States
ruby1.9的配套环境
ruby1.9 已经发布了有一段时间了,昨天又刚好rails发布新版本2.3.2,号称支持ruby1.9。于是我的新项目SimPic就想整体用ruby1.9来搭建。可是今天在windows下面搭建环境,一个很重要的gem, mysql-2.7.3-x86-mswin32还是仍然只支持ruby1.8。目前还没有在mac或者linux上搭建1.9的环境,估计应该会比windows好一些。
Humongous: A Ruby MongoDB Browser
Humongous: A Ruby way to browse and maintain MongoDB instances, using HTML5. ### Installation #### Command Line Utility Install the gem by running: gem install humongous --pre and run on terminal/console humongous And you are good to go it will open this in a browser or you can navigate it on port [9000](http://example.com/ "Title"). to stop it run: humongous -K here are options and values they take. -K or --kill #kill the running process and exit -S, —status #display the current running PID and URL then quit -s, —server SERVER #serve using SERVER (thin/mongrel/webrick) -o, —host HOST #listen on HOST (default: 0.0.0.0) -p, —port PORT #use PORT (default: 9000) -x, —no-proxy #ignore env proxy settings (e.g. http_proxy) -F, —foreground #don’t daemonize, run in the foreground -L, —no-launch #don’t launch the browser -d, —debug #raise the log level to :debug (default: :info) —app-dir APP_DIR #set the app dir where files are stored(“~/.humongous”) -h, —help #Show this message
QuickTips Ruby1.9 [Part 3] Default and Splat arguments
Ruby 1.9 has changed the way it used to deal with default arguments. The good news is it supports defaults arguments to be at beginning of methods. See gist below for example: You can continue to use default arguments at the end of method arguments as you were used to in 1.8.x, See example below But do note that you can not use both style of defining default arguments. Try it and you would get a syntax error raised. #### Splat arguments Ruby 1.9 also gives you free hand for defining splat argument anywhere in arguments list you can also define splat argument as last argument as you used to. Happy Coding :)
QuickTips Ruby1.9 [Part 2] Basic
Base Object is now BasicObject not Object in Ruby 1.9 #Ruby1.9 String.superclass #=> Object String.superclass.superclass #=> BasicObject String.superclass.superclass.superclass #=> nil and here is what it was in Ruby 1.8 #Ruby1.8 String.superclass #=> Object String.superclass.superclass #=> nil
QuickTips Ruby1.9 [Part 1] Hash
Changes in Hash
In Ruby19 hash becomes ordered, don’t believe it see it yourself. Keys will be in order they are inserted.
Again hash can be written in ruby like other languages(e.g. javascript)
ruby-debug in ruby 1.9.3
If you work with ruby 1.9 and want to debug your application usual 'require "ruby-debug"' just won't work. It'll keep throwing weird errors and you'll just spend a couple hours trying to figure out what's wrong.
To start using ruby-debug within your application or library you need to add these lines to your Gemfile:
gem 'linecache19',:git => 'git://github.com/mark-moseley/linecache' gem 'ruby-debug-base19x', '~> 0.11.30.pre10' gem 'ruby-debug19'
Then you could invoke your scripts like this (after running 'bundle install' of course):
bundle exec ruby script.rb
# or
bundle exec rspec script.rb
Install ruby-debug19 with new rvm architecture
Many months ago I started using in my projects ruby 1.9.3 and in the first day I get problem with ruby-debug19. It's described in @spastorino's team blog post ruby 1.9.3 and ruby-debug. All was ok when I tried it then, but now, when I loose my old macbook air because of indonesian rains (sad but true) and bought new one without any possibilities to get backup from old one, I have had again problem with installing ruby-debug19. I tried to use methods described in comments of Santiago's post, but it doesn't help. Now I can't find sources of ruby in rvm directories and after some time I asked @brainopia about this problem. He gave me this script:
#!/bin/sh rvm_current=`rvm current` echo "Installing ruby-debug with $rvm_current ..." curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem gem install linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem ruby-debug19 -- --with-ruby-include=$rvm_path/src/$rvm_current rm linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem echo "Done."
All installed without any problems! The problem was in new place for ruby sources in rvm directories, now they all stores in /Users/username/.rvm/src/ .
And before, in earlier versions of rvm, ruby sources were separately in their own directories: /Users/username/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0/