察象èªè
- åå¿è åããHTMLãå°ãåããããšã
- ã¯ã©ãŠã(Paas)ã«èå³ãããã
- WEBã¢ããªã±ãŒã·ã§ã³ãç°¡åã«äœæãããã
- Ruby on Rails ã®ã¢ããªã±ãŒã·ã§ã³ãäœã£ãŠã¿ããã
- å°ãPHP,classicASPãªã©ã®ããã°ã©ã çµéšããããåå¿è ã
æ¬èšäºã®æŠèŠ
æ¬èšäºã§çŽ¹ä»ããã®ã¯WEBãã©ãŠã¶ã®ã¿ãå©çšããŠRuby on Railsã®ã¢ããªã±ãŒã·ã§ã³éçºïŒè¶
ç°¡åãªããã°ïŒããæ¬çªç°å¢ã®ç§»è¡ãŸã§ãè¡ããã®ã§ãã
GitHubã¢ã«ãŠããäœããšãããããã¹ããã§ç¢ºèªãããŸã§ãç»åä»ãã§çŽ°ãæé ãèšèŒããŠãŸããå€å°ç¥èã®ããæ¹ã«ã¯éå±ãªå
容ããç¥ããŸããã
çè ç°å¢
- ãã©ãŠã¶ãGoogle Chrome ããŒãžã§ã³ 47.0.2526.106 (64-bit)
- Mac OSX El Capitan
- MacBook Pro (13-inch, Early 2011)
- ããã»ããµ 2.3 GHz Intel Core i5
- ã¡ã¢ãª 4 GB 1333 MHz DDR3
â»WEBãã©ãŠã¶ã®ã¿ãå©çšããŸããSafaliãIEã§ãåé¡ãªããšèããŠãŸãããæ€èšŒããŠãããŸãããOSã¯ããŸãé¢ä¿ãªããšèããŠãŸãã
ãæšæ¶
ããã«ã¡ã
æ®æ®µã¯JavaEEãASP.netãªã©ãäžå¿ã«ãªã³ãã¬ãã¹ç°å¢ã§ã®äŒæ¥åãã®æ¥åã¢ããªã±ãŒã·ã§ã³éçºãè¡ã£ãŠããè
ã§ããæ¥åã§RedmineãGitãå©çšãå§ããäºããã£ããã«Ruby on RailsãGitHubã«èå³ãæã¡ãŸããã
åããŠã¯ã©ãŠãç°å¢ã§èªåã®äœãã¢ããªã±ãŒã·ã§ã³ãåãããŸã§ã«æççã«ãããããªæ
å ±ã調ã¹ãŠèŠåŽããŸããã
ç§ãå©çšããŠããç°å¢æ§ç¯ã®æé ãð°åããŠã®æ¹åãã«æ²èŒããŸããã¡ãã£ãšé·ãã§ããé çªã«ãã£ãŠããã ããã°èªåã§äœã£ãã¢ããªã±ãŒã·ã§ã³ãã¹ãããªã©ã§äœ¿ããããã«ãªãã¯ãã§ãã
ããã§çŽ¹ä»ããã®ã¯WEBãã©ãŠã¶ã®ã¿ãå©çšããŠRuby on Railsã®ã¢ããªã±ãŒã·ã§ã³éçºïŒè¶ ç°¡åãªããã°ïŒããæ¬çªç°å¢ã®ç§»è¡ãŸã§ãè¡ããã®ã§ãã
Cloud9ãšããã¯ã©ãŠãäžã®IDEïŒçµ±åéçºç°å¢ïŒããç°¡åãªRuby on Railsã®ã¢ããªã±ãŒã·ã§ã³ãäœæãGitHubïŒã¯ã©ãŠãäžã®GitãªããžããªïŒã®èªåã®ãªããžããªã«PUSHïŒã¢ããããŒãïŒããŠHerokuïŒã¯ã©ãŠãäžã®ã¢ããªã±ãŒã·ã§ã³å®è¡ç°å¢ãDBããïŒã«Ruby on Railsã®ã¢ããªã±ãŒã·ã§ã³é 眮ãããŸã§ã玹ä»ããŸãã
ãŸã äžæ £ããªããšãå€ã誀ã£ãŠãããšãããããããç¥ããŸãããåå¿è ã§ãæž©ããç®ã§èŠãŠãããŠãã ããã
å®æå³
ãã¡ããã¡ãããŠãã¿ãŸãã 倧äºãªãšããã¯ãèå
ãã³ã®ã¯ã©ãŠãéšåãšãèµ€ãã³ã®Gitéšåã§ããããããã€ã¡ãŒãžã§ããééã£ãŠããããããŸããã
1.GitHubã®ã¢ã«ãŠã³ããäœæããã
äžèšãµã€ãã«ã¢ã¯ã»ã¹ããŠãååïŒHideakiSaitoãªã©ïŒãã¡ãŒã«ã¢ãã¬ã¹ããã¹ã¯ãŒãå
¥ããŠ[Sign up for GitHub]ãã¯ãªãã¯ã
https://github.com/
ãµã€ã³ã¢ãããã§ãããäžèšã®ç»é¢ã«é·ç§»ããã®ã§ãå³ç«¯ã®ã¢ã€ã³ã³ãããããã£ãŒã«ãžç§»åã
èªåã®ãªããžããª(ããã°ã©ã ã®å€æŽå±¥æŽã®ããŒã¿ããŒã¹ã®æ§ãªæã)ã衚瀺ãããŸããæåã¯ç©ºã£ãœã§ãããªããžããªãäœæããŠãããšäžèšã®ããã«è¡šç€ºãããŸãã
2.Cloud9ãžGitHubã¢ã«ãŠã³ãã§ãã°ã€ã³ããã
äžèšãµã€ããžè¡ã£ãŠ GitHubã¢ã«ãŠã³ãã§å
¥ããŸãããGitHubã®ããŒã¯ ãã¯ãªãã¯ããŠãã ããã
https://c9.io/
GitHubã¢ã«ãŠã³ãã§å
¥ãããšãã§ããŸããæåã¯ç©ºã£ãœã ãšæããŸãããããã[+]ã§æ°èŠã®ã¯ãŒã¯ã¹ããŒã¹ãäœã£ãŠãããŸãããã®åã«ã
å·Šã®ãµã€ãããŒã§ãRepositoriesããã¯ãªãã¯ãããšGitHubã®ãªããžããªäžèŠ§ãåºãŠããŠã¯ããŒã³ãè¡ãïŒããã°ã©ã ã«å¿
èŠãªãã¡ã€ã«ããã©ã«ããšãå€æŽå±¥æŽã®ããŒã¿ãŒããŒã¹ãããŒã«ã«ç°å¢ã«äœã£ãŠãããïŒããšãã§ããŸããCloud9ãå©çšãããšMacãWinodwsã®ããŒã«ã«ç°å¢ã§éçºããŠããªããžããªãGitHubã«ããã°ãã©ãã§ãããã€ã§ãéçºã§ããŸããïŒPCãšãããç°å¢ãå¿
èŠã§ããipadãiPhoneã§ãç¡çããã°ã§ããªããªãã§ãããæ®å¿µãïŒ
3.Cloud9ã§æ°ããã¯ãŒã¯ã¹ããŒã¹ãäœãã
ã¯ãŒã¯ã¹ããŒã¹ã«æ»ãã[+]ã®ãã¿ããã¯ãªãã¯ããŸãã
ã¯ãŒã¯ã¹ããŒã¹åïŒã¢ããªåãè¯ãããšèããŠãŸãããšããããhelloworldãšããŠãŸãã
次ã«éçºãããã³ãã¬ãŒããéžæããŸãã
Ruby on Railsãããããã®ã§äžã®æ®µã®å·ŠããïŒçªç®ãéžæããŸããç®ç§»ãããããªããŸããããšãããããRAILSããã¯ãªãã¯ããŠãã ããã
å°ãåŸ
ã€ãšãRuby on Railsã®ãããžã§ã¯ãïŒãã©ã«ãããã¡ã€ã«ïŒãäœæããIDE(çµ±åéçºç°å¢ïŒã®ç»é¢ã衚瀺ãããŸãããããŸã§ã®ç°å¢æ§ç¯ãMacã®ããŒã«ã«ç°å¢ã§è¡ãã®ã¯åå¿è
ã®ç§ã«ã¯å€§å€ã§ãããGitHubã®ã¢ã«ãŠã³ãäœã£ãŠãCloud9ã§ãã³ãã¬ãŒãäœããŸã§ã¯ãã£ãšããéã ãšæããŸãã
4.Cloud9ã§Ruby on Railsã®ã¢ããªã±ãŒã·ã§ã³ãäœæãåããã
ãšãããããRuby on Railsã®ã¢ããªã±ãŒã·ã§ã³ããåãããŠã¿ãã
ã¡ãã¥ãŒããŒã®ãRun Projectããã¯ãªãã¯ããŸãã
ãRuby on RailsããŠã£ã³ããŠãæ°ããéããå°ãåŸ
ã€ãšäžã®ãããªã¡ãã»ãŒãžãåºåãããŠãããã¢ããã衚瀺ãããŸãããããã¢ããã®ãã€ããŒãªã³ã¯ïŒäžèšäŸã ãš https://hellowolrd-hideakisaito.c9users.io/ )ãã¯ãªãã¯ããŸãã
äžã®ç»é¢ãåºãã°ãšãããããRuby on Railsãåããããšã«ãªããŸãããRuby on Railsãã«äœãã³ãŒãã£ã³ã°ïŒããã°ã©ãã³ã°ããœãŒã¹ã³ãŒããæžããã¡ã€ã«ãç·šéããããšïŒããŠããªããšè¡šç€ºãããç»é¢ã§ããiphoneãªã©ã§ã確èªããããšãå¯èœã§ãã
scaffold ã³ãã³ãã§ãªãã¡ãã£ãŠæ¥èšã¢ããªã®é圢äœãã
æ¥èšã¢ããªã±ãŒã·ã§ã³ãäœããšããŠãäžèšã®ä»æ§ãèããŸãã
- ãŠãŒã¶ïŒäººã«ã察ããŠãè€æ°ãºãŒãžãæãŠãããšã
- ãŠãŒã¶æ å ±ã¯ãååïŒæååïŒãæ§å¥ïŒæ°åïŒãèªçæ¥ïŒæ¥ä»ïŒãæã€ã
- ãºãŒãžæ å ±ã¯ãã¿ã€ãã«ïŒæååïŒãæ¬æ(æåå)ãç»æ ¡æ¥ïŒæ¥ä»ïŒæéïŒãå ¬éèšå®ïŒçåœå€ãŒYes or NoïŒãæã€ã
- ãºãŒãžæ å ±ã¯ãã©ã®ãŠãŒã¶ã®ãºãŒãžããããããã«ããïŒãŠãŒã¶ããèŠãã1:å€ã®é¢ä¿ïŒ
ãŸãã¯äžèšã³ãã³ãããbash-"ããªãã®åå"ããŠã£ã³ããŠïŒä»¥äžã¿ãŒããã«ïŒã«æã¡èŸŒãã§å®è¡ããŠã¿ãŠãã ããããâ»MVCãRailsã®èª¬æã¯å²æããŸãç³ãèš³ãããŸããã
rails g scaffold user name:string gender:integer birthday:date
rails g scaffold article title:string body:text post_date:datetime is_public:boolean user:belongs_to
ã ã ã ãšãã¡ã€ã«ãäœæãããŸãããŠãŒã¶æ
å ±ãDBãžäœæããããã®ãã¡ã€ã«ãããŠãŒã¶æ
å ±ãæ±ãMVCã®ããããã®ãã¡ã€ã«ãå·Šã®ãã¡ã€ã«ããªãŒã«è¡šç€ºãããã¿ãŒããã«ã«ãã°ã衚瀺ãããŸãããŠãŒã¶æ
å ±ãæ±ãåºæ¬çãªãã¡ã€ã«ãå
šãŠäœãããŸããã
ãŸããã¡ã€ã«ãã ã ã ãšäœæãããŠåãããã«ãºãŒãžæ
å ±ãæ±ãarticleã®ãã¡ã€ã«ãäœãããŸãããâ»äžèšã®ã¹ã¯ãªãŒã³ã·ã§ããã¯èª€åããããŸããäžèšã®ã³ãã³ããæã£ãŠãããã°å€§äžå€«ã§ãã
äžèšã®ããã«scaffoldã§äœæãããæ
å ±ã¯ãã®ã¢ãã«ïŒæ
å ±ïŒïŒã®è€æ°ç³»ã®æååãã«ãŒã/modelè€æ°ç³»ãã§åç
§ããã«ãŒã«ïŒæ±ºãŸããã¬ãŒã«ã®ç±æ¥ïŒïŒãšãªã£ãŠãŸãã
https://hellowolrd-hideakisaito.c9users.io/users
æ©éã¿ãŠã¿ããšèµ€ãç»é¢ã§ãšã©ãŒã衚瀺ãããŸããããã¯DBäœææ
å ±ãå®è¡ããŠãªãããDBããªãããã bin/rake db:migrate RAILS_ENV=development
ãããŠãã ããããšæžããŠãããŸããããæã£ãŠãŸãã
äžèšã³ãã³ããå®è¡ããŸããã¿ãŒããã«ã«æã¡èŸŒãã§ãã ããããããã端æã£ãŠãŸãã倧äžå€«ã§ããããŒã¿ããŒã¹åã³ããŒãã«éã®é¢é£ãäœæãããŸãã
ãããããšå
ã»ã©ã®URLããäžèŠ§ã詳现ãç»é²ãæŽæ°ãåé€ãå©çšã§ããããã«ãªããŸãã
https://hellowolrd-hideakisaito.c9users.io/users
è¿œå ããŠã¿ãã
id ã¯èªåçã«é£çªãä»ãããã
èšäºã®æ¹ãæžããŠã¿ãŸããäžèšURLãžè¡ã£ãŠæ°èŠäœæãuserã«ã¯ãã®ãŠãŒã¶æ
å ±ã®idãå
¥ããŠãã ãããåããŒãã«éã®é¢é£ã¯idã§è¡ãã®ãã«ãŒã«ã§ãã
https://hellowolrd-hideakisaito.c9users.io/articles
ãã®èšäºã®ãŠãŒã¶æ
å ±ã®ã¢ãã«ã®åç
§ã衚瀺ãããŠããŸããããã ãšã€ãã€ããªã®ã§
ããã§ã¡ããã£ãšäœæãããã¡ã€ã«ãä¿®æ£ããŠã¿ãŸãã
app/views/articles/index.html.erb ã®ãïŒïŒè¡ç®ã
24: <td><%= article.user %></td>
â
24: <td><%= article.user.name %>
birthday Is <%= article.user.birthday %></td>
ãããããšããã®èšäºã®ãŠãŒã¶æ å ±ããååãšèªçæ¥ãååŸããŠè¡šç€ºããŸããïŒïŒ ïŒèšäº.ãŠãŒã¶.ååïŒ ïŒã§H.Saitoã衚瀺ãããã£ãŠããšã§ãããORãããã³ã°ã®ãããšããã§ããä»ã«ãRubyã¯ããèšã£ãçŽæçã§elegantãªèšè¿°ãã§ããããã°ã©ã èšèªãšããŠæåãããã§ããä»ã®èšèªãšèŒã¹ãŠã¯ã»ããããŸãã
以äžã§ãã
Ruby on Rails ã«ã€ããŠã¯ããããçŽ æŽããããµã€ããããã®ã§å¥é調ã¹ãŠã¿ãŠãã ããã
ãããŸã§ã«GitHubã®ã¢ã«ãŠã³ãäœã£ãŠãããæ°åã¯ãªãã¯ããŠãïŒåã³ãã³ãå©ããŠããœãŒã¹ãïŒè¡çŽããã ãã§ã§ããŸããã
ç§ã¯ã¿ã€ããã¹ããŠäœåºŠãããçŽããŠãŸããã©ããèŠããã®ã§ã³ãã³ãã¯å©ãããšããå§ãããŸãã
5.Cloud9ã§Gitã®ãªããžããªãäœãã
ã¿ãŒããã«ã§æ¬¡ã®ã³ãã³ããå
¥åã git init
ã¿ãŒããã«ã§æ¬¡ã®ã³ãã³ããå
¥åã git add .
git commit -m "first commit"
ãšãããããgitã®ãªããžããªã¯ã§ããŸããã
以äžã§ãã
Git ã«ã€ããŠã¯ããããçŽ æŽããããµã€ããããã®ã§å¥é調ã¹ãŠã¿ãŠãã ããã
6.GitHubã§ãªã¢ãŒããªããžããªãäœãã
æé 1.ã§ç¢ºèªããGithubã®Your profileãéããŸããäŸãã°äžèšã§ãã
https://github.com/HideakiSaito/
å³ã®ã¢ã€ã³ã³ã®é£ã«ãããïŒããã¿ã³ãæŒããŠ[New repository]ãã¯ãªãã¯ããŸãã
ãªããžããªã®äœæç»é¢ãéãã®ã§ããªããžããªåãé©åœã«ãäŸã§ã¯hellowoldã
説ææ¬ãé©åœã«ãäŸã§ã¯åããŠã®ã»ã»ã»ãPublicã«ãããšå
šãŠã®äººã«å
¬éãããŸãã
Privateã¯ç¢ºãææã§ãããå¿
èŠäºé
ãå
¥åãçµãã£ãããCreate repositoryããã¿ã³ãã¯ãªãã¯ããŸãã
ïŒç©ºã®ïŒãªããžããªãäœæãããã¯ã€ãã¯ã»ããã¢ããç»é¢ã衚瀺ãããŸãã
ãã®æç¹ã§GitHubã«ãªããžããªãã§ããŸããã
7.GitHubãžCloud9ããããã·ã¥ããã
äžèšã®ïŒæ®µç®ãäžå³ã®ïŒè¡ã®ã³ãã³ããã³ããŒããŸãããèªèº«ã®ãªããžããªãã¹ãã³ããŒããŠãã ãããäžèšãåè
git remote add origin https://github.com/HideakiSaito/hellowolrd.git
git push -u origin master
Cloud9ã®ã¿ãŒããã«ã«åŒµãä»ããŸããééããšé¢åãªã®ã§åŒµãä»ããŠãã ããã
ãŠãŒã¶åãšãã¹ã¯ãŒããèãããã®ã§çããŠãã ãããããŸããããšããã·ã¥ãæåããŠGitHubã®ãªã¢ãŒããªããžããªã«ãœãŒã¹ãéä¿¡ãããŸãã
GitHubã§å
ã»ã©äœã£ããªããžããªãã¿ãŠãã ãããäŸãã°
https://github.com/HideakiSaito/hellowolrd
Cloud9ã§äœæãããœãŒã¹ãšåããã®ãGitHubäžã«ãé
眮ãããŸããã
8.Herokuã®ã¢ã«ãŠã³ããäœæããã
äžèšãµã€ããž
https://www.heroku.com/
äžå€®äžã®[SIGN UP FOR FREE]ãã¿ã³ãã¯ãªãã¯ã
å¿
èŠäºé
ãå
¥ããŠ[Create Free Account]ãã¿ã³ãã¯ãªãã¯ããŸãã
è¥å¹²æé ãéããããããŸããããèªåã®ããã·ã¥ããŒããéããŸããæåã¯ç©ºã§ãããããã¢ããªã®æ¬çªç°å¢ãšããŠå©çšããå Žæã§ããïŒåãŸã§ç¡æã§ã¢ããªãäœããŸããããããå¶éãããŸããã趣å³ã®ç¯å²ã§ããã°ã©ã ããåã«ã¯ååã§ãã
å·Šã®ãµã€ãããŒã«ããåè§ãïŒå䞊ãã ãã¿ã³ãæŒããŠãDocs]ãªã©ã§ç¢ºèªã§ããŸãããHerokuã§ã¯äžèšèšèªããã«ãããããã€ãã§ããŸããCloud9åŽã§ããµããŒãããŠãããã®ã ãšRuby on Rails以å€ã«ããPHPãPython,Node.jsãªã©ããããŸãã
9.Herokuã§æ°ããã¢ããªã±ãŒã·ã§ã³ãäœæããã
ããã·ã¥ããŒãã®å³äžãïŒããã¿ã³ãã¯ãªãã¯ããŸãã
ååã決ããŸãããHerokuäžã§ã«ãããªãååã§ããå¿
èŠãããã®ã§é©å®èããŠãã ããããã ãããªããã°ã¢ã«ãŠã³ãïŒé£çªãšãã[Create App]ãã¯ãªãã¯ããŸãã
10.Herokuã®èšå®ããããGithubã«æ¥ç¶ããªããžããªãåç §ããã
ã¢ããªãäœæããããšäžèšã®ããããã€ã管çç»é¢ã衚瀺ãããŸããçãäžã®ãGitHub]ãã¯ãªãã¯ããŸãã
æ¥ç¶ããããšïŒæ®µç®ã«GitHubã®ãªããžããªæ€çŽ¢ç»é¢ãåºãã®ã§ãšãããããSearchããã¿ã³ãã¯ãªãã¯ããŸããå
ã»ã©äœã£ããªããžããªãéžãã§ãConnectããã¿ã³ãã¯ãªãã¯ããŸãã
æ¥ç¶ããããšãããªæãã§ãã
èªåãããã€èšå®ãæå¹åããŸãã[Enable Automatic Deploys]ãã¿ã³ãã¯ãªãã¯ããŸããäžå³ã¯æŒããåŸã§ãã
æ¥ç¶èšå®ã¯ä»¥äžã§ãã
11.Herokuäžã§ãããã€ããã
ãããã€ç»é¢ã®äžçªäžã«ãDeploy Branchããã¿ã³ãããã®ã§ã¯ãªãã¯ããŸãã
å°ãåŸ
ã€ãšãšã©ãŒç»é¢ãåºãŠå€±æããŸããHerokuã§çšŒåã§ããããã«èšå®ããä¿®æ£ãå¿
èŠã§ããããã§ã¯Sqlite3ããµããŒãã§ããªããšèšã£ãŠãŸããPostgresql ã«å©çšããDBãå€æŽããŸãã
12.Cloud9ããHerokuã§çšŒåãããããã®æºåãããã
Cloud9ã§äžèšè¡ããŸããè¥å¹²ããããããªããŸããé 匵ã£ãŠãã ããã
ãã¡ã€ã« /Gemfile ãéããŸããïŒè¡ç®ãã³ã¡ã³ãã¢ãŠãã«ããŸããã#ããRubyã§ã¯ã³ã¡ã³ãã¢ãŠãã§ãã
#gem 'sqlite3'
ãã¡ã€ã« /Gemfile ã®ïŒè¡ç®ãããã«äžèšã³ããããŸããpgãPostgreSQLãå©çšããgem(å®ç³ãRubyã®ã©ã€ãã©ãª)ã«ãªããŸãã
### H.saito Add >>>>>>>>>>>>>>>>>>>>>>>>>>>>
gem 'pg'
gem 'rails_12factor', group: :production
gem 'puma'
### H.saito Add <<<<<<<<<<<<<<<<<<<<<<<<<<<<
ã¿ãŒããã«ã§äžèšã³ãã³ããæã¡ãŸãã
bundle install
ãããªæãã§ã
ããŸããããšãããªã§ãã
ã¿ãŒããã«ã§äžèšã³ãã³ããæã¡ãŸãã
sudo su - postgres
createuser ubuntu -dslP
ãã¹ã¯ãŒããïŒåèãããã®ã§ããšããããäžèšå
¥åããŸããã¡ãããšãããã¹ã¯ãŒããå
¥ããŠãã ããã
password
ã¿ãŒããã«ã§äžèšã³ãã³ããæã¡ãŸãã
exit
ãããªæãã§ããããã倱æãããšåä»ã§ãã
ãã¡ã€ã« /config/database.yml ãéããŠå šéšæ¶ããŸããsqlite3ãå©çšãããã®å®çŸ©ã«æã£ãŠãã®ã§ãäžèšã³ããããŠãã ããã
default: &default
adapter: postgresql
encoding: SQL_ASCII
pool: 5
username: ubuntu
password: password
development:
<<: *default
database: hellowolrd_development
test:
<<: *default
database: hellowolrd_test
production:
<<: *default
encoding: unicode
database: hellowolrd
æåã¯ãããªã£ãŠãŸãããå
šéšæ¶ããŸãã
ãããªããŸãããã¹ã¯ãŒãã¯é©å®ã
ã¿ãŒããã«ã§äžèšã³ãã³ããæã¡ãŸãã
rake db:create
rake db:migrate
PostgreSQLã«ããŒã¿ããŒã¹ãäœããããŒãã«ãªã©ãæ§ç¯ããŸããããŸããããšäžå³ã®ãããªæãã§ãã
Run Project ãã¿ã³ãã¯ãªãã¯ããŠã¢ããªã±ãŒã·ã§ã³ã®ç¢ºèªããŸãã
https://hellowolrd-hideakisaito.c9users.io/
ããŒã¿ããŒã¹ãåãæ¿ããã®ã§ã以åäœã£ãããŒã¿ã¯ãããŸããã
ã¿ãŒããã«ã§æ¬¡ã®ã³ãã³ããå
¥åã git add .
git commit -m "change db postgresql"
git push -u origin master
ãããªæãã§ãã
GitHubã®ãŠãŒã¶åããã¹ã¯ãŒããèãããã®ã§å
¥åããŠããã·ã¥ãæåãããšãããªæãã
GitHubãèŠãŠã¿ãŸããã³ãããã®å±¥æŽãåç
§ããŸãã
å
ã»ã©ã®ããŒã¿å€æŽã®è©³çŽ°ã確èªããŸãã
ã³ãããæã® -m "ã³ã¡ã³ã"
ã§ã¯ãœãŒã¹ã®å€æŽå
容ããããããã«ããŸãã
ãchange db postgresqlããã¯ãªãã¯ãããšäžèšã®ããã«ååã®ã³ããããšã®å€æŽå·®åã衚瀺ãããŸãã
HerokuãèŠãŠã¿ãŸããèªåãããã€ãåããŠããã°å°ãåŸ
ã¡ãŸããBuild Succededã®ã¡ãã»ãŒãžã®ä»ã«ããããåºãŠãŸããæ£åžžçµäºããã¯ãã§ãããç²ããŸã§ããïŒ
HerokuåŽã§ãPostgrSQLã®åæèšå®ãå¿
èŠãªã®ã§ãããããäžæ¯ã§ãã
13.Cloud9ããHerokuã³ãã³ãã䜿ãRailsã®åæèšå®çãè¡ãã
**ããã¯èªåã®Herokuã®ã¢ããªã±ãŒã·ã§ã³ã®ãªããžããªã®URLã§ããã泚æãã ããã**äžèšã¯ãµã³ãã«ã
Herokuã®ã¹ããŒã¿ã¹ç»é¢ããGit URLã調ã¹ãŠäžèšã®ãããªã³ãã³ããCloud9ã®ã¿ãŒããã«ã§æã¡ãŸãã
git remote add heroku https://git.heroku.com/hidepon3110c.git
ç»é¢ã®äžã®æ¹ã®ãã€ã©ã€ãããŠãããšããã§ãã
äžèšã³ãã³ããã¿ãŒããã«ã§æã¡ãŸãã
git remote -v
ãããªæãã§ãã
ãªã¢ãŒãå
ã«ãorigin herokuãã確èªãããã
äžèšã³ãã³ããã¿ãŒããã«ã§æã¡ãŸããherokuã³ãã³ãã䜿ãããã®æºåãå§ãŸããŸãã
heroku
ãããªæãã§ããå°ãã€ã³ã¹ããŒã«ããã®ã§æéãããããŸãã
äžèšã³ãã³ããã¿ãŒããã«ã§æã¡ãŸãã
heroku login
herokuã¢ã«ãŠã³ãäœæã§äœ¿ã£ãã¡ãŒã«ã¢ãã¬ã¹ããã¹ã¯ãŒããèãããŸãã®ã§çããŠãã ããã
äžèšã³ãã³ããã¿ãŒããã«ã§æã¡ãŸããheroku run ã®åŸãã¯æ®æ®µããŒã«ã«ã§äœ¿ãã³ãã³ãã ãšèããŠå€§äžå€«ã ãšæããŸãã
heroku run rake db:migrate
ããã§HerokuåŽã«ãããŒã¿ããŒã¹ã®æºåãã§ããŸããã
14.iphoneãMacããHerokuã«é 眮ããã¢ããªã±ãŒã·ã§ã³ã®çšŒå確èªã
Herokuã確èªããŠãå³äžã®ã»ã»ã»ã瞊ã«ããã¢ã€ã³ã³ãã[Open app]ãã¿ã³ãã¯ãªãã¯ããŸãã
ã«ãŒãã£ã³ã°ãšã©ãŒãçºçããŠãŸãã
ããŒã«ã«ç°å¢ãšéã£ãŠèšå®ããªãå Žåã¯ãšã©ãŒãåºãããã§ãã®ã§ã/usersãã€ããŠå床確èªããŸããäŸãã°
https://hidepon3110c.herokuapp.com/users
ã§ãŸããïŒ
æ°èŠè¿œå ããŠç¢ºèªããŠã¿ãŸãã
iphoneãªã©ã§äžèšã®ãµã€ãã«ã¢ã¯ã»ã¹ããŠãhidepon3110cã®éšåãèªåã®ã¢ããªã±ãŒã·ã§ã³åã«å€ããŠã¿ãŠãã ããã
https://hidepon3110c.herokuapp.com/users
èŠããŸãããïŒãç²ãããŸã§ããïŒ
çµããã«
ãããã§ãããïŒ
ãã®èšäºã§ã¯ããã°ã©ã ã®éèŠãªéšåããä»çµã¿ã«ã€ããŠã¯å²æãããŠããã ããŸããã
å®éã«ã¡ãããšããã¢ããªã±ãŒã·ã§ããäœæããã«ã¯
Ruby on RailsãRubyãGitãHTMLãCSSãJavaScriptãunix/linuxã®ã·ã§ã«(bash)ããªããžã§ã¯ãæåãMVCã®èãæ¹ãRDB(PostgreSQL,MySQL,,,)ãšSQLãªã©ã®ç¥èãé©å®å¿
èŠã§ããããã
ãã£ã±ãèŠããããšã¯ãããŸãããèªåã§äœã£ãã¢ããªã±ãŒã·ã§ã³ãã¹ããã§åããšãããŸã§åºæ¥ãã°æ¥œãããã®ã§ãããã
ãŸãšã
- GitHub ãš Cloud9ãããã°ãšããããWEBã¢ããªã±ãŒã·ã§ã³ãäœã£ãŠåãããã
- Herokuãæ¬çªç°å¢ãšããŠå©çšããã«ã¯ããŒã¿ããŒã¹ãPostgreSQLã«å€æŽããã
- æé éãã§WEBã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ã§ããããã¡ãããšãããã®ãäœãã«ã¯ä»ã«ãããããèŠããããšãããã
- ïŒåç®ä»¥éã¯ç°¡åã«ã¢ããªã±ãŒã·ã§ã³ãã¢ããã§ããããã«ãªããã¯ãã
åèèšäº
Ruby on Rails é¢ä¿
http://techacademy.jp/magazine/5910
http://railstutorial.jp/
http://railsdoc.com/
Ruby é¢ä¿
https://www.ruby-lang.org/ja/
Git é¢ä¿
http://www.backlog.jp/git-guide/
Tips
Railsèªäœã®ç°å¢æ§ç¯ã®å匷ããVimãšããããã¹ããšãã£ã¿ã«æ £ããããMacã®ããŒã«ã«ç°å¢ã§Ruby on Railsã®éçºãè¡ãããšãå€ãã§ãã
Tips
Macã§ã¹ã¯ãªãŒã³ã·ã§ããã¯ã[ã³ãã³ãããŒ] ïŒ [ã·ããããŒ] ïŒ [ïŒ]
éžæç¯å²ãéžã¶ãšãã¹ã¯ãããã«ããªãã³ã°ããã圢ã§PNGãäœæãããããã®èšäºäœæã§å¿ èŠã«ãªãåããŠç¥ããŸããã䟿å©ã
Tips
ç»åã®ã¢ããããŒãå ãšã㊠https://www.flickr.com/ ãå©çšããŠãŸãã