basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
10.66k stars 410 forks source link

Update condition to copy sample hooks #723

Open kiliczsh opened 6 months ago

kiliczsh commented 6 months ago

If .kamal/hooks file exists but sample hooks are deleted. kamal init command is not creating sample hooks.

Results for /bin/test

Finished in 274.016546s, 1.5291 runs/s, 4.6713 assertions/s.
419 runs, 1280 assertions, 0 failures, 0 errors, 0 skips

Step 1:

kamal init
Created configuration file in config/deploy.yml 
Created sample hooks in .kamal/hooks

Step 2:

git status
 On branch main
 Changes to be committed:
   (use "git restore --staged <file>..." to unstage)
    new file:   .kamal/hooks/post-deploy.sample
    new file:   .kamal/hooks/post-traefik-reboot.sample
    new file:   .kamal/hooks/pre-build.sample
    new file:   .kamal/hooks/pre-connect.sample
    new file:   .kamal/hooks/pre-deploy.sample
    new file:   .kamal/hooks/pre-traefik-reboot.sample
    new file:   config/deploy.yml

Delete sample hook files now. Keep the folder.

Step 3:

kamal init
Created configuration file in config/deploy.yml

Delete folder as well.

Step 4:

kamal init
Config file already exists in config/deploy.yml (remove first to create a new one)
Created sample hooks in .kamal/hooks