Kohana 3.2.x: How to install taking advantage of submodules

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's backwards compatible.

This guide will assume you have the following structure for your website:

 

root/html   <!– public html folder

root/modules   <!– kohana files

root/source   <!– environment dependable files

 

 

Ready? here we go:

 

1. Create an empty git repository following this:

 

 

2. Create a submodule with Kohana's core using:

$ git submodule add git://github.com/kohana/core.git modules/system

 

3. Add all the modules you'll need:

$ git submodule add git://github.com/kohana/database.git modules/database

$ git submodule add git://github.com/kohana/image.git modules/image

$ git submodule add git://github.com/kohana/pagination.git modules/pagination

 

4. Initialize the submodules

 

$ git submodule init

Submodule 'modules/database' (git://github.com/kohana/database.git) registered for path 'modules/database'
Submodule 'modules/image' (git://github.com/kohana/image.git) registered for path 'modules/image'
Submodule 'modules/pagination' (git://github.com/kohana/pagination.git) registered for path 'modules/pagination'
Submodule 'modules/system' (git://github.com/kohana/core.git) registered for path 'modules/system'

 

5. Commit these changes

 


$ git commit -m 'Added initial submodules'
 
 

 

6. Create the bare minimum folder structure:
 
$ mkdir -p modules/application/classes/{controller,model}
$ mkdir -p modules/application/{config,views}
$ mkdir -p modules/application/{cache,logs}
$ chmod 0777 modules/application/{cache,logs}
$ echo '[^.]*' > modules/application/logs/.gitignore
$ echo '[^.]*' > modules/application/cache/.gitignore
 
 

7. Now we need index.php and bootstrap.php files:

$ mkdir html

$ wget http://github.com/kohana/kohana/raw/3.0/master/index.php -O html/index.php

$ wget http://github.com/kohana/kohana/raw/3.0/master/application/bootstrap.php -O modules/application/bootstrap.php

 

 

8. Fix file paths on html/index.php

<?php

 

$application = '../modules/application';
$modules = '../modules';
$system = '../modules/system';

 

9. Change the default timezone

<?php

date_default_timezone_set('America/Los_Angeles');

 

Kohana::init(array(
        'base_url'   => '/',
        'index_file' => '',
));
 
 

10. Add a default .htaccess

wget  https://raw.github.com/kohana/kohana/3.2/master/example.htaccess -O html/.htaccess

 

 

 

 

Tagged , , . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • IGlr