Révision 3234

tmp/org.txm.groovy.core/src/groovy/org/txm/macro/InstallAndUpdateMacroMacro.groovy (revision 3234)
26 26
if (!svnRepository.endsWith("/")) svnRepository += "/"
27 27

  
28 28
def macros = macroPaths.split(",").collect(){it.trim()}
29
	
29
def copy = []
30
copy.addAll(macros)
31
macros.clear()
32
for (def m : copy) {
33
	macros.addAll(getFiles(svnRepository, m, debug))
34
}
35

  
36

  
30 37
print "Fetching ${macros.size()} files: "
31 38
def errors = new LinkedHashMap()
32 39
def updated = []
33 40
def news = []
34 41
for (def m : macros) {
35
	def f = new File(groovyUserDirectory, m+"Macro.groovy")
42
	def f = new File(groovyUserDirectory, m)
36 43
	f.getParentFile().mkdirs()
37
	String remoteUrl = svnRepository+m+"Macro.groovy"
44
	String remoteUrl = svnRepository+m
38 45
	try {
39 46
		
40 47
		if (debug) print "\n"+remoteUrl
......
71 78
	println errors.values().join("\n\t")
72 79
}
73 80

  
81
def getFiles(def svnRepository, def m, def debug) {
82
	println "get files of $m"
83
	def files = []
84
	try {
85
		
86
		//if (debug) println content
87
		if (m.endsWith("/")) { //  || content.startsWith("<html><head><title>txm") // nag alternative
88
			if (!m.endsWith("/")) m += "/"
89
			
90
			def content = new URL(svnRepository+m).getText()
91
			
92
			content.findAll(/<li><a href="([^"]+)">([^<]+)<\/a><\/li>/) { li ->
93
				
94
						def name =  li[2]
95
						if (name != "..") {
96
							files.addAll(getFiles(svnRepository, m +name, debug))
97
							if (debug) println "add the '$name' file from '$m' content"
98
						}
99
					}
100
		} else {
101
			files << m
102
		}
103
		
104
	} catch(Exception e) { }
105
	
106
	return files
107
}
108

  
74 109
def monitorShowError(String message) {
75 110
	monitor.syncExec(new Runnable() {
76 111
		public void run() {
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompilerStep.groovy (revision 3234)
280 280
			return false;
281 281
		}
282 282
		if (nWords == 0) {
283
			println "** no words written."
283
			println "** Ignoring the empty '$textname' text (no CQP word indexed)"
284 284
		}
285
		return nWords > 0;
285
		return true;
286 286
	}
287 287
}
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImport.groovy (revision 3234)
121 121
			if (isUpdatingCorpus()) {
122 122

  
123 123
			} else {
124
				def dirToCopy = ["xsl", "css", "dtd"]
124
				def dirToCopy = ["xsl", "css", "dtd", "doc"]
125 125
				println "--- Copying subdirectories $dirToCopy"
126 126
				for (String dir : dirToCopy) {
127 127
					File origDirectory = new File(this.sourceDirectory, dir)

Formats disponibles : Unified diff