A PowerShell module for automating the Ruby Gem lifecycle. It bridges JSON configuration to .gemspec generation, providing a unified interface for building, verifying, and publishing gems.
Import the module directly into your session or add it to your $PSModulePath.
Import-Module ./GemCommander.psm1All operations are routed through the Invoke-GemCommander controller using parameter sets.
Generates a .gemspec from a JSON configuration file and runs gem build.
Configuration (build_config.json)
{
"name": "my-tool",
"version": "1.0.0",
"authors": "DevOps Team",
"email": "admin@example.com",
"summary": "CLI utilities",
"homepage": "[https://gitlab.com/group/project](https://gitlab.com/group/project)",
"license": "MIT",
"description": "Extended description for the gem.",
"files": [
"lib/my_tool.rb",
"README.md"
]
}Command
Invoke-GemCommander -Command_Build Build -Path "./build_config.json"Pushes a compiled .gem file to a repository.
# Default (RubyGems.org)
Invoke-GemCommander -Command_Publish Publish -Path "./my-tool-1.0.0.gem"
# Private Registry (e.g., GitHub/GitLab Package Registry)
Invoke-GemCommander -Command_Publish Publish -Path "./my-tool-1.0.0.gem" -Source "[https://rubygems.pkg.github.com/OWNER](https://rubygems.pkg.github.com/OWNER)" -ApiKey $Env:GEM_HOST_API_KEYCreates a boilerplate .gemspec file.
# Types: Full, Compact, Minimal
Invoke-GemCommander -Command_Template Template -Path "./new-project.gemspec" -TemplateType CompactValidates syntax and dependencies using gem spec.
Invoke-GemCommander -Command_Verify Verify -Path "./my-tool.gemspec"Searches remote repositories.
Invoke-GemCommander -Command_Find Find -Name "rails"
| Parameter Set | Parameter | Description |
|---|---|---|
| Build | -Path |
Path to build_config.json. |
| Publish | -Path |
Path to .gem file. |
-Source |
(Optional) Custom registry URL. | |
-ApiKey |
(Optional) API key for authentication. | |
| Template | -Path |
Output path for .gemspec. |
-TemplateType |
Full, Compact, or Minimal. |
|
| Verify | -Path |
Path to .gemspec to validate. |
| Find | -Name |
Name of the gem to search for. |
- PowerShell 5.1 or PowerShell Core 7+
- Ruby development environment (CLI tools
gemmust be in$env:PATH)