How to move projects around

It may be unclear how workshops react to everyday operations such as moving or copying a project directory. Let’s spend some time talking about different aspects of this.

Before launch

A workshop that you didn’t launch is just a definition file that behaves like any good file should. Things change after you run workshop launch:

/home/user/old/workshop.yaml
name: golang
base: ubuntu@22.04
sdks:
  - name: go
    channel: 1.26
$ workshop launch --project /home/user/old/

Move a project

This is the simplest scenario. Start in the same project directory where you launched the workshop:

$ workshop list --global

  PROJECT                 WORKSHOP  STATUS  NOTES
  /home/user/old          golang    Ready   -

Move the project directory and check the workshop:

$ mv /home/user/old/ /home/user/new/
$ workshop list --global

  PROJECT                 WORKSHOP  STATUS  NOTES
  /home/user/new          golang    Ready   -

Workshop handles the project’s move gracefully so the workshop here remains as you would expect; there are no loose ends to pick up, no paths to update in your definition file.

However, this only ensures the safe transition of the workshop itself, so it’s up to you to update any paths external to Workshop that point to the project’s previous location.

Copy a project

Now let’s copy the project directory. Again, start with the workshop’s location:

$ workshop list --global

  PROJECT                 WORKSHOP  STATUS  NOTES
  /home/user/old          golang    Ready   -

Copy the project directory and check the workshops:

$ cp -r /home/user/old/ /home/user/new/

$ workshop list --global

  PROJECT                 WORKSHOP  STATUS  NOTES
  /home/user/old          golang    Ready   -

Workshop won’t launch the workshop in the new directory, which is probably the sensible default here, but what happens if you do it yourself?

$ workshop launch --project /home/user/new/
$ workshop list --global

  PROJECT                 WORKSHOP  STATUS  NOTES
  /home/user/old          golang    Ready   -
  /home/user/new          golang    Ready   -

Now, these are two independent workshops that happen to have the same name, not a single workshop that is somehow shared by multiple project directories.

Again, it’s up to you to update any paths external to Workshop that should point to your new project.

Remove a project

Workshop doesn’t handle file deletion automatically; make sure you remove all workshops before deleting the project directory:

$ workshop remove --project /home/user/old/
$ rm -rf /home/user/old/

See also

Explanation:

Reference: