Commit eb224c65 authored by Eric Timmons's avatar Eric Timmons
Browse files

cli less work: bundle install

parent 85931c6f
Loading
Loading
Loading
Loading
+6 −20
Original line number Diff line number Diff line
@@ -5,19 +5,14 @@

(uiop:define-package #:clpm-cli/commands/bundle/install
    (:use #:cl
          #:alexandria
          #:clpm/bundle
          #:clpm-cli/commands/bundle/common
          #:clpm-cli/common-args
          #:clpm-cli/interface-defs
          #:clpm/context
          #:clpm/log)
  (:import-from #:adopt))
          #:clpm-cli/interface-defs)
  (:import-from #:adopt)
  (:import-from #:clpm))

(in-package #:clpm-cli/commands/bundle/install)

(setup-logger)

(define-string *help-string*
  "Install a bundle described in a clpmfile.

@@ -42,17 +37,8 @@ exist in the lock file.")
                   *option-yes*
                   *option-no-resolve*)))

(defun sexp-interaction-y-or-n-p ()
  (uiop:with-safe-io-syntax ()
    (prin1 :proceedp *standard-output*)
    (terpri *standard-output*)
    (finish-output *standard-output*)
    (read *standard-input*)))

(define-cli-command (("bundle" "install") *bundle-install-ui*) (args options)
  (declare (ignore args))
  (let* ((clpmfile-pathname (bundle-clpmfile-pathname)))
    (bundle-install clpmfile-pathname
                    :validate (make-diff-validate-fun :yesp (gethash :yes options))
  (clpm:bundle-install :validate (make-diff-validate-fun :yesp (gethash :yes options))
                       :no-resolve (gethash :bundle-no-resolve options))
    t))
  t)
+31 −49
Original line number Diff line number Diff line
@@ -109,13 +109,13 @@ bound to PN's folder."
          (terpri s)))))
  (clpmfile-pathname clpmfile))

(defun bundle-install (clpmfile-designator &key (validate (constantly t)) no-resolve)
(defun bundle-install (&key clpmfile (validate (constantly t)) no-resolve)
  "Given a clpmfile instance, install all releases from its lock file, creating
the lock file if necessary."
  (with-bundle-session (clpmfile)
    (let* ((*fetch-repo-automatically* (not (config-value :local)))
         (clpmfile (get-clpmfile clpmfile-designator))
           (clpmfile (get-clpmfile clpmfile))
           (lockfile-pathname (clpmfile-lockfile-pathname clpmfile))
         (*vcs-project-override-fun* (make-vcs-override-fun (clpmfile-pathname clpmfile)))
           (lockfile nil)
           (changedp nil))
      (unless (config-value :local)
@@ -139,26 +139,8 @@ the lock file if necessary."
                                                 :update-projects (config-table-keys :bundle :local)))
            (when changedp
              (save-context lockfile))))
    lockfile))


(defun bundle-output-translations (clpmfile-designator)
  (let ((clpmfile-pathname (clpmfile-pathname (get-clpmfile clpmfile-designator))))
    (case (config-value :bundle :output-translation)
      ((t)
       `(:output-translations
         :ignore-inherited-configuration
         (t (:root ,@(rest (pathname-directory (clpm-cache-pathname '("bundle" "fasl-cache")
                                                                    :ensure-directory t)))
                   ,(urlencode (format nil "~{~A~^/~}" (rest (pathname-directory clpmfile-pathname))))
                   :implementation :**/ :*.*.*))))
      (:local
       `(:output-translations
         :ignore-inherited-configuration
         (t (,(uiop:pathname-directory-pathname clpmfile-pathname) ".clpm" "fasl-cache"
             :implementation :**/ :*.*.*))))
      (t
       nil))))
      lockfile)))


(defun bundle-source-registry (clpmfile-designator
                               &key include-client-p ignore-missing-releases)
@@ -195,7 +177,7 @@ the lock file if necessary."
    (unless (probe-file lockfile-pathname)
      ;; There is no lock file currently. Just fall back to BUNDLE-INSTALL.
      (return-from bundle-update
        (bundle-install clpmfile :validate validate)))
        (bundle-install :clpmfile clpmfile :validate validate)))
    ;; Load the existing lockfile
    (setf lockfile (load-lockfile lockfile-pathname))
    (unless (config-value :local)
+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@
        #:clpm/version)
  ;; From bundle
  (:export #:bundle-exec
           #:bundle-init)
           #:bundle-init
           #:bundle-install)
  ;; From client
  (:export #:client-asd-pathname)
  ;; From config