Drupal CMS

Drupal is a open source content management system based on three core components, a web server such as Apache or Microsoft IIS, a database such as MySQL, and the programming language PHP. This open source software is maintained and developed by a community of over 630,000 users and developers ensuring that the technology is always up to date and supports all the recent technologies on the web.

Drupal Content

Drupal File Permissions for non-shared hosting

All directories in root should be set to 750 with setgid set, to do so cd into it and run

sudo find  . -type d -exec chmod 2750 {} \ ;

All files in root should be set to 640 , to do so run 

sudo find . -type f -exec chmod 640 {} \ ;

Now remove the setgid bit on sites/default and all its sub folders by running

sudo chmod -R g-s  sites/default

And change permissions on sites/default/files to 770 for directories and 660 for files

sudo chmod sites/default/files 770

sudo find sites/default/files -type d -exec chmod 770 {} \ ;

sudo find sites/default/files -type f -exec chmod 660 {} \ ;

And very important, change settings.php file to read only 

sudo chmod sites/default/settings.php 400

Note on some shared hosting you will need more permissive permissions


Updating Commerce Kickstart

To create a new up to date commerce kickstart site update both commerce kickstart module and the core on your local development machine

  1. Backup original sites files and database.
  2. Set up a fresh drupal site using drush qc --domain=yourwebsitename.dev
  3. Take note of database name and password in sites/default/settings.php of new site
  4. Rename folders sites and profiles to sites-old and profiles-old in case we mess up.
  5. Copy over your  sites and profile folder from original site to new site
  6. Edit settings.php with database name and password fron step 3 above
  7. Run backup migrate on new site and restore database with original
  8. Run update.php by entering yourwebsitename.dev/update.php ito you browser and following the instructions
  9. That's it your done enjoy!

Install Ruby, Compass and Sass with RBENV and Bundle on Ubuntu 14.04

First Uninstall ruby and gem from your current setup so we have no conflicts

sudo apt-get purge ruby rubygems

Next install the Personal Package Archives (PPA)  for Node.js

sudo apt-add-repository -y ppa:chris-lea/node.js

Install python properties

sudo apt-get install python-software-properties

Now we update 

sudo apt-get -y update

And install node.js, git-core and Curl

sudo apt-get -y install curl git-core nodejs

We can now use Curl to download RBENV from git

curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/r... | bash

Now update .bashrc to set your path to RBENV by adding this to the top of .bashrc in your home folder

export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
  export PATH="${RBENV_ROOT}/bin:${PATH}"
  eval "$(rbenv init -)"
Restart bashrc

source ~/.bashrc

Install missing dependencies

rbenv bootstrap-ubuntu-12-04

List ruby versions and install the latest

rbenv install --list
rbenv install 2.3.0
(rbenv rehash) This is now deprecated as added to rbenv core as off version 0.1.2
When finished make this version of ruby default by setting it to global

rbenv global 2.3.0

Now we are nearly there, just need to install bundler which does most of the work for you setting up the config file with a list of required gems for each project and install the right gems per project

gem install bundler

Now we are ready, if you project has a gem file just navigate to that directory and run

bundle install

If you are starting you own project just run bundle init from within the project directory and add you gems to the gem file it creates

bundle ini

If you need a different ruby version for any local project we can tell RBENV to create a local ruby version for this project by running this in your project folder

rbenv local 2.3.0




Create a subtheme of Omega 4.x in Drupal 7 using drush

Download and install Omega 4 theme as you would for any Drupal Theme or use drush cmd in your website folder (Don't install omega tools)

drush dl omega

drush en omega

Check to see if you have a version of drush with omega helper commands

drush help --filter=omega

All commands in omega: (omega)
 omega-export (oexp)   Exports the theme settings of a given theme from the    
                       database to the .info file.                             
 omega-guard (ogrd)    Runs guard for the given theme including Compass and    
                       LiveReload by default.                                  
 omega-revert (orev)   Reverts the theme settings of a given theme by deleting 
                       them from the database.                                 
 omega-subtheme        Creates a Omega subtheme.                               
 omega-wizard (owiz)   Guides you through a wizard for generating a subtheme.

Create a subtheme using drush and follow the prompts

drush omega-wizard

Change directory to your new subtheme and run bundle install to get all gem file dependenices 

bundel install

Run drush omega guard to automatically watch your sass folder for changes and apply to css

drush omega-guard


Set up Ubuntu Drupalpro VM for Aurora with Sass, Compass and Yeoman

First install Aurora as you would any other theme on Drupal, you can get it here https://www.drupal.org/project/aurora or if you use drush

  1. drush dl aurora
  2. drush en aurora

Aurora suggests installing helper modules Magic https://www.drupal.org/project/magic and HTML5 Tools https://www.drupal.org/project/html5_tools

To get the most out of the Drupal Aurora theme you need to set up Sass, Compass and Yeoman. First install Ruby and build-essential and then ruby gems, then set your path for ruby gems and last install compass which will install sass by default.

  1. sudo apt-get install ruby-full build-essential
  2. sudo apt-get install rubygems
  3. export PATH=/var/lib/gems/1.8/bin:$PATH
  4. sudo gem install compass

Now that you have ruby, gems, sass and compass installed you will need to install Yeoman to help create your subthemes. First make sure you have node.js installed, to get the latest.

curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -

Then install with:

sudo apt-get install -y nodejs

Now install Yeoman with:

npm install -g yo generator-drupal-theme

And to update it

npm update -g generator-drupal-theme

Finally from within you theme folder sites/all/themes run:

yo drupal-theme

And follow the prompts