Roswell - 如何开始一个新项目?

Roswell - How to start a new project?

刚刚开始使用 Common Lisp、Roswell 和 SBCL。我已经完成了 Initial Recommended Setup and am able to work with Lem IDE repl. Now I want to get going with a new project, but how to initialize a new project with Roswell? Basically I expect to find something similar to cargo new.

$ ros help new
No manual entry for ros-new

ros help 显示可能的子命令。最接近的似乎是 ros init,但它只是从命令行为 exec Lisp 代码生成一个脚本包装器。

commands:
   run       Run repl
   install   Install a given implementation or a system for roswell environment
   update    Update installed systems.
   build     Make executable from script.
   use       Change default implementation.
   init      Creates a new ros script, optionally based on a template.
   fmt       Indent lisp source.
   list      List Information
   template  Manage templates
   delete    Delete installed implementations
   config    Get and set options
   version   Show the roswell version information

我描述了一种可能性here。 如果你通过 Roswell 安装 cl-project 包,它会安装一个脚本 make-project,你可以从命令行调用它来启动一个新项目。

简而言之:

# install cl-project
$ ros install fukamachi/cl-project
# enter Roswell's local-project folder
# where you have to create the project
# so that it can be found by Roswell:
$ cd ~/.roswell/local-projects

# as and example we create a project caled `my-project`:
$ make-project my-project --depends-on alexandria cl-xlsx

# you can see the folder structure:

$ tree my-project
my-project
├── my-project.asd
├── README.markdown
├── README.org
├── src
│   └── main.lisp
└── tests
    └── main.lisp
2 directories, 5 files


# my-project/my-project.asd
# contains:

(defsystem "my-project"
  :version "0.1.0"
  :author ""
  :license ""
  :depends-on ("alexandria"
               "cl-xlsx")
  :components ((:module "src"
                :components
                ((:file "main"))))
  :description ""
  :in-order-to ((test-op (test-op "my-project/tests"))))
(defsystem "my-project/tests"
  :author ""
  :license ""
  :depends-on ("my-project"
               "rove")
  :components ((:module "tests"
                :components
                ((:file "main"))))
  :description "Test system for my-project"
  :perform (test-op (op c) (symbol-call :rove :run c)))

# you can then adjust other data in that file - like fill in description, author name etc.

# some of the infos you can enter already
# while calling the command line command:

$ make-project
Usage:
    make-project /home/user/common-lisp/sample \
--name sample \
--description "sample project." \
--author "Your name" \
--license LLGPL \
--depends-on alexandria split-sequence