Windowsã§Rubyãå§ããæ¹æ³
å æ¥WindowsでRailsを使う方法についてæ¸ããããããã§ã¯Windowsã§Rubyã使ãæ¹æ³ã«ã¤ãã¦ãã詳ããç´¹ä»ããã
ã¾ããWindowsã§Rubyã使ãæ¹æ³ã¯ããã¤ãã®ç¨®é¡ããã£ã¦ãåå¿è ã¯ã©ããé¸ã¹ã°ããã®ãããããããªãã¨æããç§ã¯ãã¤ãåå¿è ã«ã¯ActiveScriptRubyãç´¹ä»ãã¦ãããã¤ã³ã¹ãã¼ã«ãã¢ã³ã¤ã³ã¹ãã¼ã«ãç°¡åãªä¸ã«ãWindowsã«å¯¾ãã¦ä½è¨ãªãã¨ãè¡ããªãã®ããããPATHç°å¢å¤æ°ãããåæã«ã»ããããªãã®ã§ãå¤ãªæ··ä¹±ãèµ·ããã«ãããã¾ããã¹ç°å¢ãè¨å®ããç¶æ ã§ã³ã³ã½ã¼ã«ãéãã¦ãããã·ã§ã¼ãã«ãããç¨æãã¦ãããã®ã§ãã¤ã³ã¹ãã¼ã«å¾ããã«åä½ç¢ºèªãã§ããã
ActiveScriptRubyã®å ¥æ
http://arton.hp.infoseek.co.jp/indexj.htmlã«ã¦é å¸ããã¦ãã¾ãã2008å¹´1ææç¹ã§ã®ææ°çã¯ActiveScriptRuby 1.8.6(111)ã§ããä¸è¨ãµã¤ãããActiveRuby.msiããã¦ã³ãã¼ããã¦ããã°OKã§ãã
ã¤ã³ã¹ãã¼ã«
ãã¦ã³ãã¼ãããActiveRuby.msiãããã«ã¯ãªãã¯ãã¦èµ·åãã¾ãã
ããã¨æ¬¡ã®ããã«ActiveScriptRubyã®ã¤ã³ã¹ãã¼ã©ã¼ãèµ·åãã¾ããã¡ãã»ã¼ã¸ã¯è±èªã§ããæé ã¯ç°¡åã§ããæé ã¨ãã¦ã¯ã¡ãã»ã¼ã¸ã«å¾ããNext >ããã¿ã³ã3åæ¼ãã ãã§ãã以ä¸ã«å ·ä½çãªæµããç´¹ä»ãã¾ãã
SSï¼ãã¨ã§å¼µãï¼
ãNext >ããã¯ãªãã¯ãã¦ãã ããã
次ã«ã¤ã³ã¹ãã¼ã«å ã®ãã£ã¬ã¯ããªãããç»é¢ã«ãªãã¾ãã
SSï¼ãã¨ã§å¼µãï¼
ãNext >ããã¯ãªãã¯ãã¦ãã ãããããã©ã«ãã§ã¯ãC:\Program Files\ruby-1.8\ãã«ã¤ã³ã¹ãã¼ã«ããã¾ãã
SSï¼ãã¨ã§å¼µãï¼
æå¾ã«ã¤ã³ã¹ãã¼ã«ãéå§ãããã©ããã®ç¢ºèªãããã¾ããããã§ããNext >ããã¯ãªãã¯ãã¦ãã ããã
ã¤ã³ã¹ãã¼ã«ãå§ã¾ãã¾ãã次ã®ãããªç»é¢ã«ãªã£ããç¡äºã«ã¤ã³ã¹ãã¼ã«å®äºã§ãã
SSï¼ãã¨ã§å¼µãï¼
ããã§ããCloseããã¯ãªãã¯ãã¦ã¦ã£ã³ãã¦ãéãã¦ãã ããã
ããã§ActiveScriptRubyã®ã¤ã³ã¹ãã¼ã«ã¯çµäºã§ãã
ã¢ã³ã¤ã³ã¹ãã¼ã«
ã¢ã³ã¤ã³ã¹ãã¼ã«ï¼ActiveScriptRubyããã½ã³ã³ããåé¤ããï¼ã®æé ã¯æ¬¡ã®éãã§ãã
ã³ã³ããã¼ã«ããã«ããActiveScriptRubyãåé¤ãã¾ããgemã³ãã³ãçã§å¾ãã追å ããã©ã¤ãã©ãªãã¡ã¤ã«ã¯èªåçã«ã¯åé¤ãããªãããã«ãªã£ã¦ããã®ã§ããã¹ã¦ã®ãã¡ã¤ã«ãå®å ¨ã«æ¶ãããå ´åã¯ActiveScriptRubyãã¤ã³ã¹ãã¼ã«ãããã£ã¬ã¯ããªï¼ããã©ã«ãã§ã¯C:\Program Files\ruby-1.8ï¼ãåé¤ãã¦ãã ããã
åä½ç¢ºèª
ãã¹ã¿ã¼ããâããã¹ã¦ã®ããã°ã©ã ãâãRuby 1.8ãâãruby consoleããã¯ãªãã¯ãã¦ãruby consoleããèµ·åãã¾ãããruby consoleããèµ·åããã¨ã次ã®ãããªã³ãã³ãããã³ãããéãã¾ãã
SSï¼ãã¨ã§å¼µãï¼
ã³ãã³ãããã³ããã«æ¬¡ã®ããã«å ¥åãã¦ãã ããã
ruby -v
å ¥åããããEnterãã¼ãæ¼ãã¦ãã ããããruby -vãã¨ããã®ã¯Rubyã®ãã¼ã¸ã§ã³ã表示ããã³ãã³ãã§ããActiveScriptRubyãã¤ã³ã¹ãã¼ã«ããã¦ããã°ã次ã®ããã«è¡¨ç¤ºããã¾ãã
SSï¼ãã¨ã§å¼µãï¼
次ã®æåãRubyã®ãã¼ã¸ã§ã³ã表ãã¦ãã¾ãã
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
ããã§åä½ç¢ºèªã¯çµäºã§ãã
ä½æ¥ãã©ã«ãã®æºå
Rubyãåããããã«ã¯Rubyã¹ã¯ãªãããæ¸ãããã½ã¼ã¹ãã¡ã¤ã«ãå¿ è¦ã§ããã¾ãã¯ã½ã¼ã¹ãã¡ã¤ã«ãç½®ãããã®ä½æ¥ãã©ã«ããæºåãã¾ãããã
Cãã©ã¤ãã«workã¨ããååã®ãã©ã«ããä½æãã¾ãï¼ããã§ã¯Cãã©ã¤ãã«workã¨ãããã©ã«ããä½æãã¾ããããã©ã«ãã®å ´æãååã¯éã£ã¦ããã¾ãã¾ããï¼ã
SSï¼ãã¨ã§å¼µã:ã¨ã¯ã¹ããã¼ã©ã§C:\workãéãã¦ããã¨ããï¼
次ã«ãruby consoleãã®ã·ã§ã¼ãã«ãããworkãã©ã«ãã«ã³ãã¼ãã¾ãã以ä¸ã®æé ã§ã·ã§ã¼ãã«ãããç¨æãã¦ããã¨ãç°¡åã«ä½æ¥ãã©ã«ãã«ããã½ã¼ã¹ãã¡ã¤ã«ãå®è¡ã§ããããã«ãªãã¾ãã
ãã¹ã¿ã¼ããâããã¹ã¦ã®ããã°ã©ã ãâãRuby 1.8ãã«ãããruby consoleããå³ã¯ãªãã¯ãã¦ãããã³ãã¼ããé¸æããworkãã©ã«ãã®ä¸ã«è²¼ãä»ãã¦ãã ããã
SSï¼ãã¨ã§å¼µã:ã¨ã¯ã¹ããã¼ã©ã§C:\workãéãã¦ããã¨ãããã³ãã¼æ¸ã¿ï¼
workãã£ã¬ã¯ããªã«ãã次ã«ã³ãã¼ãããruby consoleãã®ããããã£ãéãã¦ãã ããï¼å³ã¯ãªãã¯ãã¦ãããããã£(R)ããé¸æããï¼ã
SSï¼ãã¨ã§å¼µã:ruby consoleã®ããããã£ï¼
ãä½æ¥ãã©ã«ã(S)ãæ¬ã空æ¬ã«ãã¦ãOKããæ¼ãã¦ãã ããã
SSï¼ãã¨ã§å¼µã:ruby consoleã®ããããã£:空æ¬ã«ããã¨ããï¼
ããä¸åº¦ãruby consoleãã®ããããã£ãéãã¦ç¢ºèªãã¦ãã ãããä¸ã®åçã®ããã«ãä½æ¥ãã©ã«ã(S)ãæ¬ã空æ¬ã«ãªã£ã¦ããã°OKã§ãã
ä½æ¥ãã©ã«ãã«ã³ãã¼ãããruby consoleããèµ·åãã¦ã¿ã¾ãããã
SSï¼ãã¨ã§å¼µã:ã³ãã³ãããã³ãã:ï¼
æå¾ã«ãC:\work>ãã¨è¡¨ç¤ºããã¦ããã°OKã§ããããã§ä½æ¥ãã©ã«ãã®æºåãæ´ãã¾ããã
ã½ã¼ã¹ãã¡ã¤ã«ãä½æãã
次ã«ã¨ãã£ã¿ã使ã£ã¦ã次ã®ããã«æ¸ãããããã¹ããã¡ã¤ã«ãä½æãã¦ãã ããã
hello.rb
puts "Hello, World"
SSï¼ãã¨ã§å¼µã:ä¸è¨ã½ã¼ã¹ãæã¡è¾¼ãã ã¨ãã£ã¿ã®ç»é¢ï¼
ãã¡ã¤ã«ã®ååã¯hello.rbã¨ããä½æ¥ãã©ã«ãï¼C:\workï¼ã«ä¿åãã¦ãã ããã
SSï¼ãã¨ã§å¼µã:ã¨ã¯ã¹ããã¼ã©ã§C:\workãéãã¦ããã¨ãã:hello.rbãããï¼
ã½ã¼ã¹ãã¡ã¤ã«hello.rbãæºåã§ããããä½æ¥ãã©ã«ãã«ãããruby consoleããèµ·åãã¦ãã ãããã³ãã³ãããã³ãããèµ·åããã次ã®ããã«å ¥åãã¦Enterãã¼ãæ¼ãã¦ãã ããã
ruby hello.rb
ã½ã¼ã¹ãã¡ã¤ã«ãæ£ããæ¸ããã¦ããã°æ¬¡ã®ããã«è¡¨ç¤ºãããã¯ãã§ãã
SSï¼ãã¨ã§å¼µã:Hello, Worldï¼
ã³ãã³ãããã³ããã«è¡¨ç¤ºããããHello, Worldãã¯ãä»å®è¡ããRubyããã°ã©ã ãåºåãããã®ã§ãã