Przeglądaj źródła

Upgrade tservice to 0.6.0.

master
YJC 3 lat temu
rodzic
commit
e076383190
5 zmienionych plików z 14 dodań i 6 usunięć
  1. +2
    -3
      project.clj
  2. +1
    -0
      resources/config/README.md
  3. +3
    -0
      resources/tservice-plugin.yaml
  4. +2
    -2
      src/tservice/plugins/xps2pdf.clj
  5. +6
    -1
      src/tservice/plugins/xps2pdf/xps.clj

+ 2
- 3
project.clj Wyświetl plik

@@ -10,8 +10,7 @@
[[org.clojure/data.csv "1.0.0"]
[me.raynes/fs "1.4.6"]
[org.clojure/tools.logging "1.1.0"]
[org.clojure/core.async "0.4.500"
:exclusions [org.clojure/tools.reader]]]
[pdfboxing/pdfboxing "0.1.14"]]

:plugins [[lein-codox "0.10.7"]]

@@ -22,7 +21,7 @@
{:provided
{:dependencies
[[org.clojure/clojure "1.10.1"]
[org.clojars.yjcyxky/tservice "0.5.8"]]}
[org.clojars.yjcyxky/tservice "0.6.0"]]}

:uberjar
{:auto-clean true

+ 1
- 0
resources/config/README.md Wyświetl plik

@@ -0,0 +1 @@
# This is a test

+ 3
- 0
resources/tservice-plugin.yaml Wyświetl plik

@@ -16,6 +16,9 @@ plugin:
display-name: XPS to PDF
lazy-load: false
init:
- step: unpack-env
envname: config
envtype: 'configuration'
- step: unpack-env
envname: xps2pdf
- step: load-namespace

+ 2
- 2
src/tservice/plugins/xps2pdf.clj Wyświetl plik

@@ -46,7 +46,7 @@
(make-plugin-metadata
{:name "xps2pdf"
:params-schema xps2pdf-params-body
:handler (fn [{:keys [filepath]}]
:handler (fn [{:keys [filepath plugin-env]}]
(let [tservice-workdir (get-tservice-workdir)
from-path (if (re-matches #"^file:\/\/\/.*" filepath)
; Absolute path with file://
@@ -89,7 +89,7 @@
pdf-path (fs-lib/join-paths to-dir "merged.pdf")]
(doall (pmap #(xps2pdf! %1 %2) from-files to-files))
(fs-lib/zip-files to-files zip-path)
(fs-lib/merge-pdf-files to-files pdf-path)))
(xps-lib/merge-pdf-files to-files pdf-path)))

;;; --------------------------------------------------- Lifecycle ----------------------------------------------------


+ 6
- 1
src/tservice/plugins/xps2pdf/xps.clj Wyświetl plik

@@ -3,6 +3,7 @@
(:require [clojure.java.shell :as shell]
[tservice.lib.files :refer [get-plugin-dir get-path-variable]]
[tservice.lib.fs :as fs]
[pdfboxing.merge :as pdf]
[clojure.tools.logging :as log]
[clojure.string :as str]))

@@ -73,4 +74,8 @@
"Dispatch to different function."
[{:keys [input output type]}]
(println "Convert XPS to" (str/upper-case type) ":" input)
(((keyword type) command-map) input output))
(((keyword type) command-map) input output))

(defn merge-pdf-files
[from-files to-filepath]
(pdf/merge-pdfs :input from-files :output to-filepath))

Ładowanie…
Anuluj
Zapisz