Skip to content

Instantly share code, notes, and snippets.

@kenoir
Created August 30, 2012 15:55
Show Gist options
  • Save kenoir/3531585 to your computer and use it in GitHub Desktop.
Save kenoir/3531585 to your computer and use it in GitHub Desktop.
Starter rakefile for PHP projects
require 'rubygems'
require 'configatron'
require 'colorize'
configatron.app_root= File.dirname(__FILE__)
configatron.app_name = "events"
configatron.relish_id = "bbc-knowlearn/kandl-events-poc"
def run_phpunit
system "phing -Dwebapp.name=#{configatron.app_name} -Dwebapp.root=#{configatron.app_root}/webapp test coverage -f #{configatron.app_root}/webapp/php/lib-test/all_tests.xml"
end
def push_relish
system "relish push #{configatron.relish_id}"
end
desc 'Push features to relish'
task :relish do
if !push_relish
abort "Couldn't push feature to relish!".red
end
end
desc 'Run PHPUnit Tests'
task :phpunit do
if !run_phpunit
abort "Failed to execute PHPUnit tests!".red
end
end
begin
require 'cucumber'
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features, "Run Cukes") do |t|
end
rescue LoadError
desc 'Cucumber rake task not available'
task :features do
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end
end
task :default => [:features,:phpunit] do
puts "Test ".red +
"all ".blue +
"the ".yellow +
"things!".green
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment