mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-14 07:48:39 -05:00
Initial setup of broccoli build
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
"angular-tz-extensions": "*"
|
||||
},
|
||||
"homepage": "https://github.com/chouseknecht/angular-scheduler",
|
||||
"main": "git@github.com:chouseknecht/angular-scheduler.git",
|
||||
"main": "./lib/angular-scheduler.js",
|
||||
"keywords": [
|
||||
"schedule",
|
||||
"rrule",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "angular-tz-extensions",
|
||||
"version": "0.3.10",
|
||||
"main": "js/angular-timezones.js",
|
||||
"main": "./lib/angular-tz-extensions.js",
|
||||
"ignore": [
|
||||
".bowerrc",
|
||||
".idea",
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "less",
|
||||
"version": "1.6.3",
|
||||
"main": "./dist/less-1.6.3.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"benchmark",
|
||||
"bin",
|
||||
"build",
|
||||
"lib",
|
||||
"test",
|
||||
"*.md",
|
||||
"LICENSE",
|
||||
"Gruntfile.js",
|
||||
"package.json",
|
||||
"bower.json"
|
||||
],
|
||||
"homepage": "https://github.com/less/less.js",
|
||||
"_release": "1.6.3",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.6.3",
|
||||
"commit": "0cfd753e3750ff1ee4c54e09d10ea1a633b0ce89"
|
||||
},
|
||||
"_source": "git://github.com/less/less.js.git",
|
||||
"_target": "~1.6.3",
|
||||
"_originalSource": "less.js",
|
||||
"_direct": true
|
||||
}
|
||||
@@ -1,347 +0,0 @@
|
||||
import groovy.io.FileType
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
import org.gradle.api.tasks.Exec
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.eriwen:gradle-js-plugin:1.8.0'
|
||||
classpath 'com.moowork.gradle:gradle-grunt-plugin:0.2'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'js'
|
||||
apply plugin: 'grunt'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
configurations {
|
||||
rhino
|
||||
}
|
||||
|
||||
dependencies {
|
||||
rhino 'org.mozilla:rhino:1.7R4'
|
||||
}
|
||||
|
||||
project.ext {
|
||||
packageProps = new groovy.json.JsonSlurper().parseText(new File("package.json").toURL().text)
|
||||
failures = 0;
|
||||
rhinoTestSrc = "out/rhino-test-${packageProps.version}.js"
|
||||
testSrc = 'test/less'
|
||||
testOut = 'out/test'
|
||||
}
|
||||
|
||||
task runGruntRhino(type: GruntTask) {
|
||||
gruntArgs = "rhino"
|
||||
}
|
||||
|
||||
combineJs {
|
||||
dependsOn runGruntRhino
|
||||
source = ["dist/less-rhino-${packageProps.version}.js", "test/rhino/test-header.js","dist/lessc-rhino-${packageProps.version}.js"]
|
||||
dest = file(rhinoTestSrc)
|
||||
}
|
||||
|
||||
task testRhino(type: AllRhinoTests) {
|
||||
// dependsOn 'testRhinoBase'
|
||||
dependsOn 'testRhinoBase', 'testRhinoErrors', 'testRhinoLegacy', 'testRhinoStaticUrls', 'testRhinoCompression', 'testRhinoDebugAll', 'testRhinoDebugComments', 'testRhinoDebugMediaquery', 'testRhinoNoJsError', 'testRhinoSourceMap'
|
||||
}
|
||||
|
||||
task testRhinoBase(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--relative-urls' ]
|
||||
}
|
||||
|
||||
task testRhinoDebugAll(type: DebugRhinoTest) {
|
||||
options = [ '--strict-math=true', '--line-numbers=all' ]
|
||||
testDir = 'debug' + fs
|
||||
suffix = "-all"
|
||||
}
|
||||
|
||||
task testRhinoDebugComments(type: DebugRhinoTest) {
|
||||
options = [ '--strict-math=true', '--line-numbers=comments' ]
|
||||
testDir = 'debug' + fs
|
||||
suffix = "-comments"
|
||||
}
|
||||
|
||||
task testRhinoDebugMediaquery(type: DebugRhinoTest) {
|
||||
options = [ '--strict-math=true', '--line-numbers=mediaquery' ]
|
||||
testDir = 'debug' + fs
|
||||
suffix = "-mediaquery"
|
||||
}
|
||||
|
||||
task testRhinoErrors(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--strict-units=true' ]
|
||||
testDir = 'errors/'
|
||||
expectErrors = true
|
||||
}
|
||||
|
||||
task testRhinoChyby(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--strict-units=true' ]
|
||||
testDir = 'chyby/'
|
||||
// expectErrors = true
|
||||
}
|
||||
|
||||
task testRhinoNoJsError(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--strict-units=true', '--no-js' ]
|
||||
testDir = 'no-js-errors/'
|
||||
expectErrors = true
|
||||
}
|
||||
|
||||
task testRhinoLegacy(type: RhinoTest) {
|
||||
testDir = 'legacy/'
|
||||
}
|
||||
|
||||
task testRhinoStaticUrls(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--rootpath=folder (1)/' ]
|
||||
testDir = 'static-urls/'
|
||||
}
|
||||
|
||||
task testRhinoCompression(type: RhinoTest) {
|
||||
options = [ '--compress=true' ]
|
||||
testDir = 'compression/'
|
||||
}
|
||||
|
||||
task testRhinoSourceMap(type: SourceMapRhinoTest) {
|
||||
options = [ '--strict-math=true', '--strict-units=true']
|
||||
testDir = 'sourcemaps/'
|
||||
}
|
||||
|
||||
task setupTest {
|
||||
dependsOn combineJs
|
||||
doLast {
|
||||
file(testOut).deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
task clean << {
|
||||
file(rhinoTestSrc).delete()
|
||||
file(testOut).deleteDir()
|
||||
}
|
||||
|
||||
class SourceMapRhinoTest extends RhinoTest {
|
||||
|
||||
// helper to get the output map file
|
||||
def getOutputMap(lessFile) {
|
||||
def outFile = project.file(lessFile.path.replace('test/less', project.testOut).replace('.less', '.css'))
|
||||
return project.file(outFile.path + ".map");
|
||||
}
|
||||
|
||||
// callback to add SourceMap options to the options list
|
||||
def postProcessOptions(options, lessFile) {
|
||||
def outFile = getOutputMap(lessFile)
|
||||
project.file(outFile.parent).mkdirs()
|
||||
options << "--source-map=${testDir}${lessFile.name.replace('.less','.css')}"
|
||||
options << "--source-map-basepath=${lessRootDir}"
|
||||
options << "--source-map-rootpath=testweb/"
|
||||
options << "--source-map-output-map-file=${outFile}"
|
||||
|
||||
options
|
||||
}
|
||||
|
||||
// Callback to validate output
|
||||
def handleResult(exec, out, lessFile) {
|
||||
def actualFile = getOutputMap(lessFile)
|
||||
def expectedFile = project.file(projectDir + fs + "test" + fs + testDir + fs + lessFile.name.replace(".less", ".json"))
|
||||
assert actualFile.text == expectedFile.text
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DebugRhinoTest extends RhinoTest {
|
||||
|
||||
def escapeIt(it) {
|
||||
return it.replaceAll("\\\\", "\\\\\\\\").replaceAll("/", "\\\\/").replaceAll(":", "\\\\:").replaceAll("\\.", "\\\\.");
|
||||
}
|
||||
|
||||
def globalReplacements(input, directory) {
|
||||
def pDirectory = toPlatformFs(directory)
|
||||
def p = lessRootDir + fs + pDirectory
|
||||
def pathimport = p + toPlatformFs("import/")
|
||||
def pathesc = escapeIt(p)
|
||||
def pathimportesc = escapeIt(pathimport)
|
||||
|
||||
def result = input.replace("{path}", p).replace("{pathesc}", pathesc).replace("{pathimport}", pathimport)
|
||||
return result.replace("{pathimportesc}", pathimportesc).replace("\r\n", "\n")
|
||||
}
|
||||
}
|
||||
|
||||
class RhinoTest extends DefaultTask {
|
||||
|
||||
RhinoTest() {
|
||||
dependsOn 'setupTest'
|
||||
}
|
||||
|
||||
def suffix = ""
|
||||
def testDir = ''
|
||||
def options = []
|
||||
def expectErrors = false
|
||||
def fs = File.separator;
|
||||
def projectDir = toUpperCaseDriveLetter(System.getProperty("user.dir"));
|
||||
def lessRootDir = projectDir + fs + "test" + fs + "less"
|
||||
|
||||
def toUpperCaseDriveLetter(path) {
|
||||
if (path.charAt(1)==':' && path.charAt(2)=='\\') {
|
||||
return path.substring(0,1).toUpperCase() + path.substring(1);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
def toPlatformFs(path) {
|
||||
return path.replace('\\', fs).replace('/', fs);
|
||||
}
|
||||
|
||||
def expectedCssPath(lessFilePath) {
|
||||
lessFilePath.replace('.less', "${suffix}.css").replace("${fs}less${fs}", "${fs}css${fs}");
|
||||
}
|
||||
|
||||
def globalReplacements(input, directory) {
|
||||
return input;
|
||||
}
|
||||
|
||||
def stylize(str, style) {
|
||||
def styles = [
|
||||
reset : [0, 0],
|
||||
bold : [1, 22],
|
||||
inverse : [7, 27],
|
||||
underline : [4, 24],
|
||||
yellow : [33, 39],
|
||||
green : [32, 39],
|
||||
red : [31, 39],
|
||||
grey : [90, 39]
|
||||
];
|
||||
return '\033[' + styles[style][0] + 'm' + str +
|
||||
'\033[' + styles[style][1] + 'm';
|
||||
}
|
||||
|
||||
// Callback for subclasses to make any changes to the options
|
||||
def postProcessOptions(options, lessFile) {
|
||||
options
|
||||
}
|
||||
|
||||
// Callback to validate output
|
||||
def handleResult(exec, out, lessFile) {
|
||||
def actual = out.toString().trim()
|
||||
def actualResult = project.file(lessFile.path.replace('test/less', project.testOut).replace('.less', '.css'))
|
||||
project.file(actualResult.parent).mkdirs()
|
||||
actualResult << actual
|
||||
def expected
|
||||
if (expectErrors) {
|
||||
assert exec.exitValue != 0
|
||||
expected = project.file(lessFile.path.replace('.less', '.txt')).text.trim().
|
||||
replace('{path}', lessFile.parent + '/').
|
||||
replace('{pathhref}', '').
|
||||
replace('{404status}', '')
|
||||
} else {
|
||||
assert exec.exitValue == 0
|
||||
def expectedFile = expectedCssPath(lessFile.path)
|
||||
expected = project.file(expectedFile).text.trim()
|
||||
expected = globalReplacements(expected, testDir)
|
||||
}
|
||||
actual=actual.trim()
|
||||
actual = actual.replace('\r\n', '\n')
|
||||
expected = expected.replace('\r\n', '\n')
|
||||
actual = actual.replace("/","\\")
|
||||
expected = expected.replace("/","\\")
|
||||
// println "* actual *"
|
||||
// println actual
|
||||
// new File("actual.txt").write(actual)
|
||||
// println "* expected *"
|
||||
// println expected
|
||||
// new File("expected.txt").write(expected)
|
||||
assert actual == expected
|
||||
actualResult.delete()
|
||||
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
def runTest() {
|
||||
int testSuccesses = 0, testFailures = 0, testErrors = 0
|
||||
project.file('test/less/' + testDir).eachFileMatch(FileType.FILES, ~/.*\.less/) { lessFile ->
|
||||
println "lessfile: $lessFile"
|
||||
if (!project.hasProperty('test') || lessFile.name.startsWith(project.test)) {
|
||||
def out = new java.io.ByteArrayOutputStream()
|
||||
def processedOptions = postProcessOptions([project.rhinoTestSrc, lessFile] + options, lessFile)
|
||||
def execOptions = {
|
||||
main = 'org.mozilla.javascript.tools.shell.Main'
|
||||
// main = 'org.mozilla.javascript.tools.debugger.Main'
|
||||
classpath = project.configurations.rhino
|
||||
args = processedOptions
|
||||
standardOutput = out
|
||||
ignoreExitValue = true
|
||||
}
|
||||
println "rhinoTestSrc: ${project.rhinoTestSrc}"
|
||||
try {
|
||||
def exec = project.javaexec(execOptions)
|
||||
handleResult(exec, out, lessFile)
|
||||
testSuccesses++
|
||||
println stylize(' ok', 'green')
|
||||
}
|
||||
catch (ex) {
|
||||
println ex
|
||||
println()
|
||||
testErrors++;
|
||||
}
|
||||
catch (AssertionError ae) {
|
||||
println stylize(' failed', 'red')
|
||||
println ae
|
||||
testFailures++
|
||||
}
|
||||
} else {
|
||||
println stylize(' skipped', 'yellow')
|
||||
}
|
||||
}
|
||||
println stylize(testSuccesses + ' ok', 'green')
|
||||
println stylize(testFailures + ' assertion failed', testFailures == 0 ? 'green' : 'red')
|
||||
println stylize(testErrors + ' errors', testErrors == 0 ? 'green' : 'red')
|
||||
if (testFailures != 0 || testErrors != 0) {
|
||||
project.failures++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AllRhinoTests extends DefaultTask {
|
||||
|
||||
AllRhinoTests() {
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
def runTest() {
|
||||
println stylize(project.failures + ' test suites failed', project.failures == 0 ? 'green' : 'red')
|
||||
}
|
||||
|
||||
def stylize(str, style) {
|
||||
def styles = [
|
||||
reset : [0, 0],
|
||||
bold : [1, 22],
|
||||
inverse : [7, 27],
|
||||
underline : [4, 24],
|
||||
yellow : [33, 39],
|
||||
green : [32, 39],
|
||||
red : [31, 39],
|
||||
grey : [90, 39]
|
||||
];
|
||||
return '\033[' + styles[style][0] + 'm' + str +
|
||||
'\033[' + styles[style][1] + 'm';
|
||||
}
|
||||
}
|
||||
|
||||
class GruntTask extends Exec {
|
||||
private String gruntExecutable = Os.isFamily(Os.FAMILY_WINDOWS) ? "grunt.cmd" : "grunt"
|
||||
private String switches = "--no-color"
|
||||
|
||||
String gruntArgs = ""
|
||||
|
||||
public GruntTask() {
|
||||
super()
|
||||
this.setExecutable(gruntExecutable)
|
||||
}
|
||||
|
||||
public void setGruntArgs(String gruntArgs) {
|
||||
this.args = "$switches $gruntArgs".trim().split(" ") as List
|
||||
}
|
||||
}
|
||||
|
||||
-2695
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-2710
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-2712
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-2721
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-2769
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-2805
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3004
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3293
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3318
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3337
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3478
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-4011
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-4401
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-4413
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-5830
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-5830
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-5837
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-5837
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-6914
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-6941
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-7485
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-7513
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-7624
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-2460
File diff suppressed because it is too large
Load Diff
-2481
File diff suppressed because it is too large
Load Diff
-3725
File diff suppressed because it is too large
Load Diff
-3990
File diff suppressed because it is too large
Load Diff
-4002
File diff suppressed because it is too large
Load Diff
-4273
File diff suppressed because it is too large
Load Diff
-6831
File diff suppressed because it is too large
Load Diff
-9017
File diff suppressed because it is too large
Load Diff
-449
@@ -1,449 +0,0 @@
|
||||
/* LESS.js v1.6.2 RHINO | Copyright (c) 2009-2014, Alexis Sellier <self@cloudhead.net> */
|
||||
|
||||
/*global name:true, less, loadStyleSheet, os */
|
||||
|
||||
function formatError(ctx, options) {
|
||||
options = options || {};
|
||||
|
||||
var message = "";
|
||||
var extract = ctx.extract;
|
||||
var error = [];
|
||||
|
||||
// var stylize = options.color ? require('./lessc_helper').stylize : function (str) { return str; };
|
||||
var stylize = function (str) { return str; };
|
||||
|
||||
// only output a stack if it isn't a less error
|
||||
if (ctx.stack && !ctx.type) { return stylize(ctx.stack, 'red'); }
|
||||
|
||||
if (!ctx.hasOwnProperty('index') || !extract) {
|
||||
return ctx.stack || ctx.message;
|
||||
}
|
||||
|
||||
if (typeof(extract[0]) === 'string') {
|
||||
error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey'));
|
||||
}
|
||||
|
||||
if (typeof(extract[1]) === 'string') {
|
||||
var errorTxt = ctx.line + ' ';
|
||||
if (extract[1]) {
|
||||
errorTxt += extract[1].slice(0, ctx.column) +
|
||||
stylize(stylize(stylize(extract[1][ctx.column], 'bold') +
|
||||
extract[1].slice(ctx.column + 1), 'red'), 'inverse');
|
||||
}
|
||||
error.push(errorTxt);
|
||||
}
|
||||
|
||||
if (typeof(extract[2]) === 'string') {
|
||||
error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey'));
|
||||
}
|
||||
error = error.join('\n') + stylize('', 'reset') + '\n';
|
||||
|
||||
message += stylize(ctx.type + 'Error: ' + ctx.message, 'red');
|
||||
if (ctx.filename) {
|
||||
message += stylize(' in ', 'red') + ctx.filename +
|
||||
stylize(' on line ' + ctx.line + ', column ' + (ctx.column + 1) + ':', 'grey');
|
||||
}
|
||||
|
||||
message += '\n' + error;
|
||||
|
||||
if (ctx.callLine) {
|
||||
message += stylize('from ', 'red') + (ctx.filename || '') + '/n';
|
||||
message += stylize(ctx.callLine, 'grey') + ' ' + ctx.callExtract + '/n';
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
function writeError(ctx, options) {
|
||||
options = options || {};
|
||||
if (options.silent) { return; }
|
||||
print(formatError(ctx, options));
|
||||
}
|
||||
|
||||
function loadStyleSheet(sheet, callback, reload, remaining) {
|
||||
var endOfPath = Math.max(name.lastIndexOf('/'), name.lastIndexOf('\\')),
|
||||
sheetName = name.slice(0, endOfPath + 1) + sheet.href,
|
||||
contents = sheet.contents || {},
|
||||
input = readFile(sheetName);
|
||||
|
||||
input = input.replace(/^\xEF\xBB\xBF/, '');
|
||||
|
||||
contents[sheetName] = input;
|
||||
|
||||
var parser = new less.Parser({
|
||||
paths: [sheet.href.replace(/[\w\.-]+$/, '')],
|
||||
contents: contents
|
||||
});
|
||||
parser.parse(input, function (e, root) {
|
||||
if (e) {
|
||||
return writeError(e);
|
||||
}
|
||||
try {
|
||||
callback(e, root, input, sheet, { local: false, lastModified: 0, remaining: remaining }, sheetName);
|
||||
} catch(e) {
|
||||
writeError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
|
||||
|
||||
var href = file;
|
||||
if (currentFileInfo && currentFileInfo.currentDirectory && !/^\//.test(file)) {
|
||||
href = less.modules.path.join(currentFileInfo.currentDirectory, file);
|
||||
}
|
||||
|
||||
var path = less.modules.path.dirname(href);
|
||||
|
||||
var newFileInfo = {
|
||||
currentDirectory: path + '/',
|
||||
filename: href
|
||||
};
|
||||
|
||||
if (currentFileInfo) {
|
||||
newFileInfo.entryPath = currentFileInfo.entryPath;
|
||||
newFileInfo.rootpath = currentFileInfo.rootpath;
|
||||
newFileInfo.rootFilename = currentFileInfo.rootFilename;
|
||||
newFileInfo.relativeUrls = currentFileInfo.relativeUrls;
|
||||
} else {
|
||||
newFileInfo.entryPath = path;
|
||||
newFileInfo.rootpath = less.rootpath || path;
|
||||
newFileInfo.rootFilename = href;
|
||||
newFileInfo.relativeUrls = env.relativeUrls;
|
||||
}
|
||||
|
||||
var j = file.lastIndexOf('/');
|
||||
if(newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) && j != -1) {
|
||||
var relativeSubDirectory = file.slice(0, j+1);
|
||||
newFileInfo.rootpath = newFileInfo.rootpath + relativeSubDirectory; // append (sub|sup) directory path of imported file
|
||||
}
|
||||
newFileInfo.currentDirectory = path;
|
||||
newFileInfo.filename = href;
|
||||
|
||||
var data = null;
|
||||
try {
|
||||
data = readFile(href);
|
||||
} catch (e) {
|
||||
callback({ type: 'File', message: "'" + less.modules.path.basename(href) + "' wasn't found" });
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
callback(null, data, href, newFileInfo, { lastModified: 0 });
|
||||
} catch (e) {
|
||||
callback(e, null, href);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function writeFile(filename, content) {
|
||||
var fstream = new java.io.FileWriter(filename);
|
||||
var out = new java.io.BufferedWriter(fstream);
|
||||
out.write(content);
|
||||
out.close();
|
||||
}
|
||||
|
||||
// Command line integration via Rhino
|
||||
(function (args) {
|
||||
|
||||
var options = {
|
||||
depends: false,
|
||||
compress: false,
|
||||
cleancss: false,
|
||||
max_line_len: -1,
|
||||
optimization: 1,
|
||||
silent: false,
|
||||
verbose: false,
|
||||
lint: false,
|
||||
paths: [],
|
||||
color: true,
|
||||
strictImports: false,
|
||||
rootpath: '',
|
||||
relativeUrls: false,
|
||||
ieCompat: true,
|
||||
strictMath: false,
|
||||
strictUnits: false
|
||||
};
|
||||
var continueProcessing = true,
|
||||
currentErrorcode;
|
||||
|
||||
var checkArgFunc = function(arg, option) {
|
||||
if (!option) {
|
||||
print(arg + " option requires a parameter");
|
||||
continueProcessing = false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
var checkBooleanArg = function(arg) {
|
||||
var onOff = /^((on|t|true|y|yes)|(off|f|false|n|no))$/i.exec(arg);
|
||||
if (!onOff) {
|
||||
print(" unable to parse "+arg+" as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
|
||||
continueProcessing = false;
|
||||
return false;
|
||||
}
|
||||
return Boolean(onOff[2]);
|
||||
};
|
||||
|
||||
var warningMessages = "";
|
||||
var sourceMapFileInline = false;
|
||||
|
||||
args = args.filter(function (arg) {
|
||||
var match = arg.match(/^-I(.+)$/);
|
||||
|
||||
if (match) {
|
||||
options.paths.push(match[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i);
|
||||
if (match) { arg = match[1]; } // was (?:=([^\s]*)), check!
|
||||
else { return arg; }
|
||||
|
||||
switch (arg) {
|
||||
case 'v':
|
||||
case 'version':
|
||||
console.log("lessc " + less.version.join('.') + " (LESS Compiler) [JavaScript]");
|
||||
continueProcessing = false;
|
||||
break;
|
||||
case 'verbose':
|
||||
options.verbose = true;
|
||||
break;
|
||||
case 's':
|
||||
case 'silent':
|
||||
options.silent = true;
|
||||
break;
|
||||
case 'l':
|
||||
case 'lint':
|
||||
options.lint = true;
|
||||
break;
|
||||
case 'strict-imports':
|
||||
options.strictImports = true;
|
||||
break;
|
||||
case 'h':
|
||||
case 'help':
|
||||
//TODO
|
||||
// require('../lib/less/lessc_helper').printUsage();
|
||||
continueProcessing = false;
|
||||
break;
|
||||
case 'x':
|
||||
case 'compress':
|
||||
options.compress = true;
|
||||
break;
|
||||
case 'M':
|
||||
case 'depends':
|
||||
options.depends = true;
|
||||
break;
|
||||
case 'yui-compress':
|
||||
warningMessages += "yui-compress option has been removed. assuming clean-css.";
|
||||
options.cleancss = true;
|
||||
break;
|
||||
case 'clean-css':
|
||||
options.cleancss = true;
|
||||
break;
|
||||
case 'max-line-len':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.maxLineLen = parseInt(match[2], 10);
|
||||
if (options.maxLineLen <= 0) {
|
||||
options.maxLineLen = -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'no-color':
|
||||
options.color = false;
|
||||
break;
|
||||
case 'no-ie-compat':
|
||||
options.ieCompat = false;
|
||||
break;
|
||||
case 'no-js':
|
||||
options.javascriptEnabled = false;
|
||||
break;
|
||||
case 'include-path':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.paths = match[2].split(os.type().match(/Windows/) ? ';' : ':')
|
||||
.map(function(p) {
|
||||
if (p) {
|
||||
// return path.resolve(process.cwd(), p);
|
||||
return p;
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'O0': options.optimization = 0; break;
|
||||
case 'O1': options.optimization = 1; break;
|
||||
case 'O2': options.optimization = 2; break;
|
||||
case 'line-numbers':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.dumpLineNumbers = match[2];
|
||||
}
|
||||
break;
|
||||
case 'source-map':
|
||||
if (!match[2]) {
|
||||
options.sourceMap = true;
|
||||
} else {
|
||||
options.sourceMap = match[2];
|
||||
}
|
||||
break;
|
||||
case 'source-map-rootpath':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.sourceMapRootpath = match[2];
|
||||
}
|
||||
break;
|
||||
case 'source-map-basepath':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.sourceMapBasepath = match[2];
|
||||
}
|
||||
break;
|
||||
case 'source-map-map-inline':
|
||||
sourceMapFileInline = true;
|
||||
options.sourceMap = true;
|
||||
break;
|
||||
case 'source-map-less-inline':
|
||||
options.outputSourceFiles = true;
|
||||
break;
|
||||
case 'source-map-url':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.sourceMapURL = match[2];
|
||||
}
|
||||
break;
|
||||
case 'source-map-output-map-file':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.writeSourceMap = function(sourceMapContent) {
|
||||
writeFile(match[2], sourceMapContent);
|
||||
};
|
||||
}
|
||||
break;
|
||||
case 'rp':
|
||||
case 'rootpath':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.rootpath = match[2].replace(/\\/g, '/');
|
||||
}
|
||||
break;
|
||||
case "ru":
|
||||
case "relative-urls":
|
||||
options.relativeUrls = true;
|
||||
break;
|
||||
case "sm":
|
||||
case "strict-math":
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.strictMath = checkBooleanArg(match[2]);
|
||||
}
|
||||
break;
|
||||
case "su":
|
||||
case "strict-units":
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.strictUnits = checkBooleanArg(match[2]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.log('invalid option ' + arg);
|
||||
continueProcessing = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!continueProcessing) {
|
||||
return;
|
||||
}
|
||||
|
||||
var name = args[0];
|
||||
if (name && name != '-') {
|
||||
// name = path.resolve(process.cwd(), name);
|
||||
}
|
||||
var output = args[1];
|
||||
var outputbase = args[1];
|
||||
if (output) {
|
||||
options.sourceMapOutputFilename = output;
|
||||
// output = path.resolve(process.cwd(), output);
|
||||
if (warningMessages) {
|
||||
console.log(warningMessages);
|
||||
}
|
||||
}
|
||||
|
||||
// options.sourceMapBasepath = process.cwd();
|
||||
// options.sourceMapBasepath = '';
|
||||
|
||||
if (options.sourceMap === true) {
|
||||
console.log("output: " + output);
|
||||
if (!output && !sourceMapFileInline) {
|
||||
console.log("the sourcemap option only has an optional filename if the css filename is given");
|
||||
return;
|
||||
}
|
||||
options.sourceMapFullFilename = options.sourceMapOutputFilename + ".map";
|
||||
options.sourceMap = less.modules.path.basename(options.sourceMapFullFilename);
|
||||
} else if (options.sourceMap) {
|
||||
options.sourceMapOutputFilename = options.sourceMap;
|
||||
}
|
||||
|
||||
|
||||
if (!name) {
|
||||
console.log("lessc: no inout files");
|
||||
console.log("");
|
||||
// TODO
|
||||
// require('../lib/less/lessc_helper').printUsage();
|
||||
currentErrorcode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
// var ensureDirectory = function (filepath) {
|
||||
// var dir = path.dirname(filepath),
|
||||
// cmd,
|
||||
// existsSync = fs.existsSync || path.existsSync;
|
||||
// if (!existsSync(dir)) {
|
||||
// if (mkdirp === undefined) {
|
||||
// try {mkdirp = require('mkdirp');}
|
||||
// catch(e) { mkdirp = null; }
|
||||
// }
|
||||
// cmd = mkdirp && mkdirp.sync || fs.mkdirSync;
|
||||
// cmd(dir);
|
||||
// }
|
||||
// };
|
||||
|
||||
if (options.depends) {
|
||||
if (!outputbase) {
|
||||
console.log("option --depends requires an output path to be specified");
|
||||
return;
|
||||
}
|
||||
console.log(outputbase + ": ");
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
console.log('No files present in the fileset');
|
||||
quit(1);
|
||||
}
|
||||
|
||||
var input = null;
|
||||
try {
|
||||
input = readFile(name, 'utf-8');
|
||||
|
||||
} catch (e) {
|
||||
console.log('lesscss: couldn\'t open file ' + name);
|
||||
quit(1);
|
||||
}
|
||||
|
||||
options.filename = name;
|
||||
var result;
|
||||
try {
|
||||
var parser = new less.Parser(options);
|
||||
parser.parse(input, function (e, root) {
|
||||
if (e) {
|
||||
writeError(e, options);
|
||||
quit(1);
|
||||
} else {
|
||||
result = root.toCSS(options);
|
||||
if (output) {
|
||||
writeFile(output, result);
|
||||
console.log("Written to " + output);
|
||||
} else {
|
||||
print(result);
|
||||
}
|
||||
quit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch(e) {
|
||||
writeError(e, options);
|
||||
quit(1);
|
||||
}
|
||||
console.log("done");
|
||||
}(arguments));
|
||||
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
#Sun Oct 27 15:19:43 CET 2013
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
|
||||
Vendored
-164
@@ -1,164 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "less",
|
||||
"version": "1.7.4",
|
||||
"main": "./dist/less-1.7.4.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"benchmark",
|
||||
"bin",
|
||||
"build",
|
||||
"lib",
|
||||
"test",
|
||||
"*.md",
|
||||
"LICENSE",
|
||||
"Gruntfile.js",
|
||||
"package.json",
|
||||
"bower.json"
|
||||
],
|
||||
"homepage": "https://github.com/less/less",
|
||||
"_release": "1.7.4",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.7.4",
|
||||
"commit": "3ebab44915ac84b3382f54e8a95bdcc72edd7c1d"
|
||||
},
|
||||
"_source": "git://github.com/less/less.git",
|
||||
"_target": "~1.7.4",
|
||||
"_originalSource": "less",
|
||||
"_direct": true
|
||||
}
|
||||
@@ -1,347 +0,0 @@
|
||||
import groovy.io.FileType
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
import org.gradle.api.tasks.Exec
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.eriwen:gradle-js-plugin:1.8.0'
|
||||
classpath 'com.moowork.gradle:gradle-grunt-plugin:0.2'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'js'
|
||||
apply plugin: 'grunt'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
configurations {
|
||||
rhino
|
||||
}
|
||||
|
||||
dependencies {
|
||||
rhino 'org.mozilla:rhino:1.7R4'
|
||||
}
|
||||
|
||||
project.ext {
|
||||
packageProps = new groovy.json.JsonSlurper().parseText(new File("package.json").toURL().text)
|
||||
failures = 0;
|
||||
rhinoTestSrc = "out/rhino-test-${packageProps.version}.js"
|
||||
testSrc = 'test/less'
|
||||
testOut = 'out/test'
|
||||
}
|
||||
|
||||
task runGruntRhino(type: GruntTask) {
|
||||
gruntArgs = "rhino"
|
||||
}
|
||||
|
||||
combineJs {
|
||||
dependsOn runGruntRhino
|
||||
source = ["dist/less-rhino-${packageProps.version}.js", "test/rhino/test-header.js","dist/lessc-rhino-${packageProps.version}.js"]
|
||||
dest = file(rhinoTestSrc)
|
||||
}
|
||||
|
||||
task testRhino(type: AllRhinoTests) {
|
||||
// dependsOn 'testRhinoBase'
|
||||
dependsOn 'testRhinoBase', 'testRhinoErrors', 'testRhinoLegacy', 'testRhinoStaticUrls', 'testRhinoCompression', 'testRhinoDebugAll', 'testRhinoDebugComments', 'testRhinoDebugMediaquery', 'testRhinoNoJsError', 'testRhinoSourceMap'
|
||||
}
|
||||
|
||||
task testRhinoBase(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--relative-urls' ]
|
||||
}
|
||||
|
||||
task testRhinoDebugAll(type: DebugRhinoTest) {
|
||||
options = [ '--strict-math=true', '--line-numbers=all' ]
|
||||
testDir = 'debug' + fs
|
||||
suffix = "-all"
|
||||
}
|
||||
|
||||
task testRhinoDebugComments(type: DebugRhinoTest) {
|
||||
options = [ '--strict-math=true', '--line-numbers=comments' ]
|
||||
testDir = 'debug' + fs
|
||||
suffix = "-comments"
|
||||
}
|
||||
|
||||
task testRhinoDebugMediaquery(type: DebugRhinoTest) {
|
||||
options = [ '--strict-math=true', '--line-numbers=mediaquery' ]
|
||||
testDir = 'debug' + fs
|
||||
suffix = "-mediaquery"
|
||||
}
|
||||
|
||||
task testRhinoErrors(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--strict-units=true' ]
|
||||
testDir = 'errors/'
|
||||
expectErrors = true
|
||||
}
|
||||
|
||||
task testRhinoChyby(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--strict-units=true' ]
|
||||
testDir = 'chyby/'
|
||||
// expectErrors = true
|
||||
}
|
||||
|
||||
task testRhinoNoJsError(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--strict-units=true', '--no-js' ]
|
||||
testDir = 'no-js-errors/'
|
||||
expectErrors = true
|
||||
}
|
||||
|
||||
task testRhinoLegacy(type: RhinoTest) {
|
||||
testDir = 'legacy/'
|
||||
}
|
||||
|
||||
task testRhinoStaticUrls(type: RhinoTest) {
|
||||
options = [ '--strict-math=true', '--rootpath=folder (1)/' ]
|
||||
testDir = 'static-urls/'
|
||||
}
|
||||
|
||||
task testRhinoCompression(type: RhinoTest) {
|
||||
options = [ '--compress=true' ]
|
||||
testDir = 'compression/'
|
||||
}
|
||||
|
||||
task testRhinoSourceMap(type: SourceMapRhinoTest) {
|
||||
options = [ '--strict-math=true', '--strict-units=true']
|
||||
testDir = 'sourcemaps/'
|
||||
}
|
||||
|
||||
task setupTest {
|
||||
dependsOn combineJs
|
||||
doLast {
|
||||
file(testOut).deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
task clean << {
|
||||
file(rhinoTestSrc).delete()
|
||||
file(testOut).deleteDir()
|
||||
}
|
||||
|
||||
class SourceMapRhinoTest extends RhinoTest {
|
||||
|
||||
// helper to get the output map file
|
||||
def getOutputMap(lessFile) {
|
||||
def outFile = project.file(lessFile.path.replace('test/less', project.testOut).replace('.less', '.css'))
|
||||
return project.file(outFile.path + ".map");
|
||||
}
|
||||
|
||||
// callback to add SourceMap options to the options list
|
||||
def postProcessOptions(options, lessFile) {
|
||||
def outFile = getOutputMap(lessFile)
|
||||
project.file(outFile.parent).mkdirs()
|
||||
options << "--source-map=${testDir}${lessFile.name.replace('.less','.css')}"
|
||||
options << "--source-map-basepath=${lessRootDir}"
|
||||
options << "--source-map-rootpath=testweb/"
|
||||
options << "--source-map-output-map-file=${outFile}"
|
||||
|
||||
options
|
||||
}
|
||||
|
||||
// Callback to validate output
|
||||
def handleResult(exec, out, lessFile) {
|
||||
def actualFile = getOutputMap(lessFile)
|
||||
def expectedFile = project.file(projectDir + fs + "test" + fs + testDir + fs + lessFile.name.replace(".less", ".json"))
|
||||
assert actualFile.text == expectedFile.text
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DebugRhinoTest extends RhinoTest {
|
||||
|
||||
def escapeIt(it) {
|
||||
return it.replaceAll("\\\\", "\\\\\\\\").replaceAll("/", "\\\\/").replaceAll(":", "\\\\:").replaceAll("\\.", "\\\\.");
|
||||
}
|
||||
|
||||
def globalReplacements(input, directory) {
|
||||
def pDirectory = toPlatformFs(directory)
|
||||
def p = lessRootDir + fs + pDirectory
|
||||
def pathimport = p + toPlatformFs("import/")
|
||||
def pathesc = escapeIt(p)
|
||||
def pathimportesc = escapeIt(pathimport)
|
||||
|
||||
def result = input.replace("{path}", p).replace("{pathesc}", pathesc).replace("{pathimport}", pathimport)
|
||||
return result.replace("{pathimportesc}", pathimportesc).replace("\r\n", "\n")
|
||||
}
|
||||
}
|
||||
|
||||
class RhinoTest extends DefaultTask {
|
||||
|
||||
RhinoTest() {
|
||||
dependsOn 'setupTest'
|
||||
}
|
||||
|
||||
def suffix = ""
|
||||
def testDir = ''
|
||||
def options = []
|
||||
def expectErrors = false
|
||||
def fs = File.separator;
|
||||
def projectDir = toUpperCaseDriveLetter(System.getProperty("user.dir"));
|
||||
def lessRootDir = projectDir + fs + "test" + fs + "less"
|
||||
|
||||
def toUpperCaseDriveLetter(path) {
|
||||
if (path.charAt(1)==':' && path.charAt(2)=='\\') {
|
||||
return path.substring(0,1).toUpperCase() + path.substring(1);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
def toPlatformFs(path) {
|
||||
return path.replace('\\', fs).replace('/', fs);
|
||||
}
|
||||
|
||||
def expectedCssPath(lessFilePath) {
|
||||
lessFilePath.replace('.less', "${suffix}.css").replace("${fs}less${fs}", "${fs}css${fs}");
|
||||
}
|
||||
|
||||
def globalReplacements(input, directory) {
|
||||
return input;
|
||||
}
|
||||
|
||||
def stylize(str, style) {
|
||||
def styles = [
|
||||
reset : [0, 0],
|
||||
bold : [1, 22],
|
||||
inverse : [7, 27],
|
||||
underline : [4, 24],
|
||||
yellow : [33, 39],
|
||||
green : [32, 39],
|
||||
red : [31, 39],
|
||||
grey : [90, 39]
|
||||
];
|
||||
return '\033[' + styles[style][0] + 'm' + str +
|
||||
'\033[' + styles[style][1] + 'm';
|
||||
}
|
||||
|
||||
// Callback for subclasses to make any changes to the options
|
||||
def postProcessOptions(options, lessFile) {
|
||||
options
|
||||
}
|
||||
|
||||
// Callback to validate output
|
||||
def handleResult(exec, out, lessFile) {
|
||||
def actual = out.toString().trim()
|
||||
def actualResult = project.file(lessFile.path.replace('test/less', project.testOut).replace('.less', '.css'))
|
||||
project.file(actualResult.parent).mkdirs()
|
||||
actualResult << actual
|
||||
def expected
|
||||
if (expectErrors) {
|
||||
assert exec.exitValue != 0
|
||||
expected = project.file(lessFile.path.replace('.less', '.txt')).text.trim().
|
||||
replace('{path}', lessFile.parent + '/').
|
||||
replace('{pathhref}', '').
|
||||
replace('{404status}', '')
|
||||
} else {
|
||||
assert exec.exitValue == 0
|
||||
def expectedFile = expectedCssPath(lessFile.path)
|
||||
expected = project.file(expectedFile).text.trim()
|
||||
expected = globalReplacements(expected, testDir)
|
||||
}
|
||||
actual=actual.trim()
|
||||
actual = actual.replace('\r\n', '\n')
|
||||
expected = expected.replace('\r\n', '\n')
|
||||
actual = actual.replace("/","\\")
|
||||
expected = expected.replace("/","\\")
|
||||
// println "* actual *"
|
||||
// println actual
|
||||
// new File("actual.txt").write(actual)
|
||||
// println "* expected *"
|
||||
// println expected
|
||||
// new File("expected.txt").write(expected)
|
||||
assert actual == expected
|
||||
actualResult.delete()
|
||||
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
def runTest() {
|
||||
int testSuccesses = 0, testFailures = 0, testErrors = 0
|
||||
project.file('test/less/' + testDir).eachFileMatch(FileType.FILES, ~/.*\.less/) { lessFile ->
|
||||
println "lessfile: $lessFile"
|
||||
if (!project.hasProperty('test') || lessFile.name.startsWith(project.test)) {
|
||||
def out = new java.io.ByteArrayOutputStream()
|
||||
def processedOptions = postProcessOptions([project.rhinoTestSrc, lessFile] + options, lessFile)
|
||||
def execOptions = {
|
||||
main = 'org.mozilla.javascript.tools.shell.Main'
|
||||
// main = 'org.mozilla.javascript.tools.debugger.Main'
|
||||
classpath = project.configurations.rhino
|
||||
args = processedOptions
|
||||
standardOutput = out
|
||||
ignoreExitValue = true
|
||||
}
|
||||
println "rhinoTestSrc: ${project.rhinoTestSrc}"
|
||||
try {
|
||||
def exec = project.javaexec(execOptions)
|
||||
handleResult(exec, out, lessFile)
|
||||
testSuccesses++
|
||||
println stylize(' ok', 'green')
|
||||
}
|
||||
catch (ex) {
|
||||
println ex
|
||||
println()
|
||||
testErrors++;
|
||||
}
|
||||
catch (AssertionError ae) {
|
||||
println stylize(' failed', 'red')
|
||||
println ae
|
||||
testFailures++
|
||||
}
|
||||
} else {
|
||||
println stylize(' skipped', 'yellow')
|
||||
}
|
||||
}
|
||||
println stylize(testSuccesses + ' ok', 'green')
|
||||
println stylize(testFailures + ' assertion failed', testFailures == 0 ? 'green' : 'red')
|
||||
println stylize(testErrors + ' errors', testErrors == 0 ? 'green' : 'red')
|
||||
if (testFailures != 0 || testErrors != 0) {
|
||||
project.failures++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AllRhinoTests extends DefaultTask {
|
||||
|
||||
AllRhinoTests() {
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
def runTest() {
|
||||
println stylize(project.failures + ' test suites failed', project.failures == 0 ? 'green' : 'red')
|
||||
}
|
||||
|
||||
def stylize(str, style) {
|
||||
def styles = [
|
||||
reset : [0, 0],
|
||||
bold : [1, 22],
|
||||
inverse : [7, 27],
|
||||
underline : [4, 24],
|
||||
yellow : [33, 39],
|
||||
green : [32, 39],
|
||||
red : [31, 39],
|
||||
grey : [90, 39]
|
||||
];
|
||||
return '\033[' + styles[style][0] + 'm' + str +
|
||||
'\033[' + styles[style][1] + 'm';
|
||||
}
|
||||
}
|
||||
|
||||
class GruntTask extends Exec {
|
||||
private String gruntExecutable = Os.isFamily(Os.FAMILY_WINDOWS) ? "grunt.cmd" : "grunt"
|
||||
private String switches = "--no-color"
|
||||
|
||||
String gruntArgs = ""
|
||||
|
||||
public GruntTask() {
|
||||
super()
|
||||
this.setExecutable(gruntExecutable)
|
||||
}
|
||||
|
||||
public void setGruntArgs(String gruntArgs) {
|
||||
this.args = "$switches $gruntArgs".trim().split(" ") as List
|
||||
}
|
||||
}
|
||||
|
||||
-2695
File diff suppressed because it is too large
Load Diff
-16
File diff suppressed because one or more lines are too long
-2710
File diff suppressed because it is too large
Load Diff
-16
File diff suppressed because one or more lines are too long
-2712
File diff suppressed because it is too large
Load Diff
-16
File diff suppressed because one or more lines are too long
-2721
File diff suppressed because it is too large
Load Diff
-16
File diff suppressed because one or more lines are too long
-2769
File diff suppressed because it is too large
Load Diff
-16
File diff suppressed because one or more lines are too long
-2805
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3004
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3293
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3318
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3337
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-3478
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-4011
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-4401
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-4413
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-5830
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
-5830
File diff suppressed because it is too large
Load Diff
-11
File diff suppressed because one or more lines are too long
-5837
File diff suppressed because it is too large
Load Diff
-11
File diff suppressed because one or more lines are too long
-5837
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user