Skip to content

Commit 1fa1bf1

Browse files
authored
Merge pull request #568 from xkaper001/patch-1
fixes #548 add choco packaging guide
2 parents 21c6561 + ef45213 commit 1fa1bf1

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed
56.9 KB
Loading
99.7 KB
Loading
86.9 KB
Loading
86.8 KB
Loading

doc/dev_guide/packaging.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,90 @@ brew install apidash
104104

105105
## Chocolatey
106106

107-
TODO Instructions
107+
### Step 1: Setup Skeleton
108+
109+
First step towards making a choco package is initializing a base.
110+
111+
The command `choco new -h` can teach you more about the `new` command, its usage, options, switches, and exit codes.
112+
113+
Run the following command to setup the base
114+
115+
```powershell
116+
choco new --name="apidash" --version="0.3.0" maintainername="foss42" maintainerrepo="https://github.com/foss42/apidash" --built-in-template
117+
```
118+
119+
![choco folder structure](images/choco_create_structure.png)
120+
121+
This creates the following folder structure
122+
123+
```
124+
apidash
125+
├── ReadMe.md
126+
├── _TODO.txt
127+
├── apidash.nuspec
128+
└── tools
129+
├── chocolateybeforemodify.ps1
130+
├── chocolateyinstall.ps1
131+
├── chocolateyuninstall.ps1
132+
├── LICENSE.txt
133+
└── VERIFICATION.txt
134+
```
135+
136+
The files `ReadMe.md` and `_TODO.md` can be deleted before pushing.
137+
138+
The files of our main interest are `chocolateyinstall.ps1` and `apidash.nuspec`.
139+
140+
### Step 2: Editing `chocolateyinstall.ps1`
141+
142+
Take a look at `chocolateyinstall.ps1` file. There are many comments stating the use case of each line itself.
143+
![chocolatelyinstall.ps1](images/choco_chocolateyinstall_ps1.png)
144+
145+
Comments can bre remoed using the following command.
146+
```powershell
147+
$f='apidash\tools\chocolateyinstall.ps1'
148+
gc $f | ? {$_ -notmatch "^\s*#"} | % {$_ -replace '(^.*?)\s*? [^``]#.*','$1'} | Out-File $f+".~" -en utf8; mv -fo $f+".~" $f
149+
```
150+
151+
Now our `chocolateyinstall.ps1` file is ready.
152+
153+
### Step 3: Editing `apidash.nuspec`
154+
155+
![final apidash.nuspec](images/choco_nuspec.png)
156+
157+
### Step 4: Build the package
158+
159+
All our files are ready, we just need to pack out files in a choco package with the extension `.nupkg`.
160+
161+
Run the following command from the root of your directory:
162+
```powershell
163+
choco pack
164+
```
165+
This command generates the `apidash.0.3.0.nupkg` file.
166+
167+
### Step 5: Test the Package Locally
168+
169+
Install the package locally using Chocolatey:
170+
```powershell
171+
choco install apidash -s .
172+
```
173+
Ensure the application installs correctly.
174+
175+
![Shell output](images/choco_shell_output.png)
176+
177+
### Step 6: Pre-Publishing - Update `LICENSE.txt` & `VERIFICATION.txt`
178+
179+
Update `LICENSE.txt` with the actual **LICENSE **and `VERIFICATION.txt` accordingly.
180+
181+
### Step 7: Publish the Package (Optional)
182+
183+
To share the package, you can push it to a Chocolatey repository. For the official Chocolatey Community Repository, follow these steps:
184+
185+
1. Create an account on the Chocolatey Community.
186+
2. Get an API key by navigating to your profile.
187+
3. Use the following command to push your package:
188+
```powershell
189+
choco push apidash.0.3.0.nupkg --source="https://push.chocolatey.org/" --api-key="YOUR_API_KEY"
190+
```
108191

109192
## WinGet
110193

0 commit comments

Comments
 (0)