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 'growl'
gem 'rake', '0.8.7' gem 'rake', '0.8.7'
gem 'mocha', '0.9.12' gem 'mocha', '0.9.12'
gem 'facter'

View File

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

View File

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

View File

@ -1,7 +1,14 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
system %{make clean}
Dir['*_test.pro'].each do |test| 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 if $?.exitstatus != 0
exit 1 exit 1
end end

View File

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

View File

@ -136,5 +136,16 @@ describe Qt::Qmake do
end end
end 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 end