Vim window logic, slimv
This commit is contained in:
parent
babcc9e44b
commit
515847d07e
791 changed files with 51552 additions and 86 deletions
9
sbcl/.quicklisp/dists/quicklisp/software/cl-project-20190521-git/.gitignore
vendored
Normal file
9
sbcl/.quicklisp/dists/quicklisp/software/cl-project-20190521-git/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
*.fasl
|
||||
*.dx32fsl
|
||||
*.dx64fsl
|
||||
*.lx32fsl
|
||||
*.lx64fsl
|
||||
*.x86f
|
||||
|
||||
t/cl-project-sample
|
||||
t/cl-project-caveman
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
language: common-lisp
|
||||
sudo: false
|
||||
|
||||
env:
|
||||
global:
|
||||
- PATH=~/.roswell/bin:$PATH
|
||||
- ROSWELL_INSTALL_DIR=$HOME/.roswell
|
||||
matrix:
|
||||
- LISP=sbcl-bin
|
||||
- LISP=ccl-bin
|
||||
|
||||
install:
|
||||
# Install Roswell
|
||||
- curl -L https://raw.githubusercontent.com/roswell/roswell/release/scripts/install-for-ci.sh | sh
|
||||
- ros install prove
|
||||
|
||||
script:
|
||||
- run-prove cl-project-test.asd
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
# CL-Project - Generate modern project skeletons
|
||||
|
||||
[](https://travis-ci.org/fukamachi/cl-project)
|
||||
[](http://quickdocs.org/cl-project/)
|
||||
|
||||
## Usage
|
||||
|
||||
```common-lisp
|
||||
(cl-project:make-project #p"lib/cl-sample/"
|
||||
:author "Eitaro Fukamachi"
|
||||
:email "e.arrows@gmail.com"
|
||||
:license "LLGPL"
|
||||
:depends-on '(:clack :cl-annot))
|
||||
;-> writing /Users/fukamachi/Programs/lib/cl-sample/.gitignore
|
||||
; writing /Users/fukamachi/Programs/lib/cl-sample/README.markdown
|
||||
; writing /Users/fukamachi/Programs/lib/cl-sample/cl-sample-test.asd
|
||||
; writing /Users/fukamachi/Programs/lib/cl-sample/cl-sample.asd
|
||||
; writing /Users/fukamachi/Programs/lib/cl-sample/src/hogehoge.lisp
|
||||
; writing /Users/fukamachi/Programs/lib/cl-sample/t/hogehoge.lisp
|
||||
;=> T
|
||||
```
|
||||
|
||||
## What's the difference from other generators?
|
||||
|
||||
### 1. Flexible templates
|
||||
|
||||
CL-Project supports more parameters to embed, by using [CL-EMB](http://common-lisp.net/project/cl-emb/) to represent the skeleton files (See "cl-project/skeleton/").
|
||||
|
||||
### 2. One package per file style (Modern)
|
||||
|
||||
A modern CL project should be in accordance with [some rules](http://labs.ariel-networks.com/cl-style-guide.html). For instance, one file must have one package in it.
|
||||
|
||||
### 3. Recommends unit testing
|
||||
|
||||
Modern projects should have some unit tests. CL-Project generates a system for unit testing, so you can begin writing unit tests as soon as the project is generated.
|
||||
|
||||
## Parameters
|
||||
|
||||
All parameters are optional.
|
||||
|
||||
* `:name`: Project name. If this key isn't specified, the directory name will be used.
|
||||
* `:description`: Short description for the new project.
|
||||
* `:author`: Your name.
|
||||
* `:email`: Your e-mail address.
|
||||
* `:license`: License of the new project.
|
||||
* `:depends-on`: A list of dependencies.
|
||||
|
||||
## See Also
|
||||
- [Rove](https://github.com/fukamachi/rove) - Testing framework
|
||||
|
||||
## Author
|
||||
|
||||
* Eitaro Fukamachi (e.arrows@gmail.com)
|
||||
|
||||
## Copyright
|
||||
|
||||
Copyright (c) 2011 Eitaro Fukamachi (e.arrows@gmail.com)
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the LLGPL License.
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#|
|
||||
This file is a part of CL-Project project.
|
||||
Copyright (c) 2011 Eitaro Fukamachi (e.arrows@gmail.com)
|
||||
|#
|
||||
|
||||
(defsystem "cl-project-test"
|
||||
:defsystem-depends-on ("prove-asdf")
|
||||
:author "Eitaro Fukamachi"
|
||||
:license "LLGPL"
|
||||
:depends-on ("cl-project"
|
||||
"prove"
|
||||
"caveman2"
|
||||
"uiop")
|
||||
:components ((:module "tests"
|
||||
:components
|
||||
((:test-file "cl-project"))))
|
||||
:perform (test-op (op c) (symbol-call :prove-asdf :run-test-system c)))
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#|
|
||||
This file is a part of CL-Project package.
|
||||
URL: http://github.com/fukamachi/cl-project
|
||||
Copyright (c) 2011 Eitaro Fukamachi <e.arrows@gmail.com>
|
||||
|
||||
CL-Project is freely distributable under the LLGPL License.
|
||||
|#
|
||||
|
||||
#|
|
||||
Generate a skeleton for modern project
|
||||
|
||||
Author: Eitaro Fukamachi (e.arrows@gmail.com)
|
||||
|#
|
||||
|
||||
(defsystem "cl-project"
|
||||
:version "0.3.1"
|
||||
:author "Eitaro Fukamachi"
|
||||
:license "LLGPL"
|
||||
:depends-on ("cl-emb"
|
||||
"uiop"
|
||||
"cl-ppcre"
|
||||
"local-time"
|
||||
"prove")
|
||||
:components ((:module "src"
|
||||
:components
|
||||
((:file "cl-project" :depends-on ("specials" "file" "skeleton"))
|
||||
(:file "file" :depends-on ("specials" "io"))
|
||||
(:file "skeleton" :depends-on ("specials" "file" "middleware"))
|
||||
(:file "io" :depends-on ("specials"))
|
||||
(:file "middleware" :depends-on ("file"))
|
||||
(:file "specials"))))
|
||||
:description "Generate a skeleton for modern project"
|
||||
:in-order-to ((test-op (test-op "cl-project-test"))))
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/sh
|
||||
#|-*- mode:lisp -*-|#
|
||||
#|
|
||||
exec ros -Q -- $0 "$@"
|
||||
|#
|
||||
|
||||
#|
|
||||
A command-line interface for cl-project:make-project.
|
||||
|#
|
||||
|
||||
(ql:quickload '(:uiop :alexandria) :silent t)
|
||||
|
||||
(import 'alexandria:starts-with-subseq)
|
||||
(import 'alexandria:ensure-list)
|
||||
|
||||
(defun help ()
|
||||
(format t "~&Usage:
|
||||
make-project /home/user/common-lisp/sample --name sample --description \"sample project.\" --author \"Your name\" --license LLGPL --depends-on alexandria split-sequence~%"))
|
||||
|
||||
(defun terminate (&optional message args)
|
||||
(when message
|
||||
(format *error-output* "~&Error: ~A~%"
|
||||
(apply #'format nil (princ-to-string message) (ensure-list args))))
|
||||
(uiop:quit -1))
|
||||
|
||||
(defun parse-args (args)
|
||||
(flet ((keyp (string)
|
||||
(starts-with-subseq "--" string))
|
||||
(parse-value (value)
|
||||
(or (ignore-errors
|
||||
(let ((read-value (read-from-string value)))
|
||||
(if (and (symbolp read-value)
|
||||
(not (keywordp read-value)))
|
||||
value
|
||||
read-value)))
|
||||
value)))
|
||||
(let ((path (pop args)))
|
||||
(when (starts-with-subseq "--" path)
|
||||
(terminate "No path given."))
|
||||
(cons (pathname path)
|
||||
(loop for index from 0 below (length args)
|
||||
for first = (elt args index)
|
||||
for rest = (subseq args (incf index))
|
||||
for key = (or (when (not (keyp first))
|
||||
(terminate "Invalid option: ~S" first))
|
||||
(intern (string-upcase (subseq first 2)) :keyword))
|
||||
for value = (if (eql key :depends-on)
|
||||
(loop for (item . rest) on rest
|
||||
collecting item
|
||||
until (keyp (car rest))
|
||||
do (incf index))
|
||||
(parse-value (car rest)))
|
||||
nconc (list key (parse-value value)))))))
|
||||
|
||||
(defun main (&rest args)
|
||||
(unless args
|
||||
(help)
|
||||
(terminate))
|
||||
|
||||
(ql:quickload :cl-project :silent t)
|
||||
|
||||
(apply (intern (string :make-project) :cl-project) (parse-args args)))
|
||||
8
sbcl/.quicklisp/dists/quicklisp/software/cl-project-20190521-git/skeleton/.gitignore
vendored
Normal file
8
sbcl/.quicklisp/dists/quicklisp/software/cl-project-20190521-git/skeleton/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
*.fasl
|
||||
*.dx32fsl
|
||||
*.dx64fsl
|
||||
*.lx32fsl
|
||||
*.lx64fsl
|
||||
*.x86f
|
||||
*~
|
||||
.#*
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
# <%= (string-capitalize (getf env :name)) %><% @if description %> - <% @var description %><% @endif %>
|
||||
|
||||
## Usage
|
||||
|
||||
## Installation
|
||||
<%- @if author %>
|
||||
|
||||
## Author
|
||||
|
||||
* <% @var author %><% @if email %> (<% @var email %>)<% @endif %>
|
||||
|
||||
## Copyright
|
||||
|
||||
Copyright (c) <%= (local-time:timestamp-year (local-time:now)) %> <% @var author %><% @if email %> (<% @var email %>)<% @endif %>
|
||||
<%- @endif %>
|
||||
<%- @if license %>
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the <% @var license %> License.
|
||||
<%- @endif %>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
* <%= (string-capitalize (getf env :name)) %> <% @if description %> - <% @var description %><% @endif %>
|
||||
|
||||
** Usage
|
||||
|
||||
** Installation
|
||||
<%- @if author %>
|
||||
|
||||
** Author
|
||||
|
||||
+ <% @var author %><% @if email %> (<% @var email %>)<% @endif %>
|
||||
|
||||
** Copyright
|
||||
|
||||
Copyright (c) <%= (local-time:timestamp-year (local-time:now)) %> <% @var author %><% @if email %> (<% @var email %>)<% @endif %>
|
||||
<%- @endif %>
|
||||
<%- @if license %>
|
||||
|
||||
** License
|
||||
|
||||
Licensed under the <% @var license %> License.
|
||||
<%- @endif %>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
(defsystem "<% @var name %>"
|
||||
:version "0.1.0"
|
||||
:author "<% @var author %>"
|
||||
:license "<% @var license %>"
|
||||
:depends-on (<% (format t "~{\"~(~A~)\"~^~% ~}"
|
||||
(getf env :depends-on)) %>)
|
||||
:components ((:module "src"
|
||||
:components
|
||||
((:file "main"))))
|
||||
:description "<% @var description %>"
|
||||
<%- @unless without-tests %>
|
||||
:in-order-to ((test-op (test-op "<% @var name %>/tests")))
|
||||
<%- @endunless %>)
|
||||
|
||||
(defsystem "<% @var name %>/tests"
|
||||
:author "<% @var author %>"
|
||||
:license "<% @var license %>"
|
||||
:depends-on ("<% @var name %>"
|
||||
"rove")
|
||||
:components ((:module "tests"
|
||||
:components
|
||||
((:file "main"))))
|
||||
:description "Test system for <% @var name %>"
|
||||
:perform (test-op (op c) (symbol-call :rove :run c)))
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(defpackage <% @var name %>
|
||||
(:use :cl))
|
||||
(in-package :<% @var name %>)
|
||||
|
||||
;; blah blah blah.
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
(defpackage <% @var name %>/tests/main
|
||||
(:use :cl
|
||||
:<% @var name %>
|
||||
:rove))
|
||||
(in-package :<% @var name %>/tests/main)
|
||||
|
||||
;; NOTE: To run this test file, execute `(asdf:test-system :<% @var name %>)' in your Lisp.
|
||||
|
||||
(deftest test-target-1
|
||||
(testing "should (= 1 1) to be true"
|
||||
(ok (= 1 1))))
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
(in-package :cl-user)
|
||||
(defpackage cl-project
|
||||
(:use #:cl)
|
||||
(:import-from #:cl-project.specials
|
||||
#:*skeleton-directory*
|
||||
#:*skeleton-parameters*)
|
||||
(:import-from #:cl-project.skeleton
|
||||
#:make-skeleton-from-directory)
|
||||
(:import-from #:cl-project.file
|
||||
#:generate)
|
||||
(:export #:*skeleton-directory*
|
||||
#:make-project
|
||||
#:generate-skeleton))
|
||||
(in-package :cl-project)
|
||||
|
||||
(defun make-project (path &rest params &key name description author email license depends-on (without-tests nil) &allow-other-keys)
|
||||
"Generate a skeleton."
|
||||
(declare (ignore name description author email license depends-on without-tests))
|
||||
(check-type path pathname)
|
||||
|
||||
;; Ensure `path' ends with a slash(/).
|
||||
(setf path (uiop:ensure-directory-pathname path))
|
||||
|
||||
(unless (getf params :name)
|
||||
(setf (getf params :name)
|
||||
(car (last (pathname-directory path)))))
|
||||
(let ((files (generate-skeleton
|
||||
*skeleton-directory*
|
||||
path
|
||||
:env params)))
|
||||
(dolist (file files)
|
||||
(when (string= (pathname-type file) "asd")
|
||||
(let ((dir (make-pathname :name nil :type nil :defaults file)))
|
||||
(push dir asdf:*central-registry*)))))
|
||||
t)
|
||||
|
||||
(defun generate-skeleton (source-dir target-dir &key env)
|
||||
"General skeleton generator."
|
||||
(let ((*skeleton-parameters* env))
|
||||
(generate (make-skeleton-from-directory source-dir) target-dir)))
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
(in-package :cl-user)
|
||||
(defpackage cl-project.file
|
||||
(:use #:cl
|
||||
#:cl-project.specials)
|
||||
(:import-from #:cl-project.io
|
||||
#:copy-file-to-file)
|
||||
(:import-from #:cl-ppcre
|
||||
#:regex-replace-all)
|
||||
(:export #:template-file
|
||||
#:template-file-path
|
||||
#:make-template-file
|
||||
#:generate))
|
||||
(in-package :cl-project.file)
|
||||
|
||||
(defclass template-file ()
|
||||
((path :type pathname
|
||||
:initarg :path
|
||||
:accessor template-file-path)))
|
||||
|
||||
(defun make-template-file (path)
|
||||
(make-instance 'template-file :path path))
|
||||
|
||||
(defgeneric generate (file target-dir)
|
||||
(:method ((file template-file) target-dir)
|
||||
(let ((target-path
|
||||
(merge-pathnames (template-file-path file) target-dir)))
|
||||
(when (search "skeleton" (pathname-name target-path))
|
||||
(setf target-path
|
||||
(make-pathname :name
|
||||
(regex-replace-all "skeleton"
|
||||
(pathname-name target-path)
|
||||
(getf *skeleton-parameters* :name))
|
||||
:defaults target-path)))
|
||||
(copy-file-to-file (merge-pathnames (template-file-path file)
|
||||
*skeleton-directory*)
|
||||
target-path)
|
||||
(list target-path))))
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
(in-package :cl-user)
|
||||
(defpackage cl-project.io
|
||||
(:use #:cl
|
||||
#:cl-project.specials)
|
||||
(:import-from #:cl-emb
|
||||
#:execute-emb)
|
||||
(:export #:copy-file-to-file))
|
||||
(in-package :cl-project.io)
|
||||
|
||||
(defun copy-file-to-file (source-path target-path)
|
||||
"Copy a file `source-path` to the `target-path`."
|
||||
(format t "~&writing ~A~%" target-path)
|
||||
(ensure-directories-exist target-path)
|
||||
(with-open-file (stream target-path :direction :output :if-exists :supersede)
|
||||
(write-sequence
|
||||
(cl-emb:execute-emb source-path :env *skeleton-parameters*)
|
||||
stream)))
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
(in-package :cl-user)
|
||||
(defpackage cl-project.middleware
|
||||
(:use #:cl)
|
||||
(:import-from #:cl-project.file
|
||||
#:template-file-path)
|
||||
(:export #:*without-tests*))
|
||||
(in-package :cl-project.middleware)
|
||||
|
||||
(defparameter *without-tests*
|
||||
(lambda (app &key
|
||||
(test-asd "skeleton-test.asd")
|
||||
(test-directory #P"t/"))
|
||||
(lambda (file)
|
||||
(unless (or
|
||||
;; Skip test ASD file
|
||||
(string= (file-namestring (template-file-path file))
|
||||
test-asd)
|
||||
;; Skip test files
|
||||
(eql 0 (search (namestring test-directory)
|
||||
(namestring (template-file-path file)))))
|
||||
(funcall app file)))))
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
(in-package :cl-user)
|
||||
(defpackage cl-project.skeleton
|
||||
(:use #:cl
|
||||
#:cl-project.specials)
|
||||
(:import-from #:cl-project.file
|
||||
#:make-template-file
|
||||
#:template-file-path
|
||||
#:generate)
|
||||
(:export #:skeleton
|
||||
#:make-skeleton
|
||||
#:make-skeleton-from-directory))
|
||||
(in-package :cl-project.skeleton)
|
||||
|
||||
(defclass skeleton ()
|
||||
((path :type pathname
|
||||
:initarg :path
|
||||
:accessor skeleton-path)
|
||||
(children :type list
|
||||
:initarg :children
|
||||
:initform '()
|
||||
:accessor skeleton-children)))
|
||||
|
||||
(defun make-skeleton (path children)
|
||||
(make-instance 'skeleton :path path :children children))
|
||||
|
||||
(defmethod generate ((skeleton skeleton) target-dir)
|
||||
(let ((app (lambda (file)
|
||||
(generate file target-dir))))
|
||||
(when (getf *skeleton-parameters* :without-tests)
|
||||
(setf app
|
||||
(funcall cl-project.middleware:*without-tests*
|
||||
app)))
|
||||
(mapcan app (skeleton-children skeleton))))
|
||||
|
||||
(defun maptree (fn path)
|
||||
(flet ((directory-files (path)
|
||||
;; Older ASDF/UIOP's uiop:directory-files returns also directories on Linux.
|
||||
;; The bug had been fixed at ASDF 3.1.0.64 (https://bugs.launchpad.net/asdf/+bug/1276748), however, it's safe to filter directories anyway.
|
||||
;; ref. https://github.com/fukamachi/cl-project/pull/17
|
||||
(set-difference (uiop:directory-files path)
|
||||
(uiop:subdirectories path)
|
||||
:test #'equal)))
|
||||
(if (uiop:file-pathname-p path)
|
||||
;; file
|
||||
(list (funcall fn path))
|
||||
;; directory
|
||||
(append
|
||||
(mapcar fn (directory-files path))
|
||||
(mapcan (lambda (subdir)
|
||||
(maptree fn subdir))
|
||||
(uiop:subdirectories path))))))
|
||||
|
||||
(defun make-skeleton-from-directory (directory)
|
||||
(flet ((relative-path (path)
|
||||
(pathname
|
||||
(subseq
|
||||
(namestring path)
|
||||
(length (namestring directory))))))
|
||||
(make-skeleton
|
||||
directory
|
||||
(maptree (lambda (file)
|
||||
(make-template-file (relative-path file)))
|
||||
directory))))
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
(in-package :cl-user)
|
||||
(defpackage cl-project.specials
|
||||
(:use #:cl)
|
||||
(:export #:*default-skeleton-directory*
|
||||
#:*skeleton-directory*
|
||||
#:*skeleton-parameters*))
|
||||
(in-package :cl-project.specials)
|
||||
|
||||
(defparameter *default-skeleton-directory*
|
||||
(asdf:system-relative-pathname :cl-project #P"skeleton/"))
|
||||
|
||||
(defvar *skeleton-directory*
|
||||
*default-skeleton-directory*)
|
||||
|
||||
(defvar *skeleton-parameters* nil)
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
#|
|
||||
This file is a part of CL-Project project.
|
||||
Copyright (c) 2011 Eitaro Fukamachi (e.arrows@gmail.com)
|
||||
|#
|
||||
|
||||
(in-package :cl-user)
|
||||
(defpackage cl-project-test
|
||||
(:use :cl
|
||||
:cl-project
|
||||
:prove))
|
||||
(in-package :cl-project-test)
|
||||
|
||||
(plan 2)
|
||||
|
||||
(defvar *sample-project-directory*
|
||||
(asdf:system-relative-pathname
|
||||
:cl-project
|
||||
#p"t/cl-project-sample/"))
|
||||
|
||||
(uiop:delete-directory-tree *sample-project-directory* :validate t :if-does-not-exist :ignore)
|
||||
|
||||
(subtest "normal case"
|
||||
(cl-project:make-project *sample-project-directory*)
|
||||
(ok (uiop:directory-exists-p *sample-project-directory*)
|
||||
"Sample project was generated")
|
||||
(ok (asdf:load-system :cl-project-sample)
|
||||
"Can load the new project"))
|
||||
|
||||
(defvar *sample-caveman-directory*
|
||||
(asdf:system-relative-pathname
|
||||
:cl-project
|
||||
#P"t/cl-project-caveman/"))
|
||||
|
||||
(uiop:delete-directory-tree *sample-caveman-directory* :validate t :if-does-not-exist :ignore)
|
||||
|
||||
(subtest "Caveman2"
|
||||
(caveman2:make-project *sample-caveman-directory*)
|
||||
(ok (uiop:directory-exists-p *sample-caveman-directory*)
|
||||
"Sample project was generated")
|
||||
#+quicklisp
|
||||
(ok (ql:quickload :cl-project-caveman)
|
||||
"Can load the new project")
|
||||
#-quicklisp
|
||||
(skip 1 "Can load the new project"))
|
||||
|
||||
(finalize)
|
||||
Loading…
Add table
Add a link
Reference in a new issue