| 1 | ;;; ede-system.el --- EDE working with the system (VC, FTP, ETC) |
| 2 | |
| 3 | ;; Copyright (C) 2001-2003, 2009-2012 Free Software Foundation, Inc. |
| 4 | |
| 5 | ;; Author: Eric M. Ludlam <zappo@gnu.org> |
| 6 | ;; Keywords: project, make, vc |
| 7 | |
| 8 | ;; This file is part of GNU Emacs. |
| 9 | |
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
| 11 | ;; it under the terms of the GNU General Public License as published by |
| 12 | ;; the Free Software Foundation, either version 3 of the License, or |
| 13 | ;; (at your option) any later version. |
| 14 | |
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, |
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | ;; GNU General Public License for more details. |
| 19 | |
| 20 | ;; You should have received a copy of the GNU General Public License |
| 21 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
| 22 | |
| 23 | ;;; Commentary: |
| 24 | ;; |
| 25 | ;; EDE system contains some routines to work with EDE projects saved in |
| 26 | ;; CVS repositories, and services such as sourceforge which lets you |
| 27 | ;; perform releases via FTP. |
| 28 | |
| 29 | (require 'ede) |
| 30 | |
| 31 | ;;; Code: |
| 32 | |
| 33 | ;;; Web/FTP site node. |
| 34 | |
| 35 | ;;;###autoload |
| 36 | (defun ede-web-browse-home () |
| 37 | "Browse the home page of the current project." |
| 38 | (interactive) |
| 39 | (if (not (ede-toplevel)) |
| 40 | (error "No project")) |
| 41 | (let ((home (oref (ede-toplevel) web-site-url))) |
| 42 | (if (string= "" home) |
| 43 | (error "Now URL is stored in this project")) |
| 44 | (require 'browse-url) |
| 45 | (browse-url home) |
| 46 | )) |
| 47 | |
| 48 | ;;;###autoload |
| 49 | (defun ede-edit-web-page () |
| 50 | "Edit the web site for this project." |
| 51 | (interactive) |
| 52 | (let* ((toplevel (ede-toplevel)) |
| 53 | (dir (oref toplevel web-site-directory)) |
| 54 | (file (oref toplevel web-site-file)) |
| 55 | (endfile (concat (file-name-as-directory dir) file))) |
| 56 | (if (string-match "^/r[:@]" endfile) |
| 57 | (require 'tramp)) |
| 58 | (when (not (file-exists-p endfile)) |
| 59 | (setq endfile file) |
| 60 | (if (string-match "^/r[:@]" endfile) |
| 61 | (require 'tramp)) |
| 62 | (if (not (file-exists-p endfile)) |
| 63 | (error "No project file found"))) |
| 64 | (find-file endfile))) |
| 65 | |
| 66 | ;;;###autoload |
| 67 | (defun ede-upload-distribution () |
| 68 | "Upload the current distribution to the correct location. |
| 69 | Use /user@ftp.site.com: file names for FTP sites. |
| 70 | Download tramp, and use /r:machine: for names on remote sites w/out FTP access." |
| 71 | (interactive) |
| 72 | (let* ((files (project-dist-files (ede-toplevel))) |
| 73 | (upload (if (string= (oref (ede-toplevel) ftp-upload-site) "") |
| 74 | (oref (ede-toplevel) ftp-site) |
| 75 | (oref (ede-toplevel) ftp-upload-site)))) |
| 76 | (when (or (string= upload "") |
| 77 | (not (file-exists-p upload))) |
| 78 | (error "Upload directory %S does not exist" upload)) |
| 79 | (while files |
| 80 | (let ((localfile (concat (file-name-directory (oref (ede-toplevel) file)) |
| 81 | (car files)))) |
| 82 | (if (not (file-exists-p localfile)) |
| 83 | (progn |
| 84 | (message "File %s does not exist yet. Building a distribution" |
| 85 | localfile) |
| 86 | (ede-make-dist) |
| 87 | (error "File %s does not exist yet. Building a distribution" |
| 88 | localfile) |
| 89 | )) |
| 90 | (setq upload |
| 91 | (concat (directory-file-name upload) |
| 92 | "/" |
| 93 | (file-name-nondirectory localfile))) |
| 94 | (copy-file localfile upload) |
| 95 | (setq files (cdr files))))) |
| 96 | (message "Done uploading files...") |
| 97 | ) |
| 98 | |
| 99 | ;;;###autoload |
| 100 | (defun ede-upload-html-documentation () |
| 101 | "Upload the current distributions documentation as HTML. |
| 102 | Use /user@ftp.site.com: file names for FTP sites. |
| 103 | Download tramp, and use /r:machine: for names on remote sites w/out FTP access." |
| 104 | (interactive) |
| 105 | (let* ((files nil) ;(ede-html-doc-files (ede-toplevel))) |
| 106 | (upload (if (string= (oref (ede-toplevel) ftp-upload-site) "") |
| 107 | (oref (ede-toplevel) ftp-site) |
| 108 | (oref (ede-toplevel) ftp-upload-site)))) |
| 109 | (when (or (string= upload "") |
| 110 | (not (file-exists-p upload))) |
| 111 | (error "Upload directory %S does not exist" upload)) |
| 112 | (while files |
| 113 | (let ((localfile (concat (file-name-directory (oref (ede-toplevel) file)) |
| 114 | (car files)))) |
| 115 | (if (not (file-exists-p localfile)) |
| 116 | (progn |
| 117 | (message "File %s does not exist yet. Building a distribution" |
| 118 | localfile) |
| 119 | ;;(project-compile-target ... ) |
| 120 | (error "File %s does not exist yet. Building a distribution" |
| 121 | localfile) |
| 122 | )) |
| 123 | (copy-file localfile upload) |
| 124 | (setq files (cdr files))))) |
| 125 | (message "Done uploading files...") |
| 126 | ) |
| 127 | |
| 128 | ;;; Version Control |
| 129 | ;; |
| 130 | ;; Do a few nice things with Version control systems. |
| 131 | |
| 132 | ;;;###autoload |
| 133 | (defun ede-vc-project-directory () |
| 134 | "Run `vc-dir' on the current project." |
| 135 | (interactive) |
| 136 | (let ((top (ede-toplevel-project-or-nil default-directory))) |
| 137 | (vc-dir top nil))) |
| 138 | |
| 139 | (provide 'ede/system) |
| 140 | |
| 141 | ;; Local variables: |
| 142 | ;; generated-autoload-file: "loaddefs.el" |
| 143 | ;; generated-autoload-load-name: "ede/system" |
| 144 | ;; End: |
| 145 | |
| 146 | ;;; ede/system.el ends here |