1 {/* AUTO-GENERATED — do not edit. Synced by scripts/sync-developer-docs.mjs from docs/gems.md (smbcloud-cli, main). */}
2
3 # Publishing the `smbcloud-model` gem
4
5 import { Callout } from 'nextra/components'
6
7 <Callout type="info">
8 Synced from [`docs/gems.md`](https://github.com/smbcloudXYZ/smbcloud-cli/blob/main/docs/gems.md) on the `main` branch of
9 [smbcloud-cli](https://github.com/smbcloudXYZ/smbcloud-cli). Edit it there.
10 </Callout>
11
12 The gem wraps the `smbcloud-model` Rust crate via a native extension. Publishing requires coordinating the Rust crate release and the gem release in order.
13
14 ## Prerequisites
15
16 - [Rust toolchain](https://rustup.rs) installed
17 - `bundler` and `gem` CLI available
18 - RubyGems account with push access to `smbcloud-model`
19
20 ---
21
22 ## Steps
23
24 ### 1. Publish the Rust crate
25
26 Publish `smbcloud-model` to crates.io first. The gem's native extension depends on it.
27
28 ```sh
29 cargo publish -p smbcloud-model
30 ```
31
32 ### 2. Update the Cargo dependency
33
34 Switch `gems/model/ext/model/Cargo.toml` from the local path to the published version:
35
36 ```toml
37 # Before (development)
38 smbcloud-model = { path = "./../../../../crates/smbcloud-model" }
39
40 # After (release) — match the version just published
41 smbcloud-model = "0.3"
42 ```
43
44 ### 3. Sync the gem version
45
46 Set `gems/model/lib/model/version.rb` to match the `smbcloud-model` crate version:
47
48 ```ruby
49 module Model
50 VERSION = '0.3.31'
51 end
52 ```
53
54 ### 4. Compile the native extension
55
56 ```sh
57 cd gems/model
58 bundle exec rake compile
59 ```
60
61 ### 5. Build the gem
62
63 ```sh
64 bundle exec rake build
65 ```
66
67 This produces `pkg/smbcloud-model-<version>.gem`.
68
69 ### 6. Publish the gem
70
71 ```sh
72 gem push pkg/smbcloud-model-<version>.gem
73 ```
74
75 ---
76
77 ## Development workflow
78
79 To work against the local crate instead of the published one, use the path dependency:
80
81 ```toml
82 smbcloud-model = { path = "./../../../../crates/smbcloud-model" }
83 ```
84
85 Remember to revert this before publishing.