How to use the command 'satis' (with examples)
The command ‘satis’ is a command-line utility for the Satis static Composer repository. It allows users to initialize a Satis configuration, add a VCS repository to the configuration, build the static output from the configuration, update a specific repository and remove useless archive files.
Use case 1: Initialize a Satis configuration
Code:
satis init satis.json
Motivation: The ‘satis init’ command is used to initialize a new Satis configuration with the specified JSON file as the configuration file.
Explanation: ‘satis init’ is the command to initialize a new Satis configuration. ‘satis.json’ is the JSON file that will be used as the configuration file.
Example output: The command will create a new JSON file named ‘satis.json’ in the current directory, which serves as the initial configuration for Satis.
Use case 2: Add a VCS repository to the Satis configuration
Code:
satis add repository_url
Motivation: The ‘satis add’ command allows users to add a VCS repository to the Satis configuration. This is useful when you want to include a package from a specific repository in your Satis repository.
Explanation: ‘satis add’ is the command to add a VCS repository to the Satis configuration. ‘repository_url’ is the URL of the repository you want to add.
Example output: The command will add the specified VCS repository to the Satis configuration, allowing the packages from that repository to be included in the Satis repository.
Use case 3: Build the static output from the configuration
Code:
satis build satis.json path/to/output_directory
Motivation: The ‘satis build’ command is used to build the static output from the Satis configuration. This is necessary to generate the HTML pages and JSON files that serve as the static website for your Composer repository.
Explanation: ‘satis build’ is the command to build the static output from the Satis configuration. ‘satis.json’ is the JSON file that contains the Satis configuration. ‘path/to/output_directory’ is the directory where the static output will be generated.
Example output: The command will generate the static output in the specified output directory, including the HTML pages and JSON files that represent the Composer repository.
Use case 4: Build the static output by updating only the specified repository
Code:
satis build --repository-url repository_url satis.json path/to/output_directory
Motivation: The ‘satis build’ command with the ‘–repository-url’ option allows users to update only the specified repository and rebuild the static output. This is useful when you want to quickly update a specific repository without rebuilding the entire Satis repository.
Explanation: ‘satis build’ is the command to build the static output from the Satis configuration. ‘–repository-url’ is the option to specify the URL of the repository you want to update. ‘repository_url’ is the URL of the repository you want to update. ‘satis.json’ is the JSON file that contains the Satis configuration. ‘path/to/output_directory’ is the directory where the static output will be generated.
Example output: The command will update the specified repository and rebuild the static output in the specified output directory, including only the changes from the updated repository.
Use case 5: Remove useless archive files
Code:
satis purge satis.json path/to/output_directory
Motivation: The ‘satis purge’ command is used to remove useless archive files from the Satis output directory. This is helpful when you want to clean up the output directory and remove any unnecessary files.
Explanation: ‘satis purge’ is the command to remove useless archive files from the Satis output directory. ‘satis.json’ is the JSON file that contains the Satis configuration. ‘path/to/output_directory’ is the directory where the Satis output is located.
Example output: The command will remove any useless archive files from the specified output directory, freeing up disk space and keeping the Satis repository clean and tidy.
Conclusion:
The ‘satis’ command-line utility provides a variety of use cases for managing the Satis static Composer repository. Whether it’s initializing a new configuration, adding a VCS repository, building the static output, updating a specific repository, or purging useless archive files, the ‘satis’ command is your go-to tool for managing your Satis repository.