diff --git a/README.md b/README.md index 7dd0bfd..e466c10 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ You create tags (pretty looking names for local directories) and tag your remote Current Release --- -Current release version is `0.0.8`. It will do what its supposed to do, but it has a long way to go. +Current release version is `0.0.9`. It will do what its supposed to do, but it has a long way to go. -[Download Now](https://github.com/verma/dakait/releases/download/0.0.8/dakait-0.0.8-standalone.jar) +[Download Now](https://github.com/verma/dakait/releases/download/0.0.9/dakait-0.0.9-standalone.jar) How to run --- @@ -19,7 +19,7 @@ You need a configuration file to run Dakait. Modify and rename `config.example. Once you have the jar file, make sure your server has a recent enough version of java. You can start the server by running the following command - java -jar dakait-0.0.8-standalone.jar + java -jar dakait-0.0.9-standalone.jar This will start a server and bind to port `3000`. Now point your browser to `http://server-address:3000/` diff --git a/project.clj b/project.clj index 07467ab..8d9d3c6 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject dakait "0.0.8" +(defproject dakait "0.0.9" :description "A tool to download files from your FTP/SFTP servers in an organized way." :url "https://github.com/verma/dakait" :dependencies [[org.clojure/clojure "1.5.1"] diff --git a/src-cljs/index/start.cljs b/src-cljs/index/start.cljs index 35119d8..932e7ff 100644 --- a/src-cljs/index/start.cljs +++ b/src-cljs/index/start.cljs @@ -331,7 +331,7 @@ cd ($ ".current-downloads") nd ($ ".nodownloads") active (.-active data) - queued (.-pending data) + pending (.-pending data) num-items (count active) filename #(->> (clojure.string/split % #"/") (remove empty?) diff --git a/src/dakait/downloader.clj b/src/dakait/downloader.clj index 4f687ce..54d4712 100644 --- a/src/dakait/downloader.clj +++ b/src/dakait/downloader.clj @@ -95,8 +95,7 @@ (let [state-map (update-to-map line)] (info "source key: " src) (info "download state map: " state-map) - (reset! download-states - (assoc @download-states src state-map))))) + (swap! download-states assoc src state-map)))) (info "Process ended") (sh/exit-code p)) (catch Exception e @@ -153,7 +152,7 @@ "Start a download for the given file" [src dest] (info "Queuing download, source: " src ", destination: " dest) - (reset! download-queue (conj @download-queue [src dest]))) + (swap! download-queue conj [src dest])) (defn run "Run the downloader loop" diff --git a/src/dakait/files.clj b/src/dakait/files.clj index 8c39b63..c126df7 100644 --- a/src/dakait/files.clj +++ b/src/dakait/files.clj @@ -29,16 +29,18 @@ session invalidation is reset, when the reset invalidation expires the ssh session is invalidated and set to nil" [] - (when-not (nil? @session-invalidator) - (future-cancel @session-invalidator)) - (reset! session-invalidator - (future - (Thread/sleep 120000) - (info "Invalidating session") - (let [s @ssh-session] - (reset! ssh-session nil) - (reset! session-invalidator nil) - (ssh/disconnect s))))) + (swap! session-invalidator + (fn [si] + (when-not (nil? si) + (future-cancel si)) + (future + (Thread/sleep 120000) + (info "Invalidating session") + (swap! ssh-session (fn [s] + (ssh/disconnect s) + nil)) + (reset! session-invalidator nil))))) + (defn- session [] "Get the currently active session, if one doesn't exist, create a new one and make sure the diff --git a/src/dakait/handler.clj b/src/dakait/handler.clj index f498b51..a30f97f 100644 --- a/src/dakait/handler.clj +++ b/src/dakait/handler.clj @@ -107,16 +107,6 @@ (as-json {:active (downloads-in-progress) :pending (map (fn [d] {:from (first d) :to (second d)}) (downloads-pending))})) -(defn handle-active-downloads2 [] - (as-json {:active [{:from "/some/really/long/path/and/then/the/longest/path/ever/seriously" :to "/some/really/really/really/really/long path"} - {:from "/some/really/long/path" :to "/some/really/really/really/really/long path"} - {:from "/some/really/long/path" :to "/some/really/really/really/really/long path"} - {:from "/some/really/long/path" :to "/some/really/really/really/really/long path"}] - :pending [ - {:from "/some/really/long/path" :to "/some/really/really/really/really/long path"} - {:from "/some/really/long/path" :to "/some/really/really/really/really/long path"} - {:from "/some/really/long/path" :to "/some/really/really/really/really/long path"}]})) - (defroutes app-routes (GET "/" [] (index-page)) (GET "/tags" [] (tags-page))