Skip to content

Commit

Permalink
Add update command (#53)
Browse files Browse the repository at this point in the history
Before this commit, updating Pixel required a `git pull` followed by a
`./pixel.js clean` which can be tedious. Instead, promote the updating
process as a CLI command:

```sh
./pixel.js update
```
  • Loading branch information
Nick Ray authored Jun 24, 2022
1 parent e72d06d commit c2602eb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,17 @@ If you want to stop all of Pixel's services, run:

### Updates

Updating Pixel is more of a hassle than it should be. It requires two steps:
Updating Pixel to the latest version is more of a hassle than it should be. It
requires:

```sh
git pull
./pixel.js update
```

which pulls down the latest code. Then run:

```sh
./pixel.js clean
```

The `clean` command destroys all Docker images, containers, and volumes
associated with Pixel and ensures that the necessary Docker images are rebuilt with the latest.
If the Docker images are updated and you don't run this command, you will likely get errors.
This command will pull the latest code and destroy all Docker images,
containers, and volumes associated with Pixel to ensure that it is using the
latest database seed data and that the necessary Docker images are rebuilt with
the latest code. As a result, updates can take awhile.

### Cleanup

Expand Down
11 changes: 11 additions & 0 deletions pixel.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,17 @@ function setupCli() {
);
} );

program
.command( 'update' )
.description( 'Updates Pixel to the latest version. This command also destroys all containers, images, networks, and volumes associated with Pixel to ensure it is using the latest code.' )
.action( async () => {
await batchSpawn.spawn(
'git',
[ '-C', __dirname, 'fetch', 'origin', 'main:main' ]
);
await cleanCommand();
} );

program
.command( 'clean' )
.description( 'Removes all containers, images, networks, and volumes associated with Pixel so that it can start with a clean slate. If Pixel is throwing errors, try running this command.' )
Expand Down

0 comments on commit c2602eb

Please sign in to comment.