Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
2011å¹´09æ02æ¥14:35 heroku Ruby Sinatra on Heroku ã§éçãã¡ã¤ã«ãæ±ã å®ã¯ãã®ããã°ã§ã¯ã·ã³ã¿ãã¯ã¹ãã¤ã©ã¤ãã使ã£ã¦ã³ã¼ãã«è²ã¥ããã¦ããã§ããããã®ããã« js 㨠css ã èªå® ãµã¼ãã§ãã¹ãã£ã³ã°ãã¦ã¾ãã ãã åã®å ´åãèªå® ãµã¼ãã ã¨ç¨¼åãããã®ãé£ããã¨ãããããé稼åæã«ã¯ js 㨠css ã®èªã¿è¾¼ã¿ãåºæ¥ãã·ã³ã¿ãã¯ã¹ãã¤ã©ã¤ããå¹ããªããã¨ãããã£ã¨èªã¿è¾¼ã¿ä¸ã«ãªã£ã¦ã¦ã¬ã¹ãã³ã¹ãé ããã¿ãããªåé¡ãããã¾ãããããã§ã¯ããããã¨ä¸ä¾¿ã§ããã ããã§ã解決çã¨ã㦠Sinatra ã使ã£ã¦ js 㨠css ãè¿ãç°¡åãªããã°ã©ã ãä½ã£ã¦ãããã Heroku ä¸ã§éç¨ãããã¨ã«ãã¦ã¿ã¾ãããä½ã¨è¨ã£ã¦ãã¿ãã§ããããï¼ï¼ã¡ãªã¿ã«åã㦠Sinatra ã使ã£ã¦ã¿ããããªãã§ãããæ¬å½ã«ç°¡åã§ããªã ã¾ãé©å½ãªãã¡ã¤ã«ãä½
ã¯ããã« Sinatraã¯Rubyã§è¨è¿°ãããWebã¢ããªã±ã¼ã·ã§ã³ãç´ æ©ããç°¡åã«ã¤ããããã®DSLï¼ãã¡ã¤ã³åºæè¨èªï¼ã§ãã ãã§ã«ç¬¬7åã§ãåæ ããã«ãããå°è¦æ¨¡Webã¢ããªã®ããã®ãã¬ã¼ã ã¯ã¼ã¯ãSinatraãã¨ããããã¡ã§ç´¹ä»ããã¦ãã¾ãã ç°¡æ½ãªææ³ã§ãé«ã表ç¾åãæã¤Sinatraã¯ãã¢ã¡ãªã«ã®Rubyã³ãã¥ããã£ãä¼æ¥ãä¸å¿ã«ãç¬ãéã«ã¦ã¼ã¶ãå¢ããã¾ãããã¾ããRubyã¨ããä¸è¨èªã«çã¾ãã[1]â ãSinatraã模ãããã¬ã¼ã ã¯ã¼ã¯ãå¤ãä½ããã¦ããç¾ç¶ããããSinatraã¯Webã¢ããªã±ã¼ã·ã§ã³éçºãã®ãã®ã«ã大ããªå½±é¿ãä¸ããã¨è¨ãã¾ãã æè¿ã§ã¯ããæ¥æ¬ã§ããå人å©ç¨ãä¸å¿ã«ããããããã§Sinatraã使ã£ã¦éçºããã¦ãããã¨ãã話ãèãããã«ãªãã¾ãããçè èªèº«ã1ã¦ã¼ã¶ã¨ãã¦ç¾å¨æ¥åã§å©ç¨ãã¦ããã1å¹´åã¯ç¥ã人ãç¥ãåå¨ã ã£ãSinatraã¯ãå®éã«
ãSinatraã§shotgunã®ä»£ããã«Rack::Reloaderã使ãæ¹æ³ - Hello, world! - s21gãããããä¿®æ£ãã¦ã¿ããã ä¸è¨ã®æ¹æ³ã§ã¯ãroutes ãæ¸ãã¦ãããã¡ã¤ã«ä»¥å¤ãå¤æ´ããå ´åã«ãå¼·å¶çã« ::Sinatra::Application.reset! ãå¼ã°ãã¦ãã¾ããããä¿®æ£å¤æ´ãããã¡ã¤ã«ã«ãã£ã¦ã¯ã«ã¼ããå ¨é¨ç¡ããªã£ã¦ãã¾ãã ãããªæãã ãããä¿®æ£ããã«ã¯ routes ãæ¸ããã¦ãããã¡ã¤ã«ãä¿®æ£ãããå ´åã ãã ::Sinatra::Application.reset! ãå¼ã³åºãã¦ããã°è¯ãã ã¨ãã訳ã§ãconfigure :development 以ä¸ã config.ru ããã§ã¯ãªãã ã¢ããªã±ã¼ã·ã§ã³ãè¨è¿°ããã¦ãããã¡ã¤ã«ã«ç§»åããã ãããªæãã # application.rb require 'rubygems'
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}