{"id":656,"date":"2012-04-24T00:35:58","date_gmt":"2012-04-24T08:35:58","guid":{"rendered":"http:\/\/blog.portnumber53.com\/?p=656"},"modified":"2012-04-24T00:35:58","modified_gmt":"2012-04-24T08:35:58","slug":"kohana-3-2-x-how-to-install-taking-advantage-of-submodules","status":"publish","type":"post","link":"https:\/\/blog.portnumber53.com\/index.php\/2012\/04\/24\/kohana-3-2-x-how-to-install-taking-advantage-of-submodules\/","title":{"rendered":"Kohana 3.2.x: How to install taking advantage of submodules"},"content":{"rendered":"<p>I have improved my Kohana 3.2.x installation steps.<\/p>\n<p>This new way takes advantages of submodules with Git thus making your life easier when upgrading to a new version, assuming it&#39;s backwards compatible.<\/p>\n<p>This guide will assume you have the following structure for your website:<\/p>\n<p>&nbsp;<\/p>\n<p>root\/html&nbsp;&nbsp; &lt;!&#8211; public html folder<\/p>\n<p>root\/modules&nbsp;&nbsp; &lt;!&#8211; kohana files<\/p>\n<p>root\/source&nbsp;&nbsp; &lt;!&#8211; environment dependable files<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Ready? here we go:<\/p>\n<p>&nbsp;<\/p>\n<p>1. Create an empty git repository following this:<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>2. Create a submodule with Kohana&#39;s core using:<\/p>\n<p>$ git submodule add git:\/\/github.com\/kohana\/core.git modules\/system<\/p>\n<p>&nbsp;<\/p>\n<p>3. Add all the modules you&#39;ll need:<\/p>\n<p>$ git submodule add git:\/\/github.com\/kohana\/database.git modules\/database<\/p>\n<p>$ git submodule add git:\/\/github.com\/kohana\/image.git modules\/image<\/p>\n<p>$ git submodule add git:\/\/github.com\/kohana\/pagination.git modules\/pagination<\/p>\n<p>&nbsp;<\/p>\n<p>4. Initialize the submodules<\/p>\n<p>&nbsp;<\/p>\n<pre><code class=\"php plain\">$ git submodule init<\/code><\/pre>\n<p>Submodule &#39;modules\/database&#39; (git:\/\/github.com\/kohana\/database.git) registered for path &#39;modules\/database&#39;<br \/>\n\tSubmodule &#39;modules\/image&#39; (git:\/\/github.com\/kohana\/image.git) registered for path &#39;modules\/image&#39;<br \/>\n\tSubmodule &#39;modules\/pagination&#39; (git:\/\/github.com\/kohana\/pagination.git) registered for path &#39;modules\/pagination&#39;<br \/>\n\tSubmodule &#39;modules\/system&#39; (git:\/\/github.com\/kohana\/core.git) registered for path &#39;modules\/system&#39;<\/p>\n<p>&nbsp;<\/p>\n<p>5. Commit these changes<\/p>\n<p>&nbsp;<\/p>\n<pre><\/pre>\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"php plain\">$ git commit -m <\/code><code class=\"php string\">&#39;Added initial submodules&#39;<\/code><\/div>\n<div class=\"line number1 index0 alt2\">&nbsp;<\/div>\n<div class=\"line number1 index0 alt2\">&nbsp;<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<div>6. Create the bare minimum folder structure:<\/div>\n<div>&nbsp;<\/div>\n<div>$ mkdir -p modules\/application\/classes\/{controller,model}<\/div>\n<div>$ mkdir -p modules\/application\/{config,views}<\/div>\n<div>$ mkdir -p modules\/application\/{cache,logs}<\/div>\n<div>$ chmod 0777 modules\/application\/{cache,logs}<\/div>\n<div>$ echo &#39;[^.]*&#39; &gt; modules\/application\/logs\/.gitignore<\/div>\n<div>$ echo &#39;[^.]*&#39; &gt; modules\/application\/cache\/.gitignore<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<p>7. Now we need index.php and bootstrap.php files:<\/p>\n<p>$ mkdir html<\/p>\n<p>$ wget http:\/\/github.com\/kohana\/kohana\/raw\/3.0\/master\/index.php -O html\/index.php<\/p>\n<p>$ wget http:\/\/github.com\/kohana\/kohana\/raw\/3.0\/master\/application\/bootstrap.php -O modules\/application\/bootstrap.php<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>8. Fix file paths on html\/index.php<\/p>\n<p>&lt;?php<\/p>\n<p>&nbsp;<\/p>\n<p>$application = &#39;..\/modules\/application&#39;;<br \/>\n\t$modules = &#39;..\/modules&#39;;<br \/>\n\t$system = &#39;..\/modules\/system&#39;;<\/p>\n<p>&nbsp;<\/p>\n<p>9. Change the default timezone<\/p>\n<p>&lt;?php<\/p>\n<p>date_default_timezone_set(&#39;America\/Los_Angeles&#39;);<\/p>\n<p>&nbsp;<\/p>\n<div>Kohana::init(array(<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &#39;base_url&#39; &nbsp; =&gt; &#39;\/&#39;,<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &#39;index_file&#39; =&gt; &#39;&#39;,<\/div>\n<div>));<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;<\/div>\n<p>10. Add a default .htaccess<\/p>\n<p>wget&nbsp; https:\/\/raw.github.com\/kohana\/kohana\/3.2\/master\/example.htaccess -O html\/.htaccess<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have improved my Kohana 3.2.x installation steps. This new way takes advantages of submodules with Git thus making your life easier when upgrading to a new version, assuming it&#39;s backwards compatible. This guide will assume you have the following structure for your website: &nbsp; root\/html&nbsp;&nbsp; &lt;!&#8211; public html folder&#8230; <a class=\"continue-reading-link\" href=\"https:\/\/blog.portnumber53.com\/index.php\/2012\/04\/24\/kohana-3-2-x-how-to-install-taking-advantage-of-submodules\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[191,207,326],"class_list":["post-656","post","type-post","status-publish","format-standard","hentry","category-kohana","tag-installation","tag-kohana","tag-submodule"],"_links":{"self":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/comments?post=656"}],"version-history":[{"count":0,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/posts\/656\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/media?parent=656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/categories?post=656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.portnumber53.com\/index.php\/wp-json\/wp\/v2\/tags?post=656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}