diff --git a/awx/ui/static/lib/less.js/.bower.json b/awx/ui/static/lib/less.js/.bower.json new file mode 100644 index 0000000000..2f972e55fc --- /dev/null +++ b/awx/ui/static/lib/less.js/.bower.json @@ -0,0 +1,29 @@ +{ + "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 +} \ No newline at end of file diff --git a/awx/ui/static/lib/less.js/build.gradle b/awx/ui/static/lib/less.js/build.gradle new file mode 100644 index 0000000000..7042b929a4 --- /dev/null +++ b/awx/ui/static/lib/less.js/build.gradle @@ -0,0 +1,347 @@ +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 + } +} + diff --git a/awx/ui/static/lib/less.js/gradle/wrapper/gradle-wrapper.jar b/awx/ui/static/lib/less.js/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..667288ad6c Binary files /dev/null and b/awx/ui/static/lib/less.js/gradle/wrapper/gradle-wrapper.jar differ diff --git a/awx/ui/static/lib/less.js/gradle/wrapper/gradle-wrapper.properties b/awx/ui/static/lib/less.js/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..2d919c8018 --- /dev/null +++ b/awx/ui/static/lib/less.js/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#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 diff --git a/awx/ui/static/lib/less.js/gradlew b/awx/ui/static/lib/less.js/gradlew new file mode 100755 index 0000000000..91a7e269e1 --- /dev/null +++ b/awx/ui/static/lib/less.js/gradlew @@ -0,0 +1,164 @@ +#!/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 "$@" diff --git a/awx/ui/static/lib/less.js/gradlew.bat b/awx/ui/static/lib/less.js/gradlew.bat new file mode 100644 index 0000000000..aec99730b4 --- /dev/null +++ b/awx/ui/static/lib/less.js/gradlew.bat @@ -0,0 +1,90 @@ +@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