Git Product home page Git Product logo

cl-project's Introduction

CL-Project - Generate modern project skeletons

Build Status Quicklisp dist

Usage

(cl-project:make-project #p"lib/cl-sample/"
  :name "cl-sample"
  :long-name "common-lisp-sample"
  :author "Eitaro Fukamachi"
  :maintainer "Eitaro Fukamachi"
  :email "[email protected]"
  :license "MIT"
  :homepage "https://github.com/fukamachi/cl-project"
  :bug-tracker "https://github.com/fukamachi/cl-project/issues"
  :source-control "https://github.com/fukamachi/cl-project.git"
  :version "0.1.1"
  :description "Sample library"
  :long-description "Common Lisp sample library"
  :depends-on '(:clack alexandria)
  :use '(:cl)
  :import-from '(:clack (serapeum concat))
  :export '(test-function test-constant)
  :code '((alexandria:define-constant test-constant "hallo" :test 'string=)
          (defun test-function (user)
            "docstring"
            (concat test-constant " " user)))
  :load-system t)
;-> 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/main.lisp
;   writing /Users/fukamachi/Programs/lib/cl-sample/t/main.lisp
;
;   compiling file "/Users/fukamachi/Programs/lib/cl-sample/src/main.lisp"
;   compilation finished in 0:00:00.004
;=> T

What's the difference from other generators?

1. Flexible templates

CL-Project supports more parameters to embed, by using 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. 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.
  • :long-name: Project name long form.
  • :description: Short description for the new project.
  • :long-description: Long description for the new project.
  • :version: Project version.
  • :author: Your name.
  • :maintainer: Project maintainer.
  • :email: Your e-mail address.
  • :license: License of the new project.
  • :homepage: Project homepage.
  • :bug-tracker: Project bug-tracker. E.g. Git issue tracker.
  • :source-control: Project source-control.
  • :depends-on: A list of dependencies for the system definition. If use or import-from is specified, the respective packages are added to this list automatically.
  • :without-tests: If true, then no testing system, folder, and file are generated. Default: nil.
  • :verbose: If true, the written files directories are printed to the standard output. Default: t.
  • :use: A list of packages that will be in the use-clause of the package definition. If you do not want to use any package, then supply nil. Default value: '(:cl).
  • :import-from: A list of packages and symbols that will be in import-from-clauses in the package definition. Value can be a list or nested list.
  • :export: A list of symbols that will be exported from the package definition.
  • :code: Source code that will be inserted in main.lisp file. Can be nil, string, or a list of forms. Make sure to use, import-from, or qualify the necessary symbols.
  • :load-system: If load-system is not nil, the generated system is loaded with asdf:load-system. Default is nil.

See Also

  • Rove - Testing framework

Author

Copyright

Copyright (c) 2011 Eitaro Fukamachi ([email protected])

License

Licensed under the MIT License.

cl-project's People

Contributors

fukamachi avatar kilianmh avatar lispnik avatar matthewrock avatar petewood avatar rudolfochrist avatar rudolph-miller avatar tamurashingo avatar windymelt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cl-project's Issues

Does not build due to package error

When I try to build cl-project in SBCL, I get this error:

unhandled SB-KERNEL:SIMPLE-PACKAGE-ERROR in thread 
#<SB-THREAD:THREAD "initial thread" RUNNING {1002FF95B1}>: 
The name "CL-SYNTAX-ANNOT" does not designate any package.

How to specify projects base path?

Hi,

For example in Slime REPL I want to create a new project in my $HOME/Projects directory but my REPL is not running there. Is there any default projects directory path variable like Qucklisp has ql:*local-project-directories*

Clozure support

Would be nice. Works fine on sbcl, but often I use Clozure.

defsystem compilation error in slime

For a freshly created project

(cl-project:make-project #p"~/projects/common-lisp/hello-world2/")

I try to compile asd file with C-c C-k and I have the error:

../hello-world2/hello-world2.asd:16:53:
  read-error: 
    READ error during COMPILE-FILE:
    
      The function COMMON-LISP-USER::SUBPATHNAME is undefined.
    
      (in form starting at line: 5, column: 0, position: 54)

Now if I remove :long-description and try to recompile:

Execution of a form compiled with errors.
Form:
  ((:MODULE "src" :COMPONENTS ((:FILE "hello-world2"))))
Compile-time error:
  illegal function call

And if I add asdf: to the defsystem I can actually compile asd file:

(asdf:defsystem "hello-world2"
  :version "0.1.0"
  :author ""
  :license ""
  :depends-on ()
  :components ((:module "src"
                :components
                ((:file "hello-world2"))))
  :description ""
  :in-order-to ((test-op (test-op "hello-world2-test"))))

Do I miss some crucial configuration for my sbcl?

Warning on make-project

Hi,

I get the following error message when I execute make-project. Am I missing anything or is it a bug?

(cl-project:make-project #p"foo"
:name "foo"
:author "Joe Doe"
:license "BSD")
writing foo/.gitignore
writing foo/README.markdown
writing foo/foo-test.asd
writing foo/foo.asd
writing foo/src/foo.lisp
writing foo/t/foo.lisp
WARNING: Invalid version "0.1-SNAPSHOT" for component "foo"

I'm using SBCL.

cl-project:make-project fails on windows using sbcl

Hi!

On windows using sbcl (Version 2.0.0) cl-project:make-project fails with

Error opening #P"C:/Binary/./quicklisp2/dists/quicklisp/software/cl-project-20190521-git/skeleton/eleton.asd"

I think the problem is inside the relative-path function in make-skeleton-from-directory.

(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))))

