Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changing NetInstaller initial setting for NAXL.

ni::*initial-site-url*
Use this url for packages.l if this is first launch.

Add autoload of netinstaller.
  • Loading branch information...
commit d5f3f92d23a34579e0937a598884c781901a018c 1 parent af3ec06
@mumurik mumurik authored
Showing with 43 additions and 23 deletions.
  1. +3 −0  lisp/ldefs.l
  2. +3 −0  lisp/ni/defs.l
  3. +37 −23 lisp/ni/site.l
View
3  lisp/ldefs.l
@@ -34,3 +34,6 @@
(not (si:*builtin-function-p #'si:*structure-reader)))
(fmakunbound 'si:*structure-reader)
(autoload 'si:*structure-reader "struct"))
+
+(export 'netinstaller)
+(autoload 'netinstaller "ni/setup" t)
View
3  lisp/ni/defs.l
@@ -76,6 +76,9 @@
(defvar *install-site-file*
(merge-pathnames "sites.l" *base-directory*))
+(defvar *initial-site-url* "https://raw.github.com/mumurik/NAXEL/master/packages.l"
+ "Initialized for this url when first launch netinstaller.")
+
(defvar *local-data-file*
(merge-pathnames "packages.l" *base-directory*))
View
60 lisp/ni/site.l
@@ -105,26 +105,37 @@
(ni-error "不正なファイルです: ~%~A" file))
(data-read-from-file file))))
+(defun setup-default-app-data()
+ (when *initial-site-url*
+ (update-site *initial-site-url*
+ (site-create *initial-site-url*)
+ -1)))
+
+(defun setup-app-data-from-sites(sites-temp sites)
+ (dolist (site sites-temp)
+ (handler-case
+ (let ((data (load-site-data-file site)))
+ (when data
+ (unless (site-src data)
+ (push (cons "src" (site-src site)) data))
+ (push data sites)
+ (dolist (app (site-apps data))
+ (setq app (app-data-add-site app data))
+ (push app *app-data*))))
+ (error (c)
+ (ni-msgbox "Error:~%~A" (si:*condition-string c)))))
+ (setq *app-data*
+ (sort *app-data* #'app-newer-p)))
+
(defun load-site-data ()
(let (sites-temp sites)
(when (file-exist-p *install-site-file*)
(setq sites-temp
(data-read-from-file *install-site-file*)))
(setq *app-data* nil)
- (dolist (site sites-temp)
- (handler-case
- (let ((data (load-site-data-file site)))
- (when data
- (unless (site-src data)
- (push (cons "src" (site-src site)) data))
- (push data sites)
- (dolist (app (site-apps data))
- (setq app (app-data-add-site app data))
- (push app *app-data*))))
- (error (c)
- (ni-msgbox "Error:~%~A" (si:*condition-string c)))))
- (setq *app-data*
- (sort *app-data* #'app-newer-p))
+ (if sites-temp
+ (setup-app-data-from-sites sites-temp sites)
+ (setup-default-app-data))
(setq *site-data* (reverse sites))
(category-parse)
(save-site-data)))
@@ -222,6 +233,16 @@
(equal url (site-url x)))
*site-data*))
+(defun update-site (src site pos)
+ (get-site-data site)
+ (let ((site (load-site-data-file site)))
+ (unless site
+ (ni-error "データを取得できません。"))
+ (setq site (set-site-data "src" src site))
+ (site-insert site (max pos 0)))
+ (save-site-data)
+ (load-site-data))
+
(defun site-add (src)
(interactive "sURL: ")
(let* ((temp (site-create src))
@@ -231,15 +252,8 @@
description)
(when (site-exist-p src)
(ni-error "すでに存在します: ~A" src))
- (get-site-data temp)
- (let ((site (load-site-data-file temp)))
- (unless site
- (ni-error "データを取得できません。"))
- (setq site (set-site-data "src" src site))
- (site-insert site (max pos 0))
- (save-site-data)
- (load-site-data)
- (site-print))
+ (update-site src temp pos)
+ (site-print)
(goto-line num)))
(defun site-del ()
Please sign in to comment.
Something went wrong with that request. Please try again.