1. How to setup the perfect
development environment
Roel De Meester
2. How to setup the perfect
development environment
Towards some drupal
development environment
07/02/10 Fosdem 2010 : Drupal Dev Machine
3. Poll
● Want to see installation process ?
● Want to discuss the result ?
07/02/10 Fosdem 2010 : Drupal Dev Machine
4. LAMP Server
● Start from a freshly installed UBUNTU
● Needs
● xAMP Stack
● Ready for drupal
● Ready for drush
● Ready to code
07/02/10 Fosdem 2010 : Drupal Dev Machine
6. LAMP Server – the script 2/2
sudo sed -i 's/memory_limit = .*/memory_limit = 128M/' /etc/php5/apache2/php.ini
sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 128M/'
/etc/php5/apache2/php.ini
sudo sed -i 's/post_max_size = .*/post_max_size = 256M/' /etc/php5/apache2/php.ini
#better uploadprogress bar
sudo pecl install uploadprogress
sudo sed -i '/; extension_dir directive above/ a
extension=uploadprogress.so' /etc/php5/apache2/php.ini
#cleanurl
sudo sed -i 's/AllowOverride (None)/AllowOverride All/' /etc/apache2/sites-available/default
sudo a2enmod rewrite && sudo /etc/init.d/apache2 restart
07/02/10 Fosdem 2010 : Drupal Dev Machine
7. LAMP Server – Automated
mkdir ~/bin
cd ~/bin
rm setup_ubuntu.sh
wget http://krimson.be/sites/default/files/setup_ubuntu.sh &&
chmod +x *.sh && ./setup_ubuntu.sh
07/02/10 Fosdem 2010 : Drupal Dev Machine
8. Drush
● Control Drupal from Terminal
● Needs
● php-cli
● curl
● drush
07/02/10 Fosdem 2010 : Drupal Dev Machine
9. Drush – the script 1/3
#default directory structure
DEFAULT_WORKSPACE=$HOME/workspace
if [ ! -d "$DEFAULT_WORKSPACE" ];then
echo "create workspace folder"
mkdir $DEFAULT_WORKSPACE
fi
cd $DEFAULT_WORKSPACE
#install drush
#NOTE : WHEN changing the drush folder, also update the
$PROFILE_PATH
DRUSH_ROOT=$DEFAULT_WORKSPACE/drush
PROFILE_PATH='n # set PATH so it includes drush if it exists n
if [ -d "$HOME/workspace/drush" ] ; then n
t PATH="$HOME/workspace/drush:$PATH" n
fi n'
07/02/10 Fosdem 2010 : Drupal Dev Machine
10. DRUSH – the script 2/3
DRUSH_VERSION=2.1
DRUSH_TGZ=drush-All-Versions-$DRUSH_VERSION.tar.gz
if [ ! -d "$DRUSH_ROOT" ];then
echo "grabbing drush"
wget http://ftp.drupal.org/files/projects/$DRUSH_TGZ
if [ -a "$DRUSH_TGZ" ];then
tar -zxvf $DRUSH_TGZ
rm $DRUSH_TGZ
else
echo "ERROR : unable to download $DRUSH_TGZ"
fi
fi
#add drush to path
07/02/10 Fosdem 2010 : Drupal Dev Machine
11. DRUSH – the script 3/3
if grep -q drush ~/.profile
then echo 'DRUSH already in path'
else echo -e $PROFILE_PATH >> ~/.profile
source ~/.profile
echo '
----------------------------------------------------------------------
| Please update your path by reloading your .profile. |
| Just run the command at the bottom from your terminal. |
| Note : this will only work in current shell. if you want a decent |
| DEV environment, you should logout/login. |
| |
| the command to run : |
| |
| . ~/.profile |
----------------------------------------------------------------------
'
fi
07/02/10 Fosdem 2010 : Drupal Dev Machine
13. An IDE
● Eclipse – VI – Emacs – Bluefish
- geany - ..
07/02/10 Fosdem 2010 : Drupal Dev Machine
14. Install Eclipse – the steps
● Install JRE – Java Runtime
● Manual or APT-Get ?
● Startup script
● Eclipse has
● Code completion
● Debug support
● Version Control support
● Eclipse is heavy to launch
07/02/10 Fosdem 2010 : Drupal Dev Machine
19. Eclipse – Configuration
● Mylyn
● Allows you to list tasks from bug tracking sytem
● Allows you to start working on task and keep
track of all 'touched' files and provides
context around a bug.
● Allows you to close tasks from within eclipse
● Unfuddle HAS a connector!
● Xdebug - krimson.be/articles/debugging-
drupal-6-using-xdebug
● Allows you to go through your running code
step by step
●
07/02/10 Fosdem 2010 : Drupal Dev Machine
20. Your company standards
● How we do it @ Krimson
● svn_new_project.sh spellen
● Checkout, virtualhost, database, multidomain,
load db dump, done
● Internal commands + conventions keeps us up
to speed
07/02/10 Fosdem 2010 : Drupal Dev Machine
21. Drupal – Extra's
● devel module
● print functions - dsm
● theme developer
● switch users
● http://drupal.org/project/masquerade
● Prevent test mails to prime ministers
● http://drupal.org/project/reroute_email
● http://drupal.org/project/schema
● http://drupal.org/project/coder
07/02/10 Fosdem 2010 : Drupal Dev Machine