make cleanups and color fixes

This commit is contained in:
John Bintz 2011-08-23 19:49:47 -04:00
parent a206df590f
commit b54f163d3e
7 changed files with 42 additions and 3 deletions

View File

@ -12,3 +12,4 @@ gem 'guard-coffeescript'
gem 'growl'
gem 'rake', '0.8.7'
gem 'mocha', '0.9.12'
gem 'facter'

View File

@ -15,8 +15,8 @@ namespace HeadlessSpecRunner {
std::ostream *outputIO;
QStack<QString> successes;
QStack<QString> failures;
private:
bool showColors;
private:
void green();
void clear();
void red();

View File

@ -66,6 +66,7 @@ namespace HeadlessSpecRunner {
void Runner::setColors(bool colors)
{
showColors = colors;
consoleOutput.showColors = colors;
}
void Runner::reportFile(const QString &file)

View File

@ -1,7 +1,14 @@
#!/usr/bin/env ruby
system %{make clean}
Dir['*_test.pro'].each do |test|
system %{make clean && qmake #{test} && make && ./jhw-test}
$: << File.expand_path("../../../lib", __FILE__)
require 'qt/qmake'
Qt::Qmake.make!('jasmine-headless-webkit', test)
system %{./jhw-test}
if $?.exitstatus != 0
exit 1
end

View File

@ -1,6 +1,12 @@
require 'rbconfig'
require 'rubygems/version'
begin
require 'facter'
rescue LoadError
warn 'Including Facter allows for detection of # of cpus, resulting in faster compilations.'
end
module Qt
class NotInstalledError < StandardError; end
class Qmake
@ -37,7 +43,12 @@ module Qt
check_qmake!
system command(project_file)
system %{make}
system %{make #{make_options}}
end
def make_options
"-j#{number_of_cpus}"
end
#
@ -83,6 +94,14 @@ module Qt
end
private
def number_of_cpus
if defined?(Facter)
Facter.sp_number_processors rescue Facter.processorcount
else
1
end
end
def get_exe_path(command)
path = %x{which #{command}}.strip
path = nil if path == ''

View File

@ -136,5 +136,16 @@ describe Qt::Qmake do
end
end
end
describe '.make_options' do
let(:cpu_count) { 3 }
subject { Qt::Qmake.make_options }
before do
Qt::Qmake.stubs(:number_of_cpus).returns(cpu_count)
end
it { should == "-j#{cpu_count}" }
end
end