Starting your Yii Project Reference Guide (with Git VCS in Linux)

You are viewing revision #4 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version.

next (#8) »

I've found useful to have a step by step reference guide to work with Git with most used commands, feel free to update it with useful information you may find interesting too.

If you don't have Yii yet

$ git clone https://github.com/yiisoft/yii.git

start your project (being at root folder)

$ yii/framework/yiic webapp myproject
$ cd myproject

initialize git

$ git init

make git add empty directories to the repository

for i in $(find . -type d -regex ``./[^.].*'' -empty); do touch $i"/.gitignore"; done;

(source https://gist.github.com/18780 )

Adding a yii extension repository inside your repo at a specific path (e.g. we will add https://git.gitorious.org/lightopenid/lightopenid.git in 'protected/extensions/lightopenid')

git submodule add https://git.gitorious.org/lightopenid/lightopenid.git protected/extensions/lightopenid

This creates the file .gitmodules in your root folder which tracks all your modules data.

if for some reason (older git versions, cloning from another location) you end up with an empty directory where a foreign repository should be:

git submodule update --init

should fix it. Then you can update your repository and external ones with:

git pull && git submodule update --recursive

Edit .gitignore file in root folder and add dirs/files you don't want to be in git repo Use ! to negate the pattern:

assets/*
!assets/.gitignore
protected/runtime/*
!protected/runtime/.gitignore
protected/data/*.db

Make your first commit

git commit -a "Initial version"

Now you are ready to go!

Keep in mind some database design best practices

http://www.yiiframework.com/wiki/227/guidelines-for-good-schema-design

Use migration for tracking database changes

http://www.yiiframework.com/doc/guide/1.1/en/database.migration

$yii/framework/yiic migrate create myNewTable

Update database with new migrations after updating your repo

$yii/framework/yiic migrate

Don't forget to secure your app

http://www.yiiframework.com/wiki/275/how-to-write-secure-yii-applications/

16 0
12 followers
Viewed: 41 953 times
Version: Unknown (update)
Category: Tutorials
Written by: marcanuy
Last updated by: marcanuy
Created on: Feb 20, 2012
Last updated: 12 years ago
Update Article

Revisions

View all history

Related Articles