Misty-Stix

The Clouded Vision

Blog Hacking Misty Twits Portfolio About Contact

Blog by Category - Techy thoughts p.1

require message in svn

I've been looking for ways on how to make svn commits require a message just before they get committed. A problem is that some developers make a mistake by making empty commits making the reason of the commit unknown. I found this code via google and I wanted to share it.

This has been tested working in VisualSVN Server.

1. open your visual svn server

2. right click on a repository then click properties

3. on the hooks tab, edit the Pre-commit hook then paste the code:

@echo off
::    
:: Stops commits that have empty log messages.
::

@echo off

setlocal

rem Subversion sends through the path to the repository and transaction id
set REPOS=%1
set TXN=%2

rem check for an empty log message
svnlook log %REPOS% -t %TXN% | findstr . > nul
if %errorlevel% gtr 0 (goto err) else exit 0

:err
echo. 1>&2
echo Your commit has been blocked because you didn't give any log message 1>&2
echo Please write a log message describing the purpose of your changes and 1>&2
echo then try committing again. -- Thank you 1>&2
exit 1

4. click "ok", then "ok" 

If you happen to find a better script than this, please let me know.

doctrine in kohana

programming

I've been using kohana and its query builder for a while now - its good but in time I came to notice that I begin rewriting code over and over again so I tried to break out of the kohana-database shell and tried out existing ORM frameworks. If you're curious about ORM check here - http://en.wikipedia.org/wiki/Object-relational_mapping. In short; using orm frameworks may greatly reduce the data-access layer code you write in your application and ensures functionality and ease in retrieving data and treating them as objects.

Without further ado; the integration of kohana and doctrine.

Instructions:
1) Download doctrine module here - http://dl.dropbox.com/u/617821/misty/doctrine.1.2.zip
2) Extract the doctrine folder to your modules directory. eg /public_html/modules/
3) Include doctrine in your modules list located in application/config/config.php
   

$config['modules'] = array
(
MODPATH.'doctrine',        // Doctrine
  // MODPATH.'archive',    // Archive utility
  // MODPATH.'payment',   // Online payments
  // MODPATH.'unit_test',    // Unit testing
);

4) Make sure you enable hooks for your particular application in application/config/config.php
   
$config['enable_hooks'] = TRUE;

5) Before running your application, create these configuration folders (be sure to set permissions to 777), doctrine will import and export doctrine-specific configurations here:
   
application/config/doctrine/sql
application/config/doctrine/fixtures
application/config/doctrine/migrations
application/config/doctrine/schema

6) Before running your application, create these models folders (be sure to set permissions to 777), doctrine will store and load your auto-generated models from here:
   
application/models/doctrine
application/models/doctrine/generated

7) Test your application. You can generate models from your database schema by executing this code:
   
Doctrine::generateModelsFromDb(
  'application/models/doctrine', 
  array('doctrine'), 
  array('generateTableClasses' => true)
);

   
And that's pretty much it to make doctrine work with kohana. I've tested this configuration both local and online. This configuration uses the application/config/database.php so you don't have to re-specify the credentials of your database elsewhere in the application.

If it doesn't work on your end don't hesitate to let me know. =)

Other Information:
    Tested working in: Kohana v2.3.4, PHP v5.2.6, MySQL v5.0.67-community-nt
    ORM framework used: Doctrine v1.2
   
Other References:
    http://www.mapledesign.co.uk/code/kohana-doctrine/ - I got most of the idea from here
    http://www.doctrine-project.org/documentation/manual/1_2/en/introduction - doctrine documentation / manual
    http://www.kohanaphp.com/ - kohana php framework

 

jump: 1 2 3