アットウィキロゴ

RubyForWindows

「RubyForWindows」の編集履歴(バックアップ)一覧に戻る

RubyForWindows - (2009/05/20 (水) 14:11:08) のソース

#contents

*Ruby for Windows
**link
-逆引きRuby http://www.namaraii.com/rubytips/
-リファレンスマニュアル http://www.ruby-lang.org/ja/man/
-リファレンスマニュアル刷新計画 http://doc.loveruby.net
-Ruby-Doc.org http://www.ruby-doc.org/
-RubyForge http://rubyforge.org
-Ruby Application Archive http://raa.ruby-lang.org

**Idioms
[[Ruby]]イディオム

1.ファイルを読み込んで処理をする。

(1) 各行の処理 Yugui(2008.6)「初めてのRuby」 オライリー・ジャパン  p.89
File.open("data.txt"){|f|
f.each_line do |line|
print "#{f.lineno}: #{line}"
end
}

(2)各行の処理 高橋他(2006) 「たのしいRuby第2版」ソフトバンク クリエティブ p.285,289
open("foo.txt"){|io|
while line=io.gets
line.chomp!     # 行末の改行を取り除く。
...
end
}

(3)ファイル内容を一度に取りこむ Yugui(2008) p.86
File.open("data.txt"){|f|
contens=f.read 
print contents
}

(4)ファイル内容を一度に取りこみ、各行を要素とする配列を返す。
 f.readlines

2.ファイル名を引数として取りこむ
(1)第1引数で 高橋他(2006.8) p.50
filename = ARGV[0]
file = open(filename)
.....
file.close

(2)複数ファイルを指定し、ファイル内容をとりこむ Yugui(2008) p.92
ARGF.each_line do |line|
print line
end
(引数がなければ、標準入力から読み込む)

3.標準入力からの取り込み 
http://itpro.nikkeibp.co.jp/article/lecture/20061102/252549/?ST=lecture&P=2

print "あなたのお名前はなんですか:"
name = STDIN.gets
puts "お名前は#{name.chomp}さんですね。"

**install
-OneClickInstaller 1.8.6をinstall(2008.9.13) c:\ruby
-RubyGems1.2.0をinstall (extactし、ruby setup.rb)
--gem update --systemでうまくいかなかったため。
-RubyGemsの使い方 http://webos-goodies.jp/archives/51106257.html
-Install後の更新履歴
        Ruby Installer for Windows
       Ruby Version 1.8.6
       Installer Version 186-26
     ------------------------------
          RELEASE NOTES
     ------------------------------
     Contents:           Version:
     --------            --------
      ruby-mswin32        ruby-1.8.6-p111
      zlib-lib            1.2.3
      ZLib                0.6.0
      RubyGems            0.9.4  => 1.2.0
      Rake                0.7.3
      RubySrc             1.8.6-p111
      OpenSSL             0.9.8d
      FXRuby              1.6.12
      FXri                0.3.6
      SciTE               1.72
      OpenGL              0.50.0
      GLUT                3.7.6
      SWin                070409
      VRuby               061102
      Expat               2.0.0
      Hpricot             0.6
      RubyDBI             0.1.1
      DBD/ODBC            0.9995
      win32-api           1.0.4
      windows-api         0.2.0
      windows-pr          0.7.2
      win32-file-stat     1.2.7
      win32-file          0.5.4
      win32-clipboard     0.4.3
      win32-dir           0.3.2
      win32-eventlog      0.4.6
      win32-process       0.5.3
      win32-sapi          0.1.4
      win32-sound         0.4.1
      log4r               1.0.5
      Programming Ruby    1st Edition
      libfcgi             2.4.0
      ruby-fcgi           0.8.7
      Iconv               1.8
      readline            4.3-2
      PDCurses            2.60-1
      GDBM                1.8.3-1
      Installer-Patches   1.8.6

----
-miswin32版をinstall c:\usr\local(2008.9?)
-RDtoolをinstall (2008.9.12)
--RDtoolをget http://raa.ruby-lang.org/project/rdtool/
--extract後、ruby setup.rbを実行
--rd2.batを作成
 @echo off
 c:\usr\local\ruby-1.8\bin\ruby.exe  c:\usr\local
    \ruby-1.8\bin\rd2 %1 %2 %3 %4 %5 %6 %7 %8 %9
-RTToolをget & install http://www.rubyist.net/~rubikitch/computer/rttool/#label:10
--rt2.bat,rdrt2.bat
 @echo off
 c:\usr\local\ruby-1.8\bin\ruby.exe c:\usr\local\ruby-1.8
    \bin\rt2 %1 %2 %3 %4 %5 %6 %7 %8 %9
 forkが実装されていないといって、エラーとなる。

**rake
-http://kyobashi.org/hf/RakeTutorial/?IntroducingRake

*解説等
-[[プログラミング言語の講義資料>>http://www.sakurai.comp.ae.keio.ac.jp/classes/2008prog-class.html]]

#news(Ruby)

#bf(Ruby)
Copyright T.Osawa 2008-
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。