Skip to content

Commit b3cfafb

Browse files
committed
Merge branch 'develop'
2 parents 92c490d + 8503f9d commit b3cfafb

File tree

6 files changed

+73
-0
lines changed

6 files changed

+73
-0
lines changed

.circleci/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ version: 2.0
44
default: &default-steps
55
steps:
66
- checkout
7+
- run:
8+
# Note: this makes it hard to reproduce builds but easier to spot incompatibilities with
9+
# newer PlantUML releases. Current trade off seems acceptable.
10+
name: Download the latest PlantUML release
11+
command: sh ./bin/download-plantuml.sh
712
- run:
813
name: Update APT packages
914
command: apt-get update

.github/stale.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 90
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 10
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- help-wanted
8+
- enhancement
9+
# Label to use when marking an issue as stale
10+
staleLabel: wontfix
11+
# Comment to post when marking an issue as stale. Set to `false` to disable
12+
markComment: >
13+
This issue has been automatically marked as stale because it has not had
14+
recent activity. It will be closed if no further activity occurs. Thank you
15+
for your contributions.
16+
# Comment to post when closing a stale issue. Set to `false` to disable
17+
closeComment: false

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Also, to enable preview you need to tell `plantuml-mode` where to locate the Pla
2626
M-x customize-variable<RET>
2727
plantuml-jar-path<RET>
2828

29+
You can also download the latest version of PlantUML straight into `plantuml-jar-path`:
30+
31+
M-x plantuml-download-jar<RET>
32+
2933
# Features
3034

3135
- Syntax highlight

bin/download-plantuml.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
3+
# Where the script is executed
4+
CURRENT_PATH="$(dirname "$(readlink -f "$0")")"
5+
6+
# Where to download the file
7+
OUTPUT_PATH="${CURRENT_PATH}/plantuml.jar"
8+
9+
# Retrieve the list of versions, in XML format, only one result (the latest)
10+
VERSIONS_URL='https://search.maven.org/solrsearch/select?q=g:net.sourceforge.plantuml+AND+a:plantuml&core=gav&start=0&rows=1&wt=xml'
11+
12+
# Only match the contents of the version (name="v") XML tag
13+
LATEST_VERSION="$(curl -s "${VERSIONS_URL}" | grep -oP '(?<=<str name="v">).*(?=</str>)')"
14+
15+
# Compose the download link
16+
DOWNLOAD_URL="https://search.maven.org/remotecontent?filepath=net/sourceforge/plantuml/plantuml/${LATEST_VERSION}/plantuml-${LATEST_VERSION}.jar"
17+
18+
# finally, download the JAR file
19+
echo "Downloading PlantUML v${LATEST_VERSION} into ${OUTPUT_PATH}"
20+
curl -so "${OUTPUT_PATH}" "${DOWNLOAD_URL}" 2>/dev/null

bin/plantuml.jar

-7.16 MB
Binary file not shown.

plantuml-mode.el

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
;;; Change log:
3939
;;
40+
;; version 1.2.11, 2019-04-09 Added `plantuml-download-jar'
4041
;; version 1.2.10, 2019-04-03 Avoid messing with window layouts and buffers -- courtesy of https://github.com/wailo
4142
;; version 1.2.9, Revamped indentation support, now working with a greater number of keywords
4243
;; version 1.2.8, 2019-01-07 Support indentation for activate / deactivate blocks; allow customization of `plantuml-java-args'
@@ -69,6 +70,7 @@
6970
;;; Code:
7071
(require 'thingatpt)
7172
(require 'dash)
73+
(require 'xml)
7274

7375
(defgroup plantuml-mode nil
7476
"Major mode for editing plantuml file."
@@ -163,6 +165,31 @@
163165
(insert msg)
164166
(insert "\n"))))))
165167

168+
(defun plantuml-download-jar ()
169+
"Download the latest PlantUML JAR file and install it into `plantuml-jar-path'."
170+
(interactive)
171+
(if (y-or-n-p (format "Download the latest PlantUML JAR file into %s? " plantuml-jar-path))
172+
(if (or (not (file-exists-p plantuml-jar-path))
173+
(y-or-n-p (format "The PlantUML jar file already exists at %s, overwrite? " plantuml-jar-path)))
174+
(with-current-buffer (url-retrieve-synchronously "https://search.maven.org/solrsearch/select?q=g:net.sourceforge.plantuml+AND+a:plantuml&core=gav&start=0&rows=1&wt=xml")
175+
(mkdir (file-name-directory plantuml-jar-path) t)
176+
(let* ((parse-tree (xml-parse-region))
177+
(doc (->> parse-tree
178+
(assq 'response)
179+
(assq 'result)
180+
(assq 'doc)))
181+
(strs (xml-get-children doc 'str))
182+
(version (->> strs
183+
(--filter (string-equal "v" (xml-get-attribute it 'name)))
184+
(first)
185+
(xml-node-children)
186+
(first))))
187+
(message (concat "Downloading PlantUML v" version " into " plantuml-jar-path))
188+
(url-copy-file (format "https://search.maven.org/remotecontent?filepath=net/sourceforge/plantuml/plantuml/%s/plantuml-%s.jar" version version) plantuml-jar-path)
189+
(kill-buffer))
190+
(message "Aborted.")))
191+
(message "Aborted.")))
192+
166193
(defun plantuml-init ()
167194
"Initialize the keywords or builtins from the cmdline language output."
168195
(unless (or (eq system-type 'cygwin) (file-exists-p plantuml-jar-path))

0 commit comments

Comments
 (0)