Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
502 additions
and
130 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
103 changes: 103 additions & 0 deletions
103
netbeans/plugins/org-enclojure-plugin/scripts/zip_projects.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
(ns build.zip-projects | ||
(:require | ||
[clojure.contrib.duck-streams :as duck-streams] | ||
[clojure.contrib.java-utils :as java-utils] | ||
[org.enclojure.commons.c-slf4j :as logger] | ||
[org.enclojure.repl.main :as repl.main] | ||
) | ||
(:import [java.util.zip ZipOutputStream ZipEntry] | ||
[java.io File FileOutputStream FileInputStream] | ||
[java.util.logging Logger Level] | ||
[java.io PipedOutputStream PipedInputStream LineNumberReader InputStreamReader File] | ||
[org.apache.commons.exec CommandLine ExecuteResultHandler | ||
PumpStreamHandler DefaultExecutor ExecuteException ExecuteWatchdog] | ||
)) | ||
|
||
; setup logging | ||
(logger/ensure-logger) | ||
|
||
(def *src-base-dir* (str (System/getProperty "user.dir") | ||
"/../../../templates/netbeans")) | ||
(def *dest-base-dir* (str (System/getProperty "user.dir") | ||
"/src/main/resources/org/enclojure/ide")) | ||
|
||
(def *src-project-templates-dir* (str *src-base-dir* "/ProjectTemplates")) | ||
(def *src-project-samples-dir* (str *src-base-dir* "/SampleProjects")) | ||
(def *filter-files* [".jar" "/private" ".class" "/classes"]) | ||
|
||
(def *dest-project-templates-dir* (str *dest-base-dir* "/templates/project")) | ||
(def *dest-project-samples-dir* (str *dest-base-dir* "/project/samples")) | ||
|
||
(defn get-directories [path] | ||
(filter #(.isDirectory %) | ||
(vec (.listFiles (java-utils/file path))))) | ||
|
||
(defn process-completed [exit-value] | ||
(println "Process terminated: {}" exit-value)) | ||
|
||
(defn process-failed3 [out-fn err-fn #^ExecuteException ex] | ||
(println (format "Process failed: %s %s" (.getMessage ex) | ||
(if-let [c (.getCause ex)] | ||
(.getMessage c))))) | ||
|
||
(defn monitor [stream read-fn] | ||
(repl.main/start-io-thread | ||
#(binding [*out* stream] | ||
(let [msg (read-fn)] | ||
(println "anything???") | ||
(print msg) | ||
(flush))) | ||
(fn [cause] | ||
(print "\nError in monitor\n")))) | ||
|
||
(defn setup-monitors [out-fn err-fn] | ||
(monitor *out* out-fn) | ||
(monitor *out* err-fn)) | ||
|
||
(defn zip-dir [dest-zip-file src-dir] | ||
(let [cmd-line (CommandLine. "zip") | ||
#^DefaultExecutor executor (DefaultExecutor.) | ||
[out-pipe err-pipe] [(PipedOutputStream.) (PipedOutputStream.)] | ||
out-pipe-reader (LineNumberReader. | ||
(InputStreamReader. (PipedInputStream. out-pipe))) | ||
err-pipe-reader (LineNumberReader. | ||
(InputStreamReader. (PipedInputStream. err-pipe))) | ||
stream-handler (PumpStreamHandler. out-pipe err-pipe)] | ||
(doall (map #(.addArgument cmd-line % true) ["-R" (str dest-zip-file) "*"])) | ||
(.setWorkingDirectory executor (if (instance? java.io.File src-dir) | ||
src-dir (java.io.File. src-dir))) | ||
(.setWatchdog executor (ExecuteWatchdog. Integer/MAX_VALUE)) | ||
(.execute executor cmd-line (proxy [ExecuteResultHandler] [] | ||
(onProcessComplete [exit-value] | ||
(process-completed exit-value)) | ||
(onProcessFailed [ex] | ||
(println ex) | ||
(println (.getCause ex)) | ||
(process-failed3 | ||
#(.readLine out-pipe-reader) | ||
#(.readLine err-pipe-reader) | ||
ex)))))) | ||
|
||
(defn zip-files [target-path | ||
src-base-dir] | ||
(let [name (.getName (java-utils/file src-base-dir)) | ||
full-target (File. (str target-path "/" name) | ||
(str name ".zip"))] | ||
(when (.exists full-target) | ||
(.delete full-target)) | ||
(.mkdirs (java-utils/file (str target-path "/" name))) | ||
(zip-dir full-target src-base-dir))) | ||
|
||
(defn zip-it [target-path src-base-dir] | ||
(zip-files target-path src-base-dir)) | ||
|
||
(defn zip-project-templates [] | ||
(doall (map #(zip-it *dest-project-templates-dir* %) | ||
(get-directories *src-project-templates-dir*)))) | ||
|
||
(defn zip-project-samples [] | ||
(doall (map #(zip-it *dest-project-samples-dir* %) | ||
(get-directories *src-project-samples-dir*)))) | ||
|
||
(zip-project-templates) | ||
(zip-project-samples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file renamed
BIN
+11.8 KB
...ojureProjectTemplate-1.1-distribution.zip → ...rojectTemplate/ClojureProjectTemplate.zip
Binary file not shown.
16 changes: 0 additions & 16 deletions
16
...gin/src/main/resources/org/enclojure/ide/project/samples/RelevanceLabReplDescription.html
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+3.5 KB
...plugin/src/main/resources/org/enclojure/ide/templates/project/Clojure-1.1/Clojure-1.1.zip
Binary file not shown.
Binary file added
BIN
+3.57 KB
...sources/org/enclojure/ide/templates/project/Clojure-1.2-SNAPSHOT/Clojure-1.2-SNAPSHOT.zip
Binary file not shown.
Binary file removed
BIN
-1.84 MB
...plugin/src/main/resources/org/enclojure/ide/templates/project/RelevanceLabReplProject.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
enclojure.version.release=1.4 | ||
enclojure.version.release=1.4 |
Binary file not shown.
Oops, something went wrong.