Search code examples
common-lispproject

Roswell - How to start a new project?


Just getting started with Common Lisp, Roswell and SBCL. I have completed the 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 shows possible sub-commands. The closest seems to be ros init, but it simply produces a script wrapper to exec the Lisp code from the command line.

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

Solution

  • I described a possibility here. If you install cl-project package via Roswell, it installs a script make-project which you can call from the command line for starting a new project.

    In short:

    # 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