Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make sure the test image gets copied to the default location and incl…

…uded in the package
  • Loading branch information...
commit b4b042bc16484c3fdef4929ccfd1ad7f409243d5 1 parent 1ea92e6
@nicferrier authored
Showing with 29 additions and 9 deletions.
  1. +1 −0  build-parts.txt
  2. +1 −1  default-webserver-test.html
  3. +27 −8 elnode.el
View
1  build-parts.txt
@@ -6,5 +6,6 @@ elnode-db-tests.el
elnode-wiki.el
default-wiki-index.creole
default-webserver-test.html
+default-webserver-image.png
README
COPYING
View
2  default-webserver-test.html
@@ -14,7 +14,7 @@
<p>Just to show that Elnode will serve anything, here's a png:</p>
-<img src="emacs.png"/>
+<img src="default-webserver-image.png"/>
</body>
</html>
View
35 elnode.el
@@ -120,7 +120,8 @@ EmacsLisp should really provide this by default."
(substring path 0 (- (length path) 1)))))
(defun elnode--dir-setup (dir default default-file-name
- &optional target-file-name)
+ &optional target-file-name
+ &rest other-files)
"Install a DIR and DEFAULT-FILE-NAME if it's not setup already.
This is a packaging helper. It helps an ELPA package install
@@ -134,7 +135,10 @@ DEFAULT-FILE-NAME is the name of the file that will be installed
in DIR. It is the expected name of the source file inside the
package. Unless TARGET-FILE-NAME is specified it is also the
name the installed file will be given. If the TARGET-FILE-NAME
-is specified then that is the the name the file is installed as."
+is specified then that is the the name the file is installed as.
+
+If OTHER-FILES is present it is treated as a list of other
+filenames to copy to the DIR."
(when (and
(equal
dir
@@ -155,7 +159,25 @@ is specified then that is the the name the file is installed as."
(or target-file-name default-file-name))))
(make-directory dir t)
(message "copying %s elnode wiki default page to %s" dir to)
- (dired-copy-file source-default-file to nil))))))
+ (dired-copy-file source-default-file to nil)
+ (when other-files
+ (flet ((resolve-filename (file)
+ (if (file-name-absolute-p file)
+ file
+ (concat
+ (file-name-directory
+ source-default-file)
+ file))))
+ (loop for file in other-files
+ ;; does the file exist?
+ if (and file (file-exists-p (resolve-filename file)))
+ do
+ (dired-copy-file
+ ;; from...
+ (resolve-filename file)
+ ;; to...
+ (concat dir (file-name-nondirectory file))
+ nil)))))))))
(defcustom elnode-log-files-directory "~/.elnodelogs"
"The directory to store any Elnode log files.
@@ -2355,11 +2377,8 @@ off the standard webserver indexing in elnode's webserver."
(elnode--dir-setup elnode-webserver-docroot
elnode-webserver-docroot-default
"default-webserver-test.html"
- "test.html")
- (elnode--dir-setup elnode-webserver-docroot
- elnode-webserver-docroot-default
- "default-webserver-image.png"
- "emacs.png"))
+ "test.html"
+ "default-webserver-image.png"))
(defun elnode-url-encode-path (path)
"Return a url encoded version of PATH.
Please sign in to comment.
Something went wrong with that request. Please try again.