big merge
This commit is contained in:
commit
64037b205f
1
Gemfile
1
Gemfile
@ -13,3 +13,4 @@ gem 'growl'
|
|||||||
gem 'rake', '0.8.7'
|
gem 'rake', '0.8.7'
|
||||||
gem 'mocha', '0.9.12'
|
gem 'mocha', '0.9.12'
|
||||||
gem 'guard-jasmine-headless-webkit'
|
gem 'guard-jasmine-headless-webkit'
|
||||||
|
gem 'facter'
|
||||||
|
@ -4,7 +4,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
guard 'shell' do
|
guard 'shell' do
|
||||||
watch(%r{ext/jasmine-webkit-specrunner/.*\.(cpp|h)}) { compile }
|
watch(%r{ext/jasmine-webkit-specrunner/.*\.(cpp|h|pro|pri)}) { |m|
|
||||||
|
if !m[0]['moc_']
|
||||||
|
compile
|
||||||
|
end
|
||||||
|
}
|
||||||
end
|
end
|
||||||
# A sample Guardfile
|
# A sample Guardfile
|
||||||
# More info at https://github.com/guard/guard#readme
|
# More info at https://github.com/guard/guard#readme
|
||||||
@ -22,7 +26,7 @@ guard 'jasmine-headless-webkit', :all_on_start => false do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile
|
def compile
|
||||||
system %{cd ext/jasmine-webkit-specrunner && ruby extconf.rb}
|
system %{cd ext/jasmine-webkit-specrunner && ruby test.rb && ruby extconf.rb}
|
||||||
end
|
end
|
||||||
|
|
||||||
compile
|
compile
|
||||||
|
39
ext/jasmine-webkit-specrunner/ConsoleOutput.cpp
Normal file
39
ext/jasmine-webkit-specrunner/ConsoleOutput.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "ConsoleOutput.h"
|
||||||
|
|
||||||
|
namespace HeadlessSpecRunner {
|
||||||
|
ConsoleOutput::ConsoleOutput() : QObject(),
|
||||||
|
showColors(false) {
|
||||||
|
outputIO = &std::cout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsoleOutput::passed(const QString &specDetail) {
|
||||||
|
green();
|
||||||
|
*outputIO << '.';
|
||||||
|
clear();
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
successes.push(specDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsoleOutput::failed(const QString &specDetail)
|
||||||
|
{
|
||||||
|
red();
|
||||||
|
*outputIO << 'F';
|
||||||
|
clear();
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
failures.push(specDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsoleOutput::green() {
|
||||||
|
if (showColors) std::cout << "\033[0;32m";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsoleOutput::clear() {
|
||||||
|
if (showColors) std::cout << "\033[m";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsoleOutput::red() {
|
||||||
|
if (showColors) std::cout << "\033[0;31m";
|
||||||
|
}
|
||||||
|
}
|
26
ext/jasmine-webkit-specrunner/ConsoleOutput.h
Normal file
26
ext/jasmine-webkit-specrunner/ConsoleOutput.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef JHW_CONSOLE_OUTPUT
|
||||||
|
#define JHW_CONSOLE_OUTPUT
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <iostream>
|
||||||
|
#include <QStack>
|
||||||
|
|
||||||
|
namespace HeadlessSpecRunner {
|
||||||
|
class ConsoleOutput : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ConsoleOutput();
|
||||||
|
void passed(const QString &specDetail);
|
||||||
|
void failed(const QString &specDetail);
|
||||||
|
std::ostream *outputIO;
|
||||||
|
QStack<QString> successes;
|
||||||
|
QStack<QString> failures;
|
||||||
|
bool showColors;
|
||||||
|
private:
|
||||||
|
void green();
|
||||||
|
void clear();
|
||||||
|
void red();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
36
ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp
Normal file
36
ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
|
#include "ConsoleOutput.h"
|
||||||
|
#include "ConsoleOutput_test.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
namespace HeadlessSpecRunner {
|
||||||
|
ConsoleOutputTest::ConsoleOutputTest() : QObject() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsoleOutputTest::testPassed() {
|
||||||
|
stringstream buffer;
|
||||||
|
HeadlessSpecRunner::ConsoleOutput output;
|
||||||
|
|
||||||
|
output.outputIO = &buffer;
|
||||||
|
output.passed("test");
|
||||||
|
QVERIFY(buffer.str() == ".");
|
||||||
|
QVERIFY(output.successes.size() == 1);
|
||||||
|
QVERIFY(output.failures.size() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsoleOutputTest::testFailed() {
|
||||||
|
stringstream buffer;
|
||||||
|
HeadlessSpecRunner::ConsoleOutput output;
|
||||||
|
|
||||||
|
output.outputIO = &buffer;
|
||||||
|
output.failed("test");
|
||||||
|
QVERIFY(buffer.str() == "F");
|
||||||
|
QVERIFY(output.successes.size() == 0);
|
||||||
|
QVERIFY(output.failures.size() == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QTEST_MAIN(HeadlessSpecRunner::ConsoleOutputTest);
|
||||||
|
|
25
ext/jasmine-webkit-specrunner/ConsoleOutput_test.h
Normal file
25
ext/jasmine-webkit-specrunner/ConsoleOutput_test.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef JHW_TEST_PAGE
|
||||||
|
#define JHW_TEST_PAGE
|
||||||
|
|
||||||
|
#include <QtTest/QtTest>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "ConsoleOutput.h"
|
||||||
|
|
||||||
|
namespace HeadlessSpecRunner {
|
||||||
|
class ConsoleOutputTest : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ConsoleOutputTest();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void testPassed();
|
||||||
|
void testFailed();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
7
ext/jasmine-webkit-specrunner/ConsoleOutput_test.pro
Normal file
7
ext/jasmine-webkit-specrunner/ConsoleOutput_test.pro
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
include(common.pri)
|
||||||
|
include(test.pri)
|
||||||
|
|
||||||
|
SOURCES += ConsoleOutput_test.cpp
|
||||||
|
HEADERS += ConsoleOutput_test.h
|
||||||
|
|
||||||
|
|
45
ext/jasmine-webkit-specrunner/Page_test.cpp
Normal file
45
ext/jasmine-webkit-specrunner/Page_test.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
|
#include "Page.h"
|
||||||
|
#include "Page_test.h"
|
||||||
|
|
||||||
|
namespace HeadlessSpecRunner {
|
||||||
|
PageTest::PageTest() : QObject(), internalLogCalled(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageTest::internalLog(const QString ¬e, const QString &msg) {
|
||||||
|
internalLogCalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageTest::consoleLog(const QString &message, int lineNumber, const QString &source) {
|
||||||
|
consoleLogCalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageTest::testJavaScriptConfirmWithLog() {
|
||||||
|
connect(&page, SIGNAL(internalLog(QString, QString)), this, SLOT(internalLog(QString, QString)));
|
||||||
|
internalLogCalled = false;
|
||||||
|
|
||||||
|
page.mainFrame()->setHtml("<script>confirm('test')</script>");
|
||||||
|
QVERIFY(internalLogCalled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageTest::testJavaScriptConfirmWithoutLog() {
|
||||||
|
connect(&page, SIGNAL(internalLog(QString, QString)), this, SLOT(internalLog(QString, QString)));
|
||||||
|
internalLogCalled = false;
|
||||||
|
|
||||||
|
page.oneFalseConfirm();
|
||||||
|
page.mainFrame()->setHtml("<script>confirm('test')</script>");
|
||||||
|
QVERIFY(!internalLogCalled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageTest::testJavaScriptConsoleMessage() {
|
||||||
|
connect(&page, SIGNAL(consoleLog(QString, int, QString)), this, SLOT(consoleLog(QString, int, QString)));
|
||||||
|
consoleLogCalled = false;
|
||||||
|
|
||||||
|
page.mainFrame()->setHtml("<script>cats();</script>");
|
||||||
|
QVERIFY(consoleLogCalled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QTEST_MAIN(HeadlessSpecRunner::PageTest);
|
||||||
|
|
29
ext/jasmine-webkit-specrunner/Page_test.h
Normal file
29
ext/jasmine-webkit-specrunner/Page_test.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef JHW_TEST_PAGE
|
||||||
|
#define JHW_TEST_PAGE
|
||||||
|
|
||||||
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
|
#include "Page.h"
|
||||||
|
|
||||||
|
namespace HeadlessSpecRunner {
|
||||||
|
class PageTest : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
PageTest();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool internalLogCalled;
|
||||||
|
bool consoleLogCalled;
|
||||||
|
HeadlessSpecRunner::Page page;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void internalLog(const QString ¬e, const QString &msg);
|
||||||
|
void consoleLog(const QString &message, int lineNumber, const QString &source);
|
||||||
|
void testJavaScriptConfirmWithLog();
|
||||||
|
void testJavaScriptConfirmWithoutLog();
|
||||||
|
void testJavaScriptConsoleMessage();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
6
ext/jasmine-webkit-specrunner/Page_test.pro
Normal file
6
ext/jasmine-webkit-specrunner/Page_test.pro
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
include(common.pri)
|
||||||
|
include(test.pri)
|
||||||
|
|
||||||
|
SOURCES += Page_test.cpp
|
||||||
|
HEADERS += Page_test.h
|
||||||
|
|
@ -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)
|
||||||
@ -100,21 +101,15 @@ namespace HeadlessSpecRunner {
|
|||||||
void Runner::specPassed()
|
void Runner::specPassed()
|
||||||
{
|
{
|
||||||
consoleNotUsedThisRun = true;
|
consoleNotUsedThisRun = true;
|
||||||
green();
|
consoleOutput.passed("");
|
||||||
std::cout << '.';
|
|
||||||
clear();
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Runner::specFailed(const QString &specDetail)
|
void Runner::specFailed(const QString &specDetail)
|
||||||
{
|
{
|
||||||
consoleNotUsedThisRun = true;
|
consoleNotUsedThisRun = true;
|
||||||
|
consoleOutput.failed("");
|
||||||
didFail = true;
|
didFail = true;
|
||||||
red();
|
|
||||||
std::cout << 'F';
|
|
||||||
failedSpecs.push(specDetail);
|
failedSpecs.push(specDetail);
|
||||||
clear();
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Runner::errorLog(const QString &msg, int lineNumber, const QString &sourceID)
|
void Runner::errorLog(const QString &msg, int lineNumber, const QString &sourceID)
|
@ -9,6 +9,7 @@
|
|||||||
#include <QQueue>
|
#include <QQueue>
|
||||||
|
|
||||||
#include "Page.h"
|
#include "Page.h"
|
||||||
|
#include "ConsoleOutput.h"
|
||||||
|
|
||||||
namespace HeadlessSpecRunner {
|
namespace HeadlessSpecRunner {
|
||||||
class Runner: public QObject {
|
class Runner: public QObject {
|
||||||
@ -50,6 +51,8 @@ namespace HeadlessSpecRunner {
|
|||||||
QString reportFilename;
|
QString reportFilename;
|
||||||
QStack<QString> failedSpecs;
|
QStack<QString> failedSpecs;
|
||||||
|
|
||||||
|
HeadlessSpecRunner::ConsoleOutput consoleOutput;
|
||||||
|
|
||||||
void red();
|
void red();
|
||||||
void green();
|
void green();
|
||||||
void yellow();
|
void yellow();
|
9
ext/jasmine-webkit-specrunner/common.pri
Normal file
9
ext/jasmine-webkit-specrunner/common.pri
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
TEMPLATE = app
|
||||||
|
CONFIG -= app_bundle
|
||||||
|
QMAKE_INFO_PLIST = Info.plist
|
||||||
|
QMAKESPEC = macx-g++
|
||||||
|
QT += network webkit
|
||||||
|
|
||||||
|
SOURCES = Page.cpp Runner.cpp ConsoleOutput.cpp
|
||||||
|
HEADERS = Page.h Runner.h ConsoleOutput.h
|
||||||
|
|
@ -4,5 +4,6 @@ $: << File.expand_path("../../../lib", __FILE__)
|
|||||||
|
|
||||||
require 'qt/qmake'
|
require 'qt/qmake'
|
||||||
|
|
||||||
Qt::Qmake.make!('jasmine-headless-webkit')
|
system %{make clean}
|
||||||
|
Qt::Qmake.make!('jasmine-headless-webkit', 'specrunner.pro')
|
||||||
|
|
||||||
|
19
ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner.pro
Normal file
19
ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner.pro
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
######################################################################
|
||||||
|
# Automatically generated by qmake (2.01a) Tue Aug 2 10:37:48 2011
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
TARGET =
|
||||||
|
DEPENDPATH += . HeadlessSpecRunner Test
|
||||||
|
INCLUDEPATH += . HeadlessSpecRunner Test
|
||||||
|
|
||||||
|
# Input
|
||||||
|
HEADERS += HeadlessSpecRunner/ConsoleOutput.h \
|
||||||
|
HeadlessSpecRunner/Page.h \
|
||||||
|
HeadlessSpecRunner/Runner.h \
|
||||||
|
Test/Page_test.h
|
||||||
|
SOURCES += specrunner.cpp \
|
||||||
|
HeadlessSpecRunner/ConsoleOutput.cpp \
|
||||||
|
HeadlessSpecRunner/Page.cpp \
|
||||||
|
HeadlessSpecRunner/Runner.cpp \
|
||||||
|
Test/Page_test.cpp
|
BIN
ext/jasmine-webkit-specrunner/jhw-test
Executable file
BIN
ext/jasmine-webkit-specrunner/jhw-test
Executable file
Binary file not shown.
@ -21,8 +21,8 @@
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "HeadlessSpecRunner/Page.h"
|
#include "Page.h"
|
||||||
#include "HeadlessSpecRunner/Runner.h"
|
#include "Runner.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
|
||||||
#error Use Qt 4.7 or later version
|
#error Use Qt 4.7 or later version
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
TEMPLATE = app
|
include(common.pri)
|
||||||
CONFIG -= app_bundle
|
|
||||||
|
SOURCES += specrunner.cpp
|
||||||
TARGET = jasmine-webkit-specrunner
|
TARGET = jasmine-webkit-specrunner
|
||||||
SOURCES = HeadlessSpecRunner/Page.cpp HeadlessSpecRunner/Runner.cpp specrunner.cpp
|
|
||||||
HEADERS = HeadlessSpecRunner/Page.h HeadlessSpecRunner/Runner.h
|
|
||||||
QT += network webkit
|
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
|
||||||
QMAKESPEC = macx-gcc
|
|
||||||
|
3
ext/jasmine-webkit-specrunner/test.pri
Normal file
3
ext/jasmine-webkit-specrunner/test.pri
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
TARGET = jhw-test
|
||||||
|
QT += testlib
|
||||||
|
|
16
ext/jasmine-webkit-specrunner/test.rb
Normal file
16
ext/jasmine-webkit-specrunner/test.rb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
system %{make clean}
|
||||||
|
|
||||||
|
Dir['*_test.pro'].each do |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
|
||||||
|
end
|
||||||
|
|
@ -2,9 +2,14 @@ require 'rbconfig'
|
|||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
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
|
||||||
class << self
|
class << self
|
||||||
QMAKES = %w{qmake-qt4 qmake}
|
QMAKES = %w{qmake-qt4 qmake}
|
||||||
@ -17,25 +22,34 @@ module Qt
|
|||||||
make_path != nil
|
make_path != nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def command
|
def command(project_file = nil)
|
||||||
case platform
|
spec = (case platform
|
||||||
when :linux
|
when :linux
|
||||||
"#{path} -spec linux-g++"
|
"linux-g++"
|
||||||
when :freebsd
|
when :freebsd
|
||||||
"#{path} -spec freebsd-g++"
|
"freebsd-g++"
|
||||||
when :mac_os_x
|
when :mac_os_x
|
||||||
"#{path} -spec macx-g++"
|
"macx-g++"
|
||||||
end
|
end)
|
||||||
|
|
||||||
|
command = "#{path} -spec #{spec}"
|
||||||
|
command << " #{project_file}" if project_file
|
||||||
|
command
|
||||||
end
|
end
|
||||||
|
|
||||||
def make!(name)
|
def make!(name, project_file = nil)
|
||||||
@name = name
|
@name = name
|
||||||
|
|
||||||
check_make!
|
check_make!
|
||||||
check_qmake!
|
check_qmake!
|
||||||
|
|
||||||
system command
|
system command(project_file)
|
||||||
system %{make}
|
|
||||||
|
system %{make #{make_options}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def make_options
|
||||||
|
"-j#{number_of_cpus}"
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -81,6 +95,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 == ''
|
||||||
@ -101,9 +123,9 @@ module Qt
|
|||||||
)
|
)
|
||||||
|
|
||||||
$stderr.puts <<-MSG
|
$stderr.puts <<-MSG
|
||||||
make is not installed. You'll need to install it to build #{@name}.
|
make is not installed. You'll need to install it to build #{@name}.
|
||||||
#{install_method} should do it for you.
|
#{install_method} should do it for you.
|
||||||
MSG
|
MSG
|
||||||
raise NotInstalledError
|
raise NotInstalledError
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -114,26 +136,27 @@ MSG
|
|||||||
case platform
|
case platform
|
||||||
when :linux
|
when :linux
|
||||||
<<-MSG
|
<<-MSG
|
||||||
sudo apt-get install libqt4-dev qt4-qmake on Debian-based systems, or downloading
|
sudo apt-get install libqt4-dev qt4-qmake on Debian-based systems, or downloading
|
||||||
Nokia's prebuilt binary at http://qt.nokia.com/downloads/
|
Nokia's prebuilt binary at http://qt.nokia.com/downloads/
|
||||||
MSG
|
MSG
|
||||||
when :freebsd
|
when :freebsd
|
||||||
<<-MSG
|
<<-MSG
|
||||||
Install /usr/ports/www/qt4-webkit and /usr/ports/devel/qmake4.
|
Install /usr/ports/www/qt4-webkit and /usr/ports/devel/qmake4.
|
||||||
MSG
|
MSG
|
||||||
|
MSG
|
||||||
when :mac_os_x
|
when :mac_os_x
|
||||||
<<-MSG
|
<<-MSG
|
||||||
sudo port install qt4-mac (for the patient) or downloading Nokia's pre-built binary
|
sudo port install qt4-mac (for the patient) or downloading Nokia's pre-built binary
|
||||||
at http://qt.nokia.com/downloads/
|
at http://qt.nokia.com/downloads/
|
||||||
MSG
|
MSG
|
||||||
end
|
end
|
||||||
).strip
|
).strip
|
||||||
|
|
||||||
$stderr.puts <<-MSG
|
$stderr.puts <<-MSG
|
||||||
qmake is not installed or is not the right version (#{@name} needs Qt 4.7 or above).
|
qmake is not installed or is not the right version (#{@name} needs Qt 4.7 or above).
|
||||||
You'll need to install it to build #{@name}.
|
You'll need to install it to build #{@name}.
|
||||||
#{install_method} should do it for you.
|
#{install_method} should do it for you.
|
||||||
MSG
|
MSG
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
11
script/gemfile
Executable file
11
script/gemfile
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'penchant'
|
||||||
|
|
||||||
|
if Penchant::Gemfile.do_full_env_switch!(ARGV[0])
|
||||||
|
puts "Gemfile switched to #{ARGV[0]}"
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
15
script/hooks/pre-commit
Executable file
15
script/hooks/pre-commit
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
OLD_GIT_DIR=$GIT_DIR
|
||||||
|
|
||||||
|
if [ "$(penchant gemfile-env)" != "remote" ]; then
|
||||||
|
unset GIT_DIR
|
||||||
|
penchant gemfile remote
|
||||||
|
GIT_DIR=$OLD_GIT_DIR
|
||||||
|
git add Gemfile*
|
||||||
|
fi
|
||||||
|
|
||||||
|
bundle exec rake
|
||||||
|
R=$?
|
||||||
|
if [ $R -ne 0 ]; then exit $R; fi
|
||||||
|
|
35
script/initialize-environment
Executable file
35
script/initialize-environment
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
if File.file?('Gemfile.erb')
|
||||||
|
pwd = Dir.pwd
|
||||||
|
|
||||||
|
Dir.chdir '..' do
|
||||||
|
File.readlines(File.join(pwd, 'Gemfile.erb')).find_all { |line| line[':git'] }.each do |line|
|
||||||
|
repo = line[%r{:git => (['"])(.*)\1}, 2]
|
||||||
|
|
||||||
|
puts "Installing #{repo}"
|
||||||
|
system %{git clone #{repo}}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Bundling for local environment"
|
||||||
|
system %{script/gemfile local}
|
||||||
|
else
|
||||||
|
puts "Bundling..."
|
||||||
|
system %{bundle}
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Installing git hooks"
|
||||||
|
system %{script/install-git-hooks}
|
||||||
|
|
||||||
|
bundle = File.file?('Gemfile') ? 'bundle exec' : ''
|
||||||
|
|
||||||
|
command = [ bundle, 'rake', '-s', '-T', 'bootstrap' ]
|
||||||
|
|
||||||
|
if !(%x{#{command.join(' ')}}).empty?
|
||||||
|
puts "Trying to run rake bootstrap..."
|
||||||
|
system %{#{bundle} rake bootstrap}
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Done!"
|
||||||
|
|
6
script/install-git-hooks
Executable file
6
script/install-git-hooks
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for hook in script/hooks/* ; do
|
||||||
|
ln -sf $PWD/$hook .git/hooks/${hook##*/}
|
||||||
|
done
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user