Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Change order creation require.js modules, last is now initial groovy …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
chiquitinxx committed May 22, 2015
1 parent 3cfc444 commit 955592a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ task generateGrooscriptToolsFile(type: JavaExec) {
description 'Generate grooscript-tools.js'

// Set main property to name of Groovy script class.
main = 'org.grooscript.GenerateGrooscripToolsFile'
main = 'org.grooscript.GenerateGrooscripTools'

// Set classpath for running the Groovy script.
classpath = sourceSets.main.runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ class RequireJsModulesConversion {
if (fileSolver.exists(sourceFilePath)) {
def dependencies = dependenciesSolver.processFile(sourceFilePath)
def classPath = classPathFolder(conversionOptions)
convertedFiles << generateTemplate(sourceFilePath, destinationFolder,
destinationFromFilePath(sourceFilePath, classPath), conversionOptions)
//Generate dependencies
dependencies.each {
def filePath = fileSolver.filePathFromClassName(it, classPath)
if (!convertedFiles.any { it.sourceFilePath == filePath}) {
if (filePath != sourceFilePath && !convertedFiles.any { it.sourceFilePath == filePath }) {
convertedFiles << generateTemplate(filePath, destinationFolder,
destinationFromDependency(it), conversionOptions)
}
}
//Generate initial file last one
convertedFiles << generateTemplate(sourceFilePath, destinationFolder,
destinationFromFilePath(sourceFilePath, classPath), conversionOptions)
} else {
error("File ${sourceFilePath} doesn't exists.")
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/groovy/org/grooscript/convert/TestFiles.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ class TestFiles extends Specification {
def result = GrooScript.convertRequireJs("${sourceFolder}files${SEP}Car.groovy", destinationFolder)

then:
result == [new ConvertedFile("${sourceFolder}files${SEP}Car.groovy", "files${SEP}Car.js"),
new ConvertedFile("${sourceFolder}files${SEP}Vehicle.groovy", "files${SEP}Vehicle.js"),
new ConvertedFile("${sourceFolder}files${SEP}Garage.groovy", "files${SEP}Garage.js")]
result == [new ConvertedFile("${sourceFolder}files${SEP}Vehicle.groovy", "files${SEP}Vehicle.js"),
new ConvertedFile("${sourceFolder}files${SEP}Garage.groovy", "files${SEP}Garage.js"),
new ConvertedFile("${sourceFolder}files${SEP}Car.groovy", "files${SEP}Car.js")]

folderContainsFiles("${destinationFolder}${SEP}files", ['Car.js', 'Garage.js', 'Vehicle.js'])
new File("${destinationFolder}${SEP}files${SEP}Car.js").text.
Expand Down

0 comments on commit 955592a

Please sign in to comment.