1 # Publishing the `smbcloud-model` gem
2
3 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.
4
5 ## Prerequisites
6
7 - [Rust toolchain](https://rustup.rs) installed
8 - `bundler` and `gem` CLI available
9 - RubyGems account with push access to `smbcloud-model`
10
11 ---
12
13 ## Steps
14
15 ### 1. Publish the Rust crate
16
17 Publish `smbcloud-model` to crates.io first. The gem's native extension depends on it.
18
19 ```sh
20 cargo publish -p smbcloud-model
21 ```
22
23 ### 2. Update the Cargo dependency
24
25 Switch `gems/model/ext/model/Cargo.toml` from the local path to the published version:
26
27 ```toml
28 # Before (development)
29 smbcloud-model = { path = "./../../../../crates/smbcloud-model" }
30
31 # After (release) — match the version just published
32 smbcloud-model = "0.3"
33 ```
34
35 ### 3. Sync the gem version
36
37 Set `gems/model/lib/model/version.rb` to match the `smbcloud-model` crate version:
38
39 ```ruby
40 module Model
41 VERSION = '0.3.31'
42 end
43 ```
44
45 ### 4. Compile the native extension
46
47 ```sh
48 cd gems/model
49 bundle exec rake compile
50 ```
51
52 ### 5. Build the gem
53
54 ```sh
55 bundle exec rake build
56 ```
57
58 This produces `pkg/smbcloud-model-<version>.gem`.
59
60 ### 6. Publish the gem
61
62 ```sh
63 gem push pkg/smbcloud-model-<version>.gem
64 ```
65
66 ---
67
68 ## Development workflow
69
70 To work against the local crate instead of the published one, use the path dependency:
71
72 ```toml
73 smbcloud-model = { path = "./../../../../crates/smbcloud-model" }
74 ```
75
76 Remember to revert this before publishing.