On my system directory , which originate from a call to (asdf:system-relative-pathname :cl-project "skeleton") is set to C:/Binary/./quicklisp2/dists/quicklisp/software/cl-project-20190521-git/skeleton/ (see the "." between binary and quicklisp), while path is set to C:/Binary/quicklisp2/dists/quicklisp/software/cl-project-20190521-git/skeleton/skeleton.asd. Therefore the subseq expression will cut away two characters of the namestring of path. Replacing the subseq expression with the following code fixes the problem:

 (pathname
   (subseq
     (namestring path)
        ( - (length (namestring directory)) 2)))
           ))

Obviously this is not a real fix. I think the root cause is, that asdf:system-relative-pathname returns a "." inside the pathname but i don't have a clue why it does this.

Any idea how to fix this problem? I can imagine, that doing string operation on pathes is not the best idea but i am to new to lisp to come up with a better idea.

make-project is not recognised when installing from quicklisp

If I try the example in the README (or any example you can find online/think of), then I get these errors by running (cl-project:make-project #P"./traylet/" :author "Mon Aaraj" :license "AGPL" :depends-on '(:dbus))

debugger invoked on a SB-INT:SIMPLE-READER-PACKAGE-ERROR in thread
#<THREAD "main thread" RUNNING {1004E0C073}>:
  Symbol "MAKE-PROJECT" not found in the CL-PROJECT package.

    Stream: #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {100002D943}>

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Use symbol anyway.
  1: [ABORT   ] Exit debugger, returning to top level.

(SB-IMPL::READ-TOKEN #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {100002D943}> #\c)
0]
* #P"./traylet/"
* :AUTHOR
* "Mon Aaraj"
* :LICENSE
* "AGPL"
* :DEPENDS-ON
* (:DBUS)
*
debugger invoked on a SB-INT:SIMPLE-READER-ERROR in thread
#<THREAD "main thread" RUNNING {1004E0C073}>:
  unmatched close parenthesis

    Stream: #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {100002D943}>

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-IMPL::READ-RIGHT-PAREN #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {100002D943}> #<unused argument>)
0]

Copy binary files

It would be convenient to be able to specify some files from the skeleton to copy over without being processed by cl-emb.

I'd like to include favicon.ico or a png, or some other file that is not text-based, but currently an error like the following is signaled:

debugger invoked on a SB-INT:STREAM-DECODING-ERROR in thread
#<THREAD tid=162769 "main thread" RUNNING {10044E8113}>:
  :UTF-8 stream decoding error on
  #<SB-SYS:FD-STREAM for "file /home/jnewton/quicklisp/local-projects/foo.lisp.vinland/skeleton/web/static/favicon.ico" {100423E973}>:

    the octet sequence #(158) cannot be decoded.

Perhaps there could be a second special variable that would be bound to a regular expression representing files to copy directly, or else a list of file extensions or filenames.

As a workaround, I can keep these files in another directory and copy them over after calling CL-PROJECT:MAKE-PROJECT, but this seems like a feature that could be added to the library.

Providing a skeleton directory

Currently as far as I know the skeleton directory must be provided by redefining it in cl-project and then calling the make-project.

(let ((cl-project:*skeleton-directory* my-skeleton-directory)) (cl-project:make-project params))

This could, however, pose a problem as executing such redefine would be considered alteration of the library cl-project. This would then mean that the program making the call would be required to be licensed under the LLGPL or another compatible license.

I'm not sure if this is the intended behavior as the user would then be only using their own templates.

Should there instead be key parameter that could be passed to the make-project function to avoid the redefinition.

Use uiop:define-package instead cl:defpackage

Maybe it would be a good idea to use the uiop:define-package instead of cl:defpackage. This would particularly allow to change the (exported) symbols in the package which happens frequently with skelletons generated by cl-project. If you like the idea I can create the PR accordingly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.