rlm@0
|
1 ":";exec java -verbose:gc -Xmn500M -Xms1500M -Xmx1500M -server -cp $HOME/roBin/src:$HOME/mobius/src:$HOME/roBin/lib/*:$HOME/Genesis/src:$HOME/mobius/assets:$HOME/mobius/monkey-lib/*:$HOME/workspace/Gauntlet/binary:$HOME/workspace/Clips/bin:$HOME/workspace/Propagators/bin -Djava.library.path=$HOME/roBin/natives/linux clojure.main $0 $*;
|
rlm@0
|
2
|
rlm@0
|
3
|
rlm@0
|
4
|
rlm@0
|
5 (ns rlm.push
|
rlm@0
|
6 (:gen-class
|
rlm@0
|
7 :name rlm.push
|
rlm@0
|
8 :main true)
|
rlm@0
|
9 (:use [clojure.contrib
|
rlm@0
|
10 [duck-streams :only [file-str]]
|
rlm@0
|
11 command-line str-utils shell-out]
|
rlm@0
|
12 [rlm shell-write
|
rlm@0
|
13 [shell-inspect :only [command-line?]]]))
|
rlm@0
|
14
|
rlm@0
|
15
|
rlm@0
|
16 (def laserkard ["/home/r/Desktop/web/laserkard"
|
rlm@0
|
17 "/home/r/lasercutter"
|
rlm@0
|
18 "/home/r/laser-files"
|
rlm@0
|
19 "/home/r/emc2"])
|
rlm@0
|
20
|
rlm@0
|
21 (def moonlitnights ["/home/r/Desktop/web/moonlitnights"])
|
rlm@0
|
22
|
rlm@0
|
23 (def judyates ["/home/r/Desktop/web/judyates"])
|
rlm@0
|
24
|
rlm@0
|
25 (def rlmcintyre ["/home/r/Desktop/web/rlmcintyre",
|
rlm@0
|
26 "/home/r/Desktop/web/boosterpack"
|
rlm@0
|
27 "/home/r/Desktop/web/lib"])
|
rlm@0
|
28
|
rlm@0
|
29 (def bortreb ["/home/r/Desktop/web/bortreb"])
|
rlm@0
|
30
|
rlm@0
|
31 (def aurellem ["/home/r/aurellem/site-output"])
|
rlm@0
|
32
|
rlm@0
|
33 (def mit ["/home/r/Desktop/MIT"])
|
rlm@0
|
34
|
rlm@0
|
35
|
rlm@0
|
36 (def config
|
rlm@0
|
37 ["/home/r/.swank-all-repl"
|
rlm@0
|
38 "/home/r/.clojure_completions"
|
rlm@0
|
39 "/home/r/swank-all"
|
rlm@0
|
40 "/home/r/Desktop/web/web.clj"
|
rlm@0
|
41 "/etc/lighttpd/lighttpd.conf"
|
rlm@0
|
42 "/home/r/.lightpasswords"
|
rlm@0
|
43 "/home/r/.profile"
|
rlm@0
|
44 "/home/r/.xmodmap.clojure"
|
rlm@0
|
45 "/home/r/.xmodmap.xmonad"
|
rlm@0
|
46 "/home/r/.xmodmap.normal"
|
rlm@0
|
47 "/etc/hosts"
|
rlm@0
|
48 "/home/r/Desktop/web/swank-web"
|
rlm@0
|
49 "/etc/mercurial/hgrc"
|
rlm@0
|
50 "/home/r/.hgrc"
|
rlm@0
|
51 "/home/r/.emacs"
|
rlm@0
|
52 "/home/r/.emacs.d"
|
rlm@0
|
53 "/home/r/.bashrc"
|
rlm@0
|
54 "/home/r/.el"
|
rlm@0
|
55 "/home/r/.blender"
|
rlm@0
|
56 ])
|
rlm@0
|
57
|
rlm@0
|
58
|
rlm@0
|
59 (def admin
|
rlm@0
|
60 ["/home/r/Desktop/sliceHost_Admin"
|
rlm@0
|
61 "/home/r/Desktop/judyates_admin"
|
rlm@0
|
62 "/home/r/Desktop/laserkard_admin"
|
rlm@0
|
63 "/home/r/Desktop/moonlitnights_admin"])
|
rlm@0
|
64
|
rlm@0
|
65 (def genesis
|
rlm@0
|
66 [;;"/home/r/Desktop/GenesisOutput"
|
rlm@0
|
67 "/home/r/Jake2"
|
rlm@0
|
68 ;;"/home/r/workspace" --- removed because it interferes with eclipse's
|
rlm@0
|
69 ;; color settings. Stupid eclipse.
|
rlm@0
|
70 "/home/r/Genesis"
|
rlm@0
|
71 ;;"/home/r/eclipse" --- also interfers with eclipse's stupid colors.
|
rlm@0
|
72 ;;"/home/r/telmo"
|
rlm@0
|
73 ;;"/home/r/sajit"
|
rlm@0
|
74 ])
|
rlm@0
|
75
|
rlm@0
|
76 (def projects
|
rlm@0
|
77 ["/home/r/aurellem"
|
rlm@0
|
78 "/home/r/cortex"
|
rlm@0
|
79 "/home/r/mobius"
|
rlm@0
|
80 "/home/r/roBin"
|
rlm@0
|
81 "/home/r/openal-soft"
|
rlm@0
|
82 "/home/r/Desktop/web"])
|
rlm@0
|
83
|
rlm@0
|
84 (defn rsync-string [#^java.io.File file]
|
rlm@0
|
85 (if (.isFile file)
|
rlm@0
|
86 (.getPath file)
|
rlm@0
|
87 (str (.getPath file) "/")))
|
rlm@0
|
88
|
rlm@0
|
89
|
rlm@0
|
90 (defn rsync-one [destination #^java.io.File file]
|
rlm@0
|
91 (let
|
rlm@0
|
92 [command
|
rlm@0
|
93 ["rsync" "-avzhO" "--delete" "--relative" (str "/." (rsync-string file)) destination ]]
|
rlm@0
|
94 (println command)
|
rlm@0
|
95 ;(apply sw command)
|
rlm@0
|
96 command
|
rlm@0
|
97 ))
|
rlm@0
|
98
|
rlm@0
|
99
|
rlm@0
|
100 (defn rsync [destination args]
|
rlm@0
|
101 (doall (map (partial rsync-one destination) (map file-str args))))
|
rlm@0
|
102
|
rlm@0
|
103 (def destinations {"slice" "r@173.203.202.72:/"
|
rlm@0
|
104 "rlm" "r@10.0.0.2:/"
|
rlm@0
|
105 "sphere" "/home/r/sphere"
|
rlm@0
|
106 })
|
rlm@0
|
107
|
rlm@0
|
108
|
rlm@0
|
109
|
rlm@0
|
110 (defn push-gen [& args]
|
rlm@0
|
111 (with-command-line args
|
rlm@0
|
112 "Push Files from this Computer to others."
|
rlm@0
|
113 [[all? a? "Update everything. (except genesis and admin)" false]
|
rlm@0
|
114 [l? laserkard? "laserkard source" false]
|
rlm@0
|
115 [m? moonlitnights? "moonlitnights source" false]
|
rlm@0
|
116 [j? judyates? "judyates source" false]
|
rlm@0
|
117 [r? rlmcintyre? "rlmcintyre source" false]
|
rlm@0
|
118 [b? bortreb? "bortreb repository source" false]
|
rlm@0
|
119 [c? config? "webserver config files" false]
|
rlm@0
|
120 [d? admin? "website admin folders" false]
|
rlm@0
|
121 [g? genesis? "genesis" false]
|
rlm@0
|
122 [p? projects? "roBin, aurellem, mobius" false]
|
rlm@0
|
123 [e? everything? "absolutely everything" false]
|
rlm@0
|
124 [k? mit? "MIT" false]
|
rlm@0
|
125 [u? aurellem? "aurellem SITE"]
|
rlm@0
|
126 [target t
|
rlm@0
|
127 (str "Target computer. mappings are " destinations " or any ipv4 ip address")
|
rlm@0
|
128 "rlm"]]
|
rlm@0
|
129
|
rlm@0
|
130 (if e? (into (push-gen "-g" "-d" "-k" "-t" target) (push-gen "-a" "-t" target))
|
rlm@0
|
131 (if all?
|
rlm@0
|
132 (push-gen "-l" "-m" "-j" "-r" "-b" "-c" "-p" "-u" "-t" target)
|
rlm@0
|
133 (let [target (get destinations target (str "r@" target ":/"))]
|
rlm@0
|
134
|
rlm@0
|
135 (map (partial str-join " ")
|
rlm@0
|
136 (reduce into
|
rlm@0
|
137 (filter
|
rlm@0
|
138 (comp not nil?)
|
rlm@0
|
139 [
|
rlm@0
|
140 (if u? (rsync target aurellem) nil)
|
rlm@0
|
141 (if k? (rsync target mit) nil)
|
rlm@0
|
142 (if l? (rsync target laserkard) nil)
|
rlm@0
|
143 (if m? (rsync target moonlitnights) nil)
|
rlm@0
|
144 (if j? (rsync target judyates) nil)
|
rlm@0
|
145 (if r? (rsync target rlmcintyre) nil)
|
rlm@0
|
146 (if b? (rsync target bortreb) nil)
|
rlm@0
|
147 (if c? (rsync target config) nil)
|
rlm@0
|
148 (if d? (rsync target admin) nil)
|
rlm@0
|
149 (if g? (rsync target genesis) nil)
|
rlm@0
|
150 (if p? (rsync target projects) nil)]))))))))
|
rlm@0
|
151
|
rlm@0
|
152 (defn push [& args]
|
rlm@0
|
153 (let [commands (apply push-gen args)]
|
rlm@0
|
154 (if (not (nil? commands))
|
rlm@0
|
155 (dorun (map sw commands)))))
|
rlm@0
|
156
|
rlm@0
|
157 (if (command-line?)
|
rlm@0
|
158 (apply push *command-line-args*))
|
rlm@0
|
159
|
rlm@0
|
160
|