conversant 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env.example +39 -0
- data/.gitignore +52 -0
- data/.gitlab-ci.yml +108 -0
- data/.rspec +3 -0
- data/.rubocop.yml +16 -0
- data/.yardopts +7 -0
- data/CHANGELOG.md +487 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +860 -0
- data/RELEASE.md +726 -0
- data/Rakefile +21 -0
- data/conversant.gemspec +49 -0
- data/examples/inheritance_integration.rb +348 -0
- data/examples/rails_initializer.rb +69 -0
- data/lib/conversant/configuration.rb +132 -0
- data/lib/conversant/v3/base.rb +47 -0
- data/lib/conversant/v3/http_client.rb +456 -0
- data/lib/conversant/v3/mixins/authentication.rb +221 -0
- data/lib/conversant/v3/services/authorization.rb +194 -0
- data/lib/conversant/v3/services/cdn/analytics.rb +483 -0
- data/lib/conversant/v3/services/cdn/audit.rb +71 -0
- data/lib/conversant/v3/services/cdn/business.rb +122 -0
- data/lib/conversant/v3/services/cdn/certificate.rb +180 -0
- data/lib/conversant/v3/services/cdn/dashboard.rb +109 -0
- data/lib/conversant/v3/services/cdn/domain.rb +223 -0
- data/lib/conversant/v3/services/cdn/monitoring.rb +65 -0
- data/lib/conversant/v3/services/cdn/partner/analytics.rb +233 -0
- data/lib/conversant/v3/services/cdn/partner.rb +60 -0
- data/lib/conversant/v3/services/cdn.rb +221 -0
- data/lib/conversant/v3/services/lms/dashboard.rb +99 -0
- data/lib/conversant/v3/services/lms/domain.rb +108 -0
- data/lib/conversant/v3/services/lms/job.rb +211 -0
- data/lib/conversant/v3/services/lms/partner/analytics.rb +266 -0
- data/lib/conversant/v3/services/lms/partner/business.rb +151 -0
- data/lib/conversant/v3/services/lms/partner/report.rb +170 -0
- data/lib/conversant/v3/services/lms/partner.rb +58 -0
- data/lib/conversant/v3/services/lms/preset.rb +57 -0
- data/lib/conversant/v3/services/lms.rb +173 -0
- data/lib/conversant/v3/services/oss/partner/analytics.rb +105 -0
- data/lib/conversant/v3/services/oss/partner.rb +48 -0
- data/lib/conversant/v3/services/oss.rb +128 -0
- data/lib/conversant/v3/services/portal/dashboard.rb +114 -0
- data/lib/conversant/v3/services/portal.rb +219 -0
- data/lib/conversant/v3/services/vms/analytics.rb +114 -0
- data/lib/conversant/v3/services/vms/business.rb +190 -0
- data/lib/conversant/v3/services/vms/partner/analytics.rb +133 -0
- data/lib/conversant/v3/services/vms/partner/business.rb +90 -0
- data/lib/conversant/v3/services/vms/partner.rb +57 -0
- data/lib/conversant/v3/services/vms/transcoding.rb +184 -0
- data/lib/conversant/v3/services/vms.rb +166 -0
- data/lib/conversant/v3.rb +36 -0
- data/lib/conversant/version.rb +5 -0
- data/lib/conversant.rb +108 -0
- data/publish.sh +107 -0
- data/sig/conversant/v3/services/authorization.rbs +34 -0
- data/sig/conversant/v3/services/cdn.rbs +123 -0
- data/sig/conversant/v3/services/lms.rbs +80 -0
- data/sig/conversant/v3/services/portal.rbs +22 -0
- data/sig/conversant/v3/services/vms.rbs +64 -0
- data/sig/conversant/v3.rbs +85 -0
- data/sig/conversant.rbs +37 -0
- metadata +267 -0
data/RELEASE.md
ADDED
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
# Conversant Gem - Developer Guide
|
|
2
|
+
|
|
3
|
+
A complete guide for developing, publishing, and maintaining the Conversant Ruby gem.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Quick Start](#quick-start)
|
|
8
|
+
2. [Architecture](#architecture)
|
|
9
|
+
3. [Publishing the Gem](#publishing-the-gem)
|
|
10
|
+
4. [Version Management](#version-management)
|
|
11
|
+
5. [Documentation](#documentation)
|
|
12
|
+
6. [GitLab CI/CD](#gitlab-cicd)
|
|
13
|
+
7. [Troubleshooting](#troubleshooting)
|
|
14
|
+
8. [Common Issues & Solutions](#common-issues--solutions)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
|
|
22
|
+
- Ruby 2.7+ installed
|
|
23
|
+
- RubyGems account (https://rubygems.org)
|
|
24
|
+
- GitLab repository access
|
|
25
|
+
- Redis server (for testing)
|
|
26
|
+
|
|
27
|
+
### Initial Setup
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Clone the repository
|
|
31
|
+
git clone https://gitlab.vnetwork.dev/gems/conversant.git
|
|
32
|
+
cd conversant
|
|
33
|
+
|
|
34
|
+
# Install dependencies
|
|
35
|
+
bundle install
|
|
36
|
+
|
|
37
|
+
# Run tests
|
|
38
|
+
bundle exec rspec
|
|
39
|
+
|
|
40
|
+
# Generate documentation
|
|
41
|
+
bundle exec yard doc
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Architecture
|
|
47
|
+
|
|
48
|
+
### Directory Structure
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
lib/conversant/
|
|
52
|
+
├── v3/
|
|
53
|
+
│ ├── base.rb # Base class for all services
|
|
54
|
+
│ ├── http_client.rb # HTTP client module
|
|
55
|
+
│ ├── mixins/
|
|
56
|
+
│ │ └── authentication.rb # Authentication mixin
|
|
57
|
+
│ └── services/
|
|
58
|
+
│ ├── cdn.rb # Main CDN service class
|
|
59
|
+
│ ├── cdn/ # CDN nested services
|
|
60
|
+
│ │ ├── domain.rb # Domain management
|
|
61
|
+
│ │ ├── business.rb # Business metrics
|
|
62
|
+
│ │ └── certificate.rb # Certificate management
|
|
63
|
+
│ ├── lms.rb # Main LMS service class
|
|
64
|
+
│ ├── lms/ # LMS nested services
|
|
65
|
+
│ │ ├── domain.rb # LMS domain management
|
|
66
|
+
│ │ └── dashboard.rb # Dashboard metrics
|
|
67
|
+
│ ├── portal.rb # Portal service
|
|
68
|
+
│ └── vms.rb # VMS service
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Important: Loading Order
|
|
72
|
+
|
|
73
|
+
**Critical for Rails/Zeitwerk compatibility:**
|
|
74
|
+
|
|
75
|
+
1. Main service files (e.g., `cdn.rb`) define the parent class
|
|
76
|
+
2. Nested service files are loaded AFTER the parent class definition
|
|
77
|
+
3. This is achieved by placing `require_relative` statements at the END of the parent class file
|
|
78
|
+
|
|
79
|
+
```ruby
|
|
80
|
+
# lib/conversant/v3/services/cdn.rb
|
|
81
|
+
module Conversant
|
|
82
|
+
module V3
|
|
83
|
+
module Services
|
|
84
|
+
class CDN < ::Conversant::V3::Base
|
|
85
|
+
# ... class implementation ...
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# IMPORTANT: Load nested classes AFTER CDN is defined
|
|
92
|
+
require_relative 'cdn/domain'
|
|
93
|
+
require_relative 'cdn/business'
|
|
94
|
+
require_relative 'cdn/certificate'
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Class Hierarchy
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Conversant::V3::Base
|
|
101
|
+
├── Conversant::V3::Services::Portal
|
|
102
|
+
├── Conversant::V3::Services::CDN
|
|
103
|
+
│ ├── CDN::Analytics
|
|
104
|
+
│ ├── CDN::Monitoring
|
|
105
|
+
│ ├── CDN::Audit
|
|
106
|
+
│ ├── CDN::Domain
|
|
107
|
+
│ ├── CDN::Business
|
|
108
|
+
│ └── CDN::Certificate
|
|
109
|
+
├── Conversant::V3::Services::LMS
|
|
110
|
+
│ ├── LMS::Job
|
|
111
|
+
│ ├── LMS::Domain
|
|
112
|
+
│ └── LMS::Dashboard
|
|
113
|
+
└── Conversant::V3::Services::VMS
|
|
114
|
+
├── VMS::VodTranscoding
|
|
115
|
+
├── VMS::Analytics
|
|
116
|
+
└── VMS::Business
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Type Signatures (RBS)
|
|
120
|
+
|
|
121
|
+
Type signatures are located in `sig/` directory:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
sig/conversant/
|
|
125
|
+
├── v3.rbs # V3 module types
|
|
126
|
+
├── v3/
|
|
127
|
+
│ └── services/
|
|
128
|
+
│ ├── cdn.rbs # CDN service types
|
|
129
|
+
│ ├── cdn/
|
|
130
|
+
│ │ ├── analytics.rbs
|
|
131
|
+
│ │ ├── domain.rbs
|
|
132
|
+
│ │ └── ...
|
|
133
|
+
│ ├── lms.rbs # LMS service types
|
|
134
|
+
│ ├── portal.rbs # Portal service types
|
|
135
|
+
│ └── vms.rbs # VMS service types
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Publishing the Gem
|
|
141
|
+
|
|
142
|
+
### First-Time Setup
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Login to RubyGems (one-time)
|
|
146
|
+
gem signin
|
|
147
|
+
# Enter your RubyGems.org credentials
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Quick Publish Commands
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Option 1: Automated script (recommended)
|
|
154
|
+
./publish.sh
|
|
155
|
+
|
|
156
|
+
# Option 2: Manual commands
|
|
157
|
+
gem build conversant.gemspec
|
|
158
|
+
gem push conversant-1.0.0.gem
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Step-by-Step Manual Publishing
|
|
162
|
+
|
|
163
|
+
#### 1. Prepare the Gem
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Clean previous builds
|
|
167
|
+
rm -f *.gem
|
|
168
|
+
|
|
169
|
+
# Run tests
|
|
170
|
+
bundle exec rspec
|
|
171
|
+
|
|
172
|
+
# Build the gem
|
|
173
|
+
gem build conversant.gemspec
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### 2. Verify the Build
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Check gem contents
|
|
180
|
+
gem specification conversant-1.0.0.gem
|
|
181
|
+
|
|
182
|
+
# Test local installation
|
|
183
|
+
gem install ./conversant-1.0.0.gem
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### 3. Publish to RubyGems
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Push to RubyGems.org
|
|
190
|
+
gem push conversant-1.0.0.gem
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### 4. Push to GitLab
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Initialize git (if needed)
|
|
197
|
+
git init
|
|
198
|
+
git remote add origin https://gitlab.vnetwork.dev/gems/conversant.git
|
|
199
|
+
|
|
200
|
+
# Commit and push
|
|
201
|
+
git add .
|
|
202
|
+
git commit -m "Release version 1.0.0"
|
|
203
|
+
git push -u origin main
|
|
204
|
+
|
|
205
|
+
# Create and push tag
|
|
206
|
+
git tag -a v1.0.0 -m "Release version 1.0.0"
|
|
207
|
+
git push origin v1.0.0
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Publishing Checklist
|
|
211
|
+
|
|
212
|
+
- [ ] Tests passing (`bundle exec rspec`)
|
|
213
|
+
- [ ] Version updated in `lib/conversant/version.rb`
|
|
214
|
+
- [ ] CHANGELOG.md updated
|
|
215
|
+
- [ ] Documentation generated (`bundle exec yard doc`)
|
|
216
|
+
- [ ] Gem builds without warnings
|
|
217
|
+
- [ ] README.md is current
|
|
218
|
+
- [ ] Commit all changes
|
|
219
|
+
- [ ] Tag the release
|
|
220
|
+
- [ ] Push to RubyGems (`gem push conversant-X.Y.Z.gem`)
|
|
221
|
+
- [ ] Wait 1-2 hours for RubyDoc.info to process automatically
|
|
222
|
+
- [ ] Visit https://rubydoc.info/gems/conversant to check/trigger docs
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Version Management
|
|
227
|
+
|
|
228
|
+
### Semantic Versioning
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
MAJOR.MINOR.PATCH
|
|
232
|
+
|
|
233
|
+
1.0.0 -> 1.0.1 # Patch: Bug fixes
|
|
234
|
+
1.0.0 -> 1.1.0 # Minor: New features (backward compatible)
|
|
235
|
+
1.0.0 -> 2.0.0 # Major: Breaking changes
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Releasing a New Version
|
|
239
|
+
|
|
240
|
+
#### 1. Update Version
|
|
241
|
+
|
|
242
|
+
```ruby
|
|
243
|
+
# lib/conversant/version.rb
|
|
244
|
+
module Conversant
|
|
245
|
+
VERSION = "1.0.1"
|
|
246
|
+
end
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### 2. Update CHANGELOG
|
|
250
|
+
|
|
251
|
+
```markdown
|
|
252
|
+
## [1.0.1] - 2025-01-02
|
|
253
|
+
### Fixed
|
|
254
|
+
- Bug fixes from version 1.0.0
|
|
255
|
+
### Added
|
|
256
|
+
- New feature description
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### 3. Build and Publish
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Commit changes
|
|
263
|
+
git add -A
|
|
264
|
+
git commit -m "Bump version to 1.0.1"
|
|
265
|
+
|
|
266
|
+
# Build and publish
|
|
267
|
+
gem build conversant.gemspec
|
|
268
|
+
gem push conversant-1.0.1.gem
|
|
269
|
+
|
|
270
|
+
# Tag release
|
|
271
|
+
git tag -a v1.0.1 -m "Release version 1.0.1"
|
|
272
|
+
git push origin main --tags
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Managing Published Versions
|
|
276
|
+
|
|
277
|
+
#### Yank a Version (Recommended)
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# Remove version from RubyGems (keeps for existing users)
|
|
281
|
+
gem yank conversant -v 1.0.0
|
|
282
|
+
|
|
283
|
+
# Undo yank if needed
|
|
284
|
+
gem yank conversant -v 1.0.0 --undo
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### Check Published Versions
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# List remote versions
|
|
291
|
+
gem list conversant --remote --all
|
|
292
|
+
|
|
293
|
+
# Check if gem exists
|
|
294
|
+
gem search ^conversant$ --remote
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### Important Notes
|
|
298
|
+
|
|
299
|
+
- **Yanked versions cannot be republished** with the same number
|
|
300
|
+
- **Always bump version** after yanking
|
|
301
|
+
- **Prefer yanking over deletion** to avoid breaking existing apps
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Documentation
|
|
306
|
+
|
|
307
|
+
### Generating Documentation
|
|
308
|
+
|
|
309
|
+
#### Local Generation
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Generate HTML documentation
|
|
313
|
+
bundle exec yard doc
|
|
314
|
+
|
|
315
|
+
# With statistics
|
|
316
|
+
bundle exec yard doc --stats
|
|
317
|
+
|
|
318
|
+
# Serve documentation locally
|
|
319
|
+
bundle exec yard server
|
|
320
|
+
# Visit http://localhost:8808
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### Check Coverage
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
bundle exec yard stats
|
|
327
|
+
|
|
328
|
+
# Example output:
|
|
329
|
+
# Files: 10
|
|
330
|
+
# Modules: 7 ( 5 undocumented)
|
|
331
|
+
# Classes: 12 ( 9 undocumented)
|
|
332
|
+
# Methods: 45 ( 27 undocumented)
|
|
333
|
+
# 48.31% documented
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Publishing to RubyDoc.info
|
|
337
|
+
|
|
338
|
+
#### Automatic Processing
|
|
339
|
+
|
|
340
|
+
RubyDoc.info automatically generates documentation for published gems:
|
|
341
|
+
|
|
342
|
+
1. **Wait 10-30 minutes** after publishing
|
|
343
|
+
2. Visit: https://rubydoc.info/gems/conversant/1.0.10
|
|
344
|
+
3. Documentation should appear automatically
|
|
345
|
+
|
|
346
|
+
#### Manual Trigger
|
|
347
|
+
|
|
348
|
+
If documentation doesn't appear:
|
|
349
|
+
|
|
350
|
+
1. **Visit**: https://rubydoc.info/gems/conversant/1.0.10/index
|
|
351
|
+
2. Click **"Build Docs"** button if available
|
|
352
|
+
3. Or visit: https://rubydoc.info/gems/conversant/frames
|
|
353
|
+
|
|
354
|
+
#### Triggering RubyDoc.info Documentation Generation
|
|
355
|
+
|
|
356
|
+
If documentation is not generating after 30+ minutes:
|
|
357
|
+
|
|
358
|
+
**Method 1: Webhook API (Recommended)**
|
|
359
|
+
Trigger documentation build via POST request (returns HTTP 202 on success):
|
|
360
|
+
```bash
|
|
361
|
+
# Use the appropriate RubyDoc.info webhook endpoint
|
|
362
|
+
# Note: Replace with the correct endpoint your team discovered
|
|
363
|
+
curl https://rubydoc.info/gems/conversant/1.0.10/index
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**Method 2: Direct URL Access**
|
|
367
|
+
Simply visit the gem's documentation URL in your browser:
|
|
368
|
+
```
|
|
369
|
+
https://rubydoc.info/gems/conversant/1.0.10
|
|
370
|
+
```
|
|
371
|
+
This often triggers the documentation generation process.
|
|
372
|
+
|
|
373
|
+
**Method 3: Yank and Republish (Last Resort)**
|
|
374
|
+
If docs still don't appear after several hours:
|
|
375
|
+
```bash
|
|
376
|
+
# 1. Yank the current version
|
|
377
|
+
gem yank conversant -v 1.0.6
|
|
378
|
+
|
|
379
|
+
# 2. Bump the patch version
|
|
380
|
+
# Edit lib/conversant/version.rb: VERSION = "1.0.7"
|
|
381
|
+
|
|
382
|
+
# 3. Rebuild and republish
|
|
383
|
+
gem build conversant.gemspec
|
|
384
|
+
gem push conversant-1.0.7.gem
|
|
385
|
+
|
|
386
|
+
# 4. Wait 10-30 minutes and visit https://rubydoc.info/gems/conversant
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
#### Troubleshooting Missing Documentation
|
|
390
|
+
|
|
391
|
+
If you see "We haven't generated any docs for conversant" on RubyDoc.info:
|
|
392
|
+
|
|
393
|
+
**Step-by-step solution:**
|
|
394
|
+
|
|
395
|
+
1. **Verify gem is published:**
|
|
396
|
+
```bash
|
|
397
|
+
# Check gem exists on RubyGems
|
|
398
|
+
gem list conversant --remote --all
|
|
399
|
+
|
|
400
|
+
# View gem metadata (should show your gem info)
|
|
401
|
+
curl https://rubygems.org/api/v1/gems/conversant.json
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
2. **Wait patiently**: First-time gems can take **1-2 hours** to process
|
|
405
|
+
|
|
406
|
+
3. **Visit directly**: Access https://rubydoc.info/gems/conversant in your browser
|
|
407
|
+
|
|
408
|
+
4. **Check YARD compatibility locally:**
|
|
409
|
+
```bash
|
|
410
|
+
bundle exec yard doc --debug
|
|
411
|
+
# Should complete without errors
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
5. **Verify gemspec metadata**: Confirm `documentation_uri` is set (already configured in conversant.gemspec)
|
|
415
|
+
|
|
416
|
+
6. **Try alternative version URL**: https://rubydoc.info/gems/conversant/1.0.6/frames
|
|
417
|
+
|
|
418
|
+
**Common causes:**
|
|
419
|
+
- Gem was just published (patience required - can take up to 2 hours)
|
|
420
|
+
- RubyDoc.info processing queue is busy (retry next day)
|
|
421
|
+
- YARD parsing errors in code comments (check with `yard doc --debug`)
|
|
422
|
+
- Gem name conflicts or special characters
|
|
423
|
+
|
|
424
|
+
**Important Notes:**
|
|
425
|
+
- RubyDoc.info processes gems automatically from RubyGems.org
|
|
426
|
+
- There is no official webhook/API to force processing
|
|
427
|
+
- If docs don't appear after 24 hours, consider reporting to RubyDoc.info
|
|
428
|
+
- Alternative: Host docs yourself with `yard doc` and GitHub Pages
|
|
429
|
+
|
|
430
|
+
### Documentation URLs
|
|
431
|
+
|
|
432
|
+
Once processed, documentation is available at:
|
|
433
|
+
|
|
434
|
+
- **Latest**: https://rubydoc.info/gems/conversant
|
|
435
|
+
- **Specific Version**: https://rubydoc.info/gems/conversant/1.0.0
|
|
436
|
+
- **README**: https://rubydoc.info/gems/conversant/file/README.md
|
|
437
|
+
- **API Docs**: https://rubydoc.info/gems/conversant/Conversant
|
|
438
|
+
|
|
439
|
+
### Writing YARD Documentation
|
|
440
|
+
|
|
441
|
+
#### Basic Method Documentation
|
|
442
|
+
|
|
443
|
+
```ruby
|
|
444
|
+
# Description of the method
|
|
445
|
+
#
|
|
446
|
+
# @param customer_id [String, Integer] customer identifier
|
|
447
|
+
# @param options [Hash] additional options
|
|
448
|
+
#
|
|
449
|
+
# @return [Hash] response data
|
|
450
|
+
# @raise [AuthenticationError] if auth fails
|
|
451
|
+
#
|
|
452
|
+
# @example
|
|
453
|
+
# portal = Conversant::V3.portal('12345')
|
|
454
|
+
# data = portal.appliances
|
|
455
|
+
#
|
|
456
|
+
# @since 1.0.0
|
|
457
|
+
def appliances(gte = nil, lte = nil)
|
|
458
|
+
# implementation
|
|
459
|
+
end
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
#### Best Practices
|
|
463
|
+
|
|
464
|
+
1. Document all public methods
|
|
465
|
+
2. Include parameter types and descriptions
|
|
466
|
+
3. Add usage examples
|
|
467
|
+
4. Specify return types
|
|
468
|
+
5. List possible exceptions
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## GitLab CI/CD
|
|
473
|
+
|
|
474
|
+
### Pipeline Configuration
|
|
475
|
+
|
|
476
|
+
The `.gitlab-ci.yml` file configures automated testing and publishing:
|
|
477
|
+
|
|
478
|
+
```yaml
|
|
479
|
+
stages:
|
|
480
|
+
- test
|
|
481
|
+
- build
|
|
482
|
+
- publish
|
|
483
|
+
|
|
484
|
+
# Test on multiple Ruby versions
|
|
485
|
+
test:ruby-3.0:
|
|
486
|
+
stage: test
|
|
487
|
+
image: ruby:3.0
|
|
488
|
+
script:
|
|
489
|
+
- bundle install
|
|
490
|
+
- bundle exec rspec
|
|
491
|
+
|
|
492
|
+
# Build gem
|
|
493
|
+
build:
|
|
494
|
+
stage: build
|
|
495
|
+
script:
|
|
496
|
+
- gem build conversant.gemspec
|
|
497
|
+
artifacts:
|
|
498
|
+
paths:
|
|
499
|
+
- "*.gem"
|
|
500
|
+
|
|
501
|
+
# Publish to RubyGems (manual)
|
|
502
|
+
publish:rubygems:
|
|
503
|
+
stage: publish
|
|
504
|
+
script:
|
|
505
|
+
- gem push *.gem
|
|
506
|
+
when: manual
|
|
507
|
+
only:
|
|
508
|
+
- tags
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### Setting Up CI/CD Variables
|
|
512
|
+
|
|
513
|
+
1. Go to: https://gitlab.vnetwork.dev/gems/conversant/-/settings/ci_cd
|
|
514
|
+
2. Add Variable: `RUBYGEMS_API_KEY` = your RubyGems API key
|
|
515
|
+
3. Mark as "Protected" and "Masked"
|
|
516
|
+
|
|
517
|
+
### Triggering Automated Publishing
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
# Create tag to trigger pipeline
|
|
521
|
+
git tag -a v1.0.1 -m "Release version 1.0.1"
|
|
522
|
+
git push origin v1.0.1
|
|
523
|
+
|
|
524
|
+
# Go to GitLab pipelines and manually trigger publish job
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## Troubleshooting
|
|
530
|
+
|
|
531
|
+
### Common Issues and Solutions
|
|
532
|
+
|
|
533
|
+
#### Gem Build Failures
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
# Validate gemspec
|
|
537
|
+
ruby -c conversant.gemspec
|
|
538
|
+
gem build conversant.gemspec --strict
|
|
539
|
+
|
|
540
|
+
# Check for missing files
|
|
541
|
+
git ls-files -z
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
#### Authentication Issues
|
|
545
|
+
|
|
546
|
+
```bash
|
|
547
|
+
# Reset RubyGems credentials
|
|
548
|
+
rm ~/.gem/credentials
|
|
549
|
+
gem signin
|
|
550
|
+
|
|
551
|
+
# Check ownership
|
|
552
|
+
gem owner conversant
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
#### Documentation Not Showing on RubyDoc.info
|
|
556
|
+
|
|
557
|
+
**Issue**: "We haven't generated any docs for conversant" message
|
|
558
|
+
|
|
559
|
+
**Solutions** (in order):
|
|
560
|
+
|
|
561
|
+
1. **Check gem is published:**
|
|
562
|
+
```bash
|
|
563
|
+
gem list conversant --remote --all
|
|
564
|
+
curl https://rubygems.org/api/v1/gems/conversant.json
|
|
565
|
+
|
|
566
|
+
curl -X POST "https://www.rubydoc.info/gems/conversant/1.0.6"
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
2. **Wait 1-2 hours** for RubyDoc.info automatic processing (first-time gems take longer)
|
|
570
|
+
|
|
571
|
+
3. **Visit directly** to trigger/check processing:
|
|
572
|
+
- https://rubydoc.info/gems/conversant
|
|
573
|
+
- https://rubydoc.info/gems/conversant/1.0.6/frames
|
|
574
|
+
|
|
575
|
+
4. **Check for YARD parsing errors locally:**
|
|
576
|
+
```bash
|
|
577
|
+
bundle exec yard doc --debug
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
5. **Verify gem metadata includes documentation_uri** (already configured in conversant.gemspec)
|
|
581
|
+
|
|
582
|
+
6. **Last resort - yank and republish with bumped version:**
|
|
583
|
+
```bash
|
|
584
|
+
gem yank conversant -v 1.0.6
|
|
585
|
+
# Update version in lib/conversant/version.rb
|
|
586
|
+
gem build conversant.gemspec
|
|
587
|
+
gem push conversant-1.0.7.gem
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
**Important**:
|
|
591
|
+
- First-time gems can take 1-2 hours to process
|
|
592
|
+
- RubyDoc.info has no official webhook/API to force processing
|
|
593
|
+
- Be patient and check back the next day if needed
|
|
594
|
+
|
|
595
|
+
#### Version Already Exists
|
|
596
|
+
|
|
597
|
+
```bash
|
|
598
|
+
# Yank the version
|
|
599
|
+
gem yank conversant -v 1.0.0
|
|
600
|
+
|
|
601
|
+
# Bump version number
|
|
602
|
+
# Edit lib/conversant/version.rb
|
|
603
|
+
|
|
604
|
+
# Republish with new version
|
|
605
|
+
gem build conversant.gemspec
|
|
606
|
+
gem push conversant-1.0.1.gem
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
#### Name Already Taken
|
|
610
|
+
|
|
611
|
+
If "conversant" is taken, update:
|
|
612
|
+
- `conversant.gemspec` (spec.name)
|
|
613
|
+
- `lib/conversant/version.rb`
|
|
614
|
+
- All documentation references
|
|
615
|
+
|
|
616
|
+
### Debugging Tips
|
|
617
|
+
|
|
618
|
+
#### Test Locally Before Publishing
|
|
619
|
+
|
|
620
|
+
```bash
|
|
621
|
+
# Build and install locally
|
|
622
|
+
gem build conversant.gemspec
|
|
623
|
+
gem install ./conversant-1.0.0.gem
|
|
624
|
+
|
|
625
|
+
# Test in IRB
|
|
626
|
+
irb
|
|
627
|
+
> require 'conversant'
|
|
628
|
+
> Conversant::VERSION
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### Verbose Mode
|
|
632
|
+
|
|
633
|
+
```bash
|
|
634
|
+
# Build with verbose output
|
|
635
|
+
gem build conversant.gemspec --verbose
|
|
636
|
+
|
|
637
|
+
# Push with verbose output
|
|
638
|
+
gem push conversant-1.0.0.gem --verbose
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
#### Check Network Issues
|
|
642
|
+
|
|
643
|
+
```bash
|
|
644
|
+
# Test RubyGems API
|
|
645
|
+
curl https://rubygems.org/api/v1/gems/conversant.json
|
|
646
|
+
|
|
647
|
+
# Test authentication
|
|
648
|
+
gem list --remote --source https://rubygems.org
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
---
|
|
652
|
+
|
|
653
|
+
## Quick Reference
|
|
654
|
+
|
|
655
|
+
### Essential Commands
|
|
656
|
+
|
|
657
|
+
```bash
|
|
658
|
+
# Development
|
|
659
|
+
bundle install # Install dependencies
|
|
660
|
+
bundle exec rspec # Run tests
|
|
661
|
+
bundle exec yard doc # Generate docs
|
|
662
|
+
bundle exec yard server # Serve docs locally
|
|
663
|
+
|
|
664
|
+
# Building
|
|
665
|
+
gem build conversant.gemspec # Build gem
|
|
666
|
+
gem install ./conversant-*.gem # Test locally
|
|
667
|
+
|
|
668
|
+
# Publishing
|
|
669
|
+
gem signin # Login to RubyGems
|
|
670
|
+
gem push conversant-*.gem # Publish to RubyGems
|
|
671
|
+
./publish.sh # Automated publish script
|
|
672
|
+
|
|
673
|
+
# Version Management
|
|
674
|
+
gem yank conversant -v 1.0.0 # Remove version
|
|
675
|
+
gem list conversant --remote --all # List versions
|
|
676
|
+
gem owner conversant # Check ownership
|
|
677
|
+
|
|
678
|
+
# Git
|
|
679
|
+
git tag -a v1.0.0 -m "Release v1.0.0" # Create tag
|
|
680
|
+
git push origin main --tags # Push with tags
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
### Important Files
|
|
684
|
+
|
|
685
|
+
```
|
|
686
|
+
conversant-gem/
|
|
687
|
+
├── lib/
|
|
688
|
+
│ ├── conversant.rb # Main entry point
|
|
689
|
+
│ └── conversant/
|
|
690
|
+
│ ├── version.rb # Version definition
|
|
691
|
+
│ ├── configuration.rb # Configuration
|
|
692
|
+
│ └── v3/ # V3 implementation
|
|
693
|
+
├── spec/ # Tests
|
|
694
|
+
├── conversant.gemspec # Gem specification
|
|
695
|
+
├── Gemfile # Dependencies
|
|
696
|
+
├── README.md # User documentation
|
|
697
|
+
├── CHANGELOG.md # Version history
|
|
698
|
+
├── LICENSE.txt # MIT License
|
|
699
|
+
├── .gitlab-ci.yml # CI/CD configuration
|
|
700
|
+
├── .yardopts # Documentation settings
|
|
701
|
+
└── publish.sh # Publishing script
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
### Useful Links
|
|
705
|
+
|
|
706
|
+
- **Gem on RubyGems**: https://rubygems.org/gems/conversant
|
|
707
|
+
- **GitLab Repository**: https://gitlab.vnetwork.dev/gems/conversant
|
|
708
|
+
- **Documentation**: https://rubydoc.info/gems/conversant
|
|
709
|
+
- **RubyGems Guides**: https://guides.rubygems.org/
|
|
710
|
+
- **YARD Documentation**: https://yardoc.org/
|
|
711
|
+
|
|
712
|
+
### Support
|
|
713
|
+
|
|
714
|
+
For issues or questions:
|
|
715
|
+
- Create an issue: https://gitlab.vnetwork.dev/gems/conversant/-/issues
|
|
716
|
+
- Email: tho.nguyen@vnetwork.vn
|
|
717
|
+
|
|
718
|
+
---
|
|
719
|
+
|
|
720
|
+
## Version History
|
|
721
|
+
|
|
722
|
+
See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
|
723
|
+
|
|
724
|
+
## License
|
|
725
|
+
|
|
726
|
+
This gem is available under the [MIT License](LICENSE.txt).
|