ラベル rails の投稿を表示しています。 すべての投稿を表示
ラベル rails の投稿を表示しています。 すべての投稿を表示

2008年11月18日火曜日

railsの実装速度をあげる方法でMac買えという話があるのだがそんな気がしない 件

Speeding Up Rails Development | Ruby on Rails というところでいろんな方法が紹介されているが,そのなかでMacかえという話.
Seriously, Just Buy a Fucking Mac

Just do it. Stop making excuses. I was a Windows user for about ten years but mainly because I didn’t know any better. I now work full time on a mac, both at home and at work, and there’s not a thing you could do to make me go back to Windows.

Windows simply won’t do a lot of things that you’ll want to do. Background jobs? Not a chance. Git? oh yeah, you can use msysgit but who the fuck wants to open up a separate program just to use git? Fuck off Windows. You’re slow and you suck.

Why get a mac? Rails runs faster. You can use the best text editor around, TextMate. You can install all those gems and plugins that all say: “This won’t work on Windows”.

Think getting a mac is too expensive? Get a low spec mac mini for $599. That’s what I started using and even though it’s low spec I never had a problem with it. You can use your USB keyboard, mouse and your monitor from your Windows machine. Still think it’s too much? Have a look on Amazon… Preowned Mac Mini for $350
  • まあわからなくはないのだが,railsで開発するような人でもLinuxやBSD使うのはむずかしいのか? それなら金もかからんうえに,もっと自然に使えると思うのだが..
  • TextMateもいいけど,日本語入力に難があるような..
まあなんにせよmacも安くなってきたのはいいのか.
rubypondのsemantic_form_builderはいいかんじそうなので使ってみよう.

2008年6月17日火曜日

rails2.0.2+ruby1.8.7でtestを通らなくなった.

donrailsがうごいてるdonrails.araki.netではruby1.8.5で動いているので問題ないのだが,ノートの上のsidではrubyが1.8.7にあがったようで,rails2.0.2+ruby1.8.7でtestを通らなくなった.

まずひとつ目はtruncate(/var/lib/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/text_helper.rb)を見てみる.

      def truncate(text, length = 30, truncate_string = "...")
if text.nil? then return end
l = length - truncate_string.chars.length
(text.chars.length > length ? text.chars[0...l] + truncate_string : text).to_s
end

どうやらtext.chars.lengthというのを中で使っていて,ruby1.8.7ではtext.chars.lengthがつかえない.これはので,text.chars.to_a.lengthとすれば回避できた.1.8.7で,Enumerable::Enumerator を返すようになったのが問題なのかな.

irb(main):001:0> "hoge".chars.length
NoMethodError: undefined method `length' for #<enumerable::enumerator:0xb7be8c70>
from (irb):1
irb(main):002:0> "hoge".chars.to_a.length
=> 4
irb(main):003:0> "hoge".length
=> 4

というかんじ.はて.etchではどうかとおもったが,

irb(main):001:0> "hoge".chars.length
NoMethodError: undefined method `chars' for "hoge":String
from (irb):1
irb(main):002:0> "hoge".chars.to_a.length
NoMethodError: undefined method `chars' for "hoge":String
from (irb):2
from :0
irb(main):003:0> "hoge".length
=> 4
irb(main):004:0> RUBY_VERSION
=> "1.8.5"

あれれ.しかしどっちにしろ"hoge".lengthですむのになんでString.charsなってんだろ.国際化対応のせいなのかなあ..よーわからん.世にはこんなパッチを出している人もいるようで. http://www.ruby-mine.de/assets/2007/12/31/ruby-19-on-rails-fixes.diff

手元ではrails2.1.0 + ruby1.8.7でやる時期がきたのかもしれない.

2006年3月28日火曜日

rails 1.1.0rc1-1 なんかこわれてる?

まあrailsをふつうにhttpdやらscript/serverでうごかしているなら問題はないわけだが。と、さいしょはおもっていた。

最初の問題builderだけをつかおうとおもって、そのためにdebianにgemsをいれるのもなんだなあとおもったのでこんなことにはまる。

 /usr/share/rails/actionpack/lib/action_view/vendor/builder

が、

 /usr/share/rails/activesupport/lib/active_support/vendor/builder

になっていて、ちょっとやられた。

  * Changed vendor/rails link to be relative, not absolute when first
created.

と、changelog.Debian.gzにあるのはこういう意味でしたか。

さて、次の問題は、railsコマンドが動かない というものです。

yaar@loon2:/tmp$ mkdir y
yaar@loon2:/tmp$ cd y
yaar@loon2:/tmp/y$ ls
yaar@loon2:/tmp/y$ rails rails
exists
create app/controllers
Permission denied - /app
ln: target `/tmp/y/rails/vendor/' is not a directory: No such file or directory
ln: creating symbolic link `/tmp/y/rails/vendor/rails' to `.': No such file or directory
ln: creating symbolic link `/tmp/y/rails/doc/api' to `/usr/share/doc/rails/html': No such file or directory
yaar@loon2:/tmp/y$ ls -lrt
total 0

なんでしょうねこれは。。

rails 1.0.0-1 ではこんなかんじでちゃんと動いていたわけですが。

cfard3:/tmp$ cd zz
cfard3:/tmp/zz$ ls
cfard3:/tmp/zz$ rails rails
create
create app/controllers
create app/helpers
create app/models
(中略)
create log/production.log
create log/development.log
create log/test.log

とりあえず追う時間はないので元にもどす。そのうち追記しよう。