Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
skuro committed May 9, 2019
2 parents 92c490d + 8503f9d commit b3cfafb
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ version: 2.0
default: &default-steps
steps:
- checkout
- run:
# Note: this makes it hard to reproduce builds but easier to spot incompatibilities with
# newer PlantUML releases. Current trade off seems acceptable.
name: Download the latest PlantUML release
command: sh ./bin/download-plantuml.sh
- run:
name: Update APT packages
command: apt-get update
Expand Down
17 changes: 17 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 10
# Issues with these labels will never be considered stale
exemptLabels:
- help-wanted
- enhancement
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Also, to enable preview you need to tell `plantuml-mode` where to locate the Pla
M-x customize-variable<RET>
plantuml-jar-path<RET>

You can also download the latest version of PlantUML straight into `plantuml-jar-path`:

M-x plantuml-download-jar<RET>

# Features

- Syntax highlight
Expand Down
20 changes: 20 additions & 0 deletions bin/download-plantuml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

# Where the script is executed
CURRENT_PATH="$(dirname "$(readlink -f "$0")")"

# Where to download the file
OUTPUT_PATH="${CURRENT_PATH}/plantuml.jar"

# Retrieve the list of versions, in XML format, only one result (the latest)
VERSIONS_URL='https://search.maven.org/solrsearch/select?q=g:net.sourceforge.plantuml+AND+a:plantuml&core=gav&start=0&rows=1&wt=xml'

# Only match the contents of the version (name="v") XML tag
LATEST_VERSION="$(curl -s "${VERSIONS_URL}" | grep -oP '(?<=<str name="v">).*(?=</str>)')"

# Compose the download link
DOWNLOAD_URL="https://search.maven.org/remotecontent?filepath=net/sourceforge/plantuml/plantuml/${LATEST_VERSION}/plantuml-${LATEST_VERSION}.jar"

# finally, download the JAR file
echo "Downloading PlantUML v${LATEST_VERSION} into ${OUTPUT_PATH}"
curl -so "${OUTPUT_PATH}" "${DOWNLOAD_URL}" 2>/dev/null
Binary file removed bin/plantuml.jar
Binary file not shown.
27 changes: 27 additions & 0 deletions plantuml-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

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

(defgroup plantuml-mode nil
"Major mode for editing plantuml file."
Expand Down Expand Up @@ -163,6 +165,31 @@
(insert msg)
(insert "\n"))))))

(defun plantuml-download-jar ()
"Download the latest PlantUML JAR file and install it into `plantuml-jar-path'."
(interactive)
(if (y-or-n-p (format "Download the latest PlantUML JAR file into %s? " plantuml-jar-path))
(if (or (not (file-exists-p plantuml-jar-path))
(y-or-n-p (format "The PlantUML jar file already exists at %s, overwrite? " plantuml-jar-path)))
(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")
(mkdir (file-name-directory plantuml-jar-path) t)
(let* ((parse-tree (xml-parse-region))
(doc (->> parse-tree
(assq 'response)
(assq 'result)
(assq 'doc)))
(strs (xml-get-children doc 'str))
(version (->> strs
(--filter (string-equal "v" (xml-get-attribute it 'name)))
(first)
(xml-node-children)
(first))))
(message (concat "Downloading PlantUML v" version " into " plantuml-jar-path))
(url-copy-file (format "https://search.maven.org/remotecontent?filepath=net/sourceforge/plantuml/plantuml/%s/plantuml-%s.jar" version version) plantuml-jar-path)
(kill-buffer))
(message "Aborted.")))
(message "Aborted.")))

(defun plantuml-init ()
"Initialize the keywords or builtins from the cmdline language output."
(unless (or (eq system-type 'cygwin) (file-exists-p plantuml-jar-path))
Expand Down

0 comments on commit b3cfafb

Please sign in to comment.