gemvault 0.1.1
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/.rspec +3 -0
- data/.rubocop.yml +181 -0
- data/.ruby-version +1 -0
- data/ASSESSMENT.md +88 -0
- data/CLAUDE.md +76 -0
- data/Dockerfile.test +11 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/MACROPLAN.md +63 -0
- data/README.md +74 -0
- data/Rakefile +39 -0
- data/docs/superpowers/plans/2026-04-16-container-integration-tests.md +605 -0
- data/exe/gemvault +5 -0
- data/lib/bundler/plugin/vault_source.rb +117 -0
- data/lib/gemvault/cli/command.rb +17 -0
- data/lib/gemvault/cli/commands/add.rb +30 -0
- data/lib/gemvault/cli/commands/extract.rb +49 -0
- data/lib/gemvault/cli/commands/list.rb +26 -0
- data/lib/gemvault/cli/commands/new.rb +28 -0
- data/lib/gemvault/cli/commands/remove.rb +34 -0
- data/lib/gemvault/cli.rb +45 -0
- data/lib/gemvault/gem_entry.rb +37 -0
- data/lib/gemvault/vault.rb +178 -0
- data/lib/gemvault/version.rb +3 -0
- data/lib/gemvault.rb +10 -0
- data/lib/rubygems/resolver/vault_set.rb +39 -0
- data/lib/rubygems/source/vault.rb +124 -0
- data/lib/rubygems_plugin.rb +72 -0
- metadata +116 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7de6dc35280e873a80b18d4619ef13b789525cc2e071417acbd80fe65d040ada
|
|
4
|
+
data.tar.gz: 8520005cc49b5eead43706f03c622063b330c5e391ab3d8966c6e69b4482d267
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 34f5e6485abe04eaed2f39b10bf7394b89d7e7f0b3f3bd8b51b60aeeed43e140ef1b4c43e20ed0f73d6f8f60f81dcdd98eb818af67d17297db655bd239535d03
|
|
7
|
+
data.tar.gz: 52dc205f6c9f989a52881d14ebb828ab0cd8733bfad990db472307393ca62cac444ee539070f95efac91e447e4fce319730d83cb058ad697e44867a2a3876f62
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# ===========================================================================
|
|
2
|
+
# RuboCop Configuration
|
|
3
|
+
#
|
|
4
|
+
# Base: Stock RuboCop defaults
|
|
5
|
+
# AI guardrails: rubocop-claude plugin (all Claude/ cops + stricter metrics)
|
|
6
|
+
# Performance: rubocop-performance (with chain-hostile cops disabled)
|
|
7
|
+
#
|
|
8
|
+
# Philosophy: idiomatic Ruby, pipeline-style chaining, strict for AI agents,
|
|
9
|
+
# readable for humans.
|
|
10
|
+
# ===========================================================================
|
|
11
|
+
|
|
12
|
+
plugins:
|
|
13
|
+
- rubocop-claude
|
|
14
|
+
- rubocop-rspec
|
|
15
|
+
- rubocop-performance
|
|
16
|
+
- rubocop-rake
|
|
17
|
+
|
|
18
|
+
AllCops:
|
|
19
|
+
NewCops: enable
|
|
20
|
+
TargetRubyVersion: 4.0
|
|
21
|
+
Exclude:
|
|
22
|
+
- bin/*
|
|
23
|
+
- vendor/**/*
|
|
24
|
+
- lib/core_ext/**/*
|
|
25
|
+
- rakelib/project.rb
|
|
26
|
+
- rakelib/project_version.rb
|
|
27
|
+
- rakelib/version_tag.rb
|
|
28
|
+
- rakelib/github_release.rb
|
|
29
|
+
- rakelib/strict_shell.rb
|
|
30
|
+
|
|
31
|
+
# ===========================================================================
|
|
32
|
+
# Overrides from stock — personal style preferences
|
|
33
|
+
# ===========================================================================
|
|
34
|
+
|
|
35
|
+
# Double quotes everywhere. One less decision to make.
|
|
36
|
+
Style/StringLiterals:
|
|
37
|
+
EnforcedStyle: double_quotes
|
|
38
|
+
|
|
39
|
+
Style/StringLiteralsInInterpolation:
|
|
40
|
+
EnforcedStyle: double_quotes
|
|
41
|
+
|
|
42
|
+
# Frozen string literal is transitional cruft. Ruby 3.4 has chilled strings,
|
|
43
|
+
# full default freeze is coming in a future Ruby.
|
|
44
|
+
Style/FrozenStringLiteralComment:
|
|
45
|
+
EnforcedStyle: never
|
|
46
|
+
|
|
47
|
+
# Pipeline style. Chaining multi-line blocks is the whole point.
|
|
48
|
+
Style/MultilineBlockChain:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
# Block delimiters are a taste call. Pipeline code uses braces for chaining,
|
|
52
|
+
# do/end for side effects. No cop captures this nuance.
|
|
53
|
+
Style/BlockDelimiters:
|
|
54
|
+
Enabled: false
|
|
55
|
+
|
|
56
|
+
# Write arrays like arrays.
|
|
57
|
+
Style/WordArray:
|
|
58
|
+
Enabled: false
|
|
59
|
+
|
|
60
|
+
Style/SymbolArray:
|
|
61
|
+
Enabled: false
|
|
62
|
+
|
|
63
|
+
# Argument indentation: consistent 2-space indent, not aligned to first arg.
|
|
64
|
+
Layout/FirstArgumentIndentation:
|
|
65
|
+
EnforcedStyle: consistent
|
|
66
|
+
|
|
67
|
+
# Dot-aligned chaining. Dots form a visual column.
|
|
68
|
+
Layout/MultilineMethodCallIndentation:
|
|
69
|
+
EnforcedStyle: aligned
|
|
70
|
+
|
|
71
|
+
# ===========================================================================
|
|
72
|
+
# Overrides from rubocop-claude — loosen where pipeline style conflicts
|
|
73
|
+
# ===========================================================================
|
|
74
|
+
|
|
75
|
+
Claude/NoOverlyDefensiveCode:
|
|
76
|
+
MaxSafeNavigationChain: 2
|
|
77
|
+
|
|
78
|
+
Style/SafeNavigation:
|
|
79
|
+
MaxChainLength: 2
|
|
80
|
+
|
|
81
|
+
# Allow `return a, b` for tuple-style returns.
|
|
82
|
+
Style/RedundantReturn:
|
|
83
|
+
AllowMultipleReturnValues: true
|
|
84
|
+
|
|
85
|
+
# ===========================================================================
|
|
86
|
+
# Overrides from rubocop-performance — disable chain-hostile cops
|
|
87
|
+
# ===========================================================================
|
|
88
|
+
|
|
89
|
+
Performance/ChainArrayAllocation:
|
|
90
|
+
Enabled: false
|
|
91
|
+
|
|
92
|
+
Performance/MapMethodChain:
|
|
93
|
+
Enabled: false
|
|
94
|
+
|
|
95
|
+
# ===========================================================================
|
|
96
|
+
# Additional tightening — not set by stock or rubocop-claude
|
|
97
|
+
# ===========================================================================
|
|
98
|
+
|
|
99
|
+
# Short blocks push toward small chained steps instead of fat lambdas.
|
|
100
|
+
Metrics/BlockLength:
|
|
101
|
+
Max: 8
|
|
102
|
+
CountAsOne:
|
|
103
|
+
- array
|
|
104
|
+
- hash
|
|
105
|
+
- heredoc
|
|
106
|
+
- method_call
|
|
107
|
+
AllowedMethods:
|
|
108
|
+
- command
|
|
109
|
+
- describe
|
|
110
|
+
- context
|
|
111
|
+
- shared_examples
|
|
112
|
+
- shared_examples_for
|
|
113
|
+
- shared_context
|
|
114
|
+
Exclude:
|
|
115
|
+
- "gemvault.gemspec"
|
|
116
|
+
- "rakelib/**/*"
|
|
117
|
+
|
|
118
|
+
# Gemspec and rake files use patterns that trigger Claude cops legitimately.
|
|
119
|
+
Claude/NoFancyUnicode:
|
|
120
|
+
Exclude:
|
|
121
|
+
- "gemvault.gemspec"
|
|
122
|
+
|
|
123
|
+
Claude/MysteryRegex:
|
|
124
|
+
Exclude:
|
|
125
|
+
- "rakelib/**/*"
|
|
126
|
+
|
|
127
|
+
# Shared test contexts legitimately define many helpers.
|
|
128
|
+
RSpec/MultipleMemoizedHelpers:
|
|
129
|
+
Max: 10
|
|
130
|
+
|
|
131
|
+
# Anonymous forwarding (*, **, &) breaks TruffleRuby, JRuby, and
|
|
132
|
+
# Ruby < 3.2. Named args are explicit and portable.
|
|
133
|
+
Style/ArgumentsForwarding:
|
|
134
|
+
Enabled: false
|
|
135
|
+
|
|
136
|
+
# Explicit begin/rescue/end is clearer than implicit method-body rescue.
|
|
137
|
+
Style/RedundantBegin:
|
|
138
|
+
Enabled: false
|
|
139
|
+
|
|
140
|
+
# Compact class names are fine for small files and tests.
|
|
141
|
+
Style/ClassAndModuleChildren:
|
|
142
|
+
Enabled: false
|
|
143
|
+
|
|
144
|
+
# Classes get rdoc.
|
|
145
|
+
Style/Documentation:
|
|
146
|
+
Enabled: true
|
|
147
|
+
Exclude:
|
|
148
|
+
- "spec/**/*"
|
|
149
|
+
|
|
150
|
+
# Trailing commas in multiline literals and arguments.
|
|
151
|
+
Style/TrailingCommaInArrayLiteral:
|
|
152
|
+
EnforcedStyleForMultiline: comma
|
|
153
|
+
|
|
154
|
+
Style/TrailingCommaInHashLiteral:
|
|
155
|
+
EnforcedStyleForMultiline: comma
|
|
156
|
+
|
|
157
|
+
Style/TrailingCommaInArguments:
|
|
158
|
+
EnforcedStyleForMultiline: comma
|
|
159
|
+
|
|
160
|
+
# ===========================================================================
|
|
161
|
+
# RSpec — rubocop-rspec overrides
|
|
162
|
+
# ===========================================================================
|
|
163
|
+
|
|
164
|
+
# Not every describe block wraps a class.
|
|
165
|
+
RSpec/DescribeClass:
|
|
166
|
+
Enabled: false
|
|
167
|
+
|
|
168
|
+
# Subject placement is a readability call, not a rule.
|
|
169
|
+
RSpec/LeadingSubject:
|
|
170
|
+
Enabled: false
|
|
171
|
+
|
|
172
|
+
# Block style for expect { }.to change { } reads like a sentence.
|
|
173
|
+
RSpec/ExpectChange:
|
|
174
|
+
EnforcedStyle: block
|
|
175
|
+
|
|
176
|
+
RSpec/NamedSubject:
|
|
177
|
+
Enabled: false
|
|
178
|
+
|
|
179
|
+
# have_file_content matcher accepts a filename string in expect()
|
|
180
|
+
RSpec/ExpectActual:
|
|
181
|
+
Enabled: false
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.0.1
|
data/ASSESSMENT.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Gemvault: Gem Server Without a Server
|
|
2
|
+
|
|
3
|
+
## The Pitch
|
|
4
|
+
|
|
5
|
+
Every gem workflow that normally requires running server infrastructure — Geminabox, Gemstash, a private rubygems.org instance — gemvault does with a single SQLite file.
|
|
6
|
+
|
|
7
|
+
No daemon. No port. No config. No uptime concerns. Just a `.gemv` file you can commit, sync, email, or drop on a USB stick.
|
|
8
|
+
|
|
9
|
+
## What You Get Today
|
|
10
|
+
|
|
11
|
+
Three integration layers, all working and tested (122 tests, 0 failures):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# CLI — manage the vault
|
|
15
|
+
gemvault new myvault
|
|
16
|
+
gemvault add myvault.gemv rails-7.1.0.gem sidekiq-7.2.0.gem
|
|
17
|
+
gemvault list myvault.gemv
|
|
18
|
+
gemvault remove myvault.gemv sidekiq
|
|
19
|
+
gemvault extract myvault.gemv rails -o vendor/
|
|
20
|
+
|
|
21
|
+
# Bundler — use in a Gemfile like any source
|
|
22
|
+
source "myvault.gemv", type: :vault do
|
|
23
|
+
gem "rails"
|
|
24
|
+
gem "sidekiq"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# RubyGems — gem install, no server needed
|
|
28
|
+
gem install --source myvault.gemv rails
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
All three participate in real dependency resolution. Platform gems, prereleases, version constraints, lockfiles — it all works.
|
|
32
|
+
|
|
33
|
+
## Scorecard
|
|
34
|
+
|
|
35
|
+
| Capability | Status | Notes |
|
|
36
|
+
|-----------|--------|-------|
|
|
37
|
+
| Store multiple gems in one file | Done | SQLite with ACID guarantees |
|
|
38
|
+
| `bundle install` from vault | Done | Full Bundler plugin (source type `:vault`) |
|
|
39
|
+
| `gem install --source` from vault | Done | RubyGems plugin, standard install pipeline |
|
|
40
|
+
| Dependency resolution | Done | Both Bundler and RubyGems resolvers |
|
|
41
|
+
| Platform gems (x86_64, arm64, etc.) | Done | Stored, filtered, resolved correctly |
|
|
42
|
+
| Prerelease versions | Done | Filtered by `:released`/`:prerelease`/`:latest` |
|
|
43
|
+
| Lockfile generation | Done | Round-trips cleanly |
|
|
44
|
+
| Mixed sources (vault + rubygems.org) | Done | Vault gems + public gems coexist |
|
|
45
|
+
| Add/remove/list/extract via CLI | Done | 5 commands, all tested |
|
|
46
|
+
| Inspectable with standard tools | Done | It's SQLite — `sqlite3 vault.gemv ".tables"` |
|
|
47
|
+
|
|
48
|
+
## What You Don't Need Anymore
|
|
49
|
+
|
|
50
|
+
| Before (server) | Now (gemvault) |
|
|
51
|
+
|-----------------|----------------|
|
|
52
|
+
| Run Geminabox on a VM | Drop a `.gemv` file in your repo |
|
|
53
|
+
| Configure Gemstash with Redis | `gemvault new private.gemv` |
|
|
54
|
+
| Maintain uptime for CI to pull gems | File is right there on disk |
|
|
55
|
+
| Set up auth tokens for private gems | Access = having the file |
|
|
56
|
+
| Mirror rubygems.org for air-gapped deploys | `gemvault add` the gems you need |
|
|
57
|
+
|
|
58
|
+
## Where It Shines
|
|
59
|
+
|
|
60
|
+
**Air-gapped / offline deploys.** Bundle all your private gems into a `.gemv`, copy it to the isolated network, `bundle install` or `gem install` with no internet.
|
|
61
|
+
|
|
62
|
+
**CI dependency vendoring.** Commit the `.gemv` alongside your lockfile. CI never hits rubygems.org for your private gems. No gem server to maintain, no tokens to rotate.
|
|
63
|
+
|
|
64
|
+
**Distributing private gems.** Instead of publishing to a private server, `gemvault add` and hand someone the file. They `gem install --source` and they're done.
|
|
65
|
+
|
|
66
|
+
**Portable gem snapshots.** Capture a known-good set of gems as a single file. Reproducible installs anywhere, forever, with no network dependency.
|
|
67
|
+
|
|
68
|
+
## Remaining Gaps
|
|
69
|
+
|
|
70
|
+
These are real but don't undermine the core proposition:
|
|
71
|
+
|
|
72
|
+
1. **No update-in-place** — Must `remove` + `add` to replace a version. Could add `--force` flag.
|
|
73
|
+
2. **Specs re-extracted on each open** — No cached spec column in SQLite yet. Works fine but adds latency for large vaults.
|
|
74
|
+
3. **No `gemvault info`** — No quick way to inspect vault metadata (schema version, created date, total size).
|
|
75
|
+
4. **No encryption** — Planned but not implemented. The file is readable SQLite.
|
|
76
|
+
5. **Plugin setup friction** — Bundler requires a `plugin` line pointing at the local path until the gem is published to rubygems.org. RubyGems needs `RUBYLIB` set during development.
|
|
77
|
+
|
|
78
|
+
## Test Coverage
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
122 runs, 0 failures, 0 errors, 0 skips
|
|
82
|
+
|
|
83
|
+
test/vault_test.rb — 33 unit tests (Vault CRUD, GemEntry, Vault.open)
|
|
84
|
+
test/vault_source_test.rb — 17 unit tests (Bundler source plugin)
|
|
85
|
+
test/cli_test.rb — 32 CLI tests
|
|
86
|
+
test/integration_test.rb — 12 end-to-end Bundler tests
|
|
87
|
+
test/rubygems_plugin_test.rb — 28 RubyGems plugin tests (incl. gem install e2e)
|
|
88
|
+
```
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# CLAUDE.md — Gemvault
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
Multi-gem portable archives backed by SQLite. A single `.gemv` file contains multiple `.gem` files.
|
|
6
|
+
|
|
7
|
+
Two gems, one repo:
|
|
8
|
+
|
|
9
|
+
- **`gemvault`** — the real gem. All code, CLI, RubyGems plugin. Published to rubygems.org.
|
|
10
|
+
- **`bundler-source-vault`** — thin shim in `shim/`. Depends on `gemvault`, has a `plugins.rb` that registers the Bundler source. Published to rubygems.org so Bundler's `type: :vault` auto-discovery works. Users never interact with this name directly.
|
|
11
|
+
|
|
12
|
+
### User experience
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
# Gemfile — once both gems are published to rubygems.org, no plugin line needed:
|
|
16
|
+
source "myvault.gemv", type: :vault do
|
|
17
|
+
gem "foo"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Until then, point Bundler at the local source:
|
|
21
|
+
plugin "bundler-source-vault", path: "/path/to/gemvault"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Bundler auto-infers `bundler-source-vault` → installs it → pulls in `gemvault` as dependency → `plugins.rb` registers the vault source.
|
|
25
|
+
|
|
26
|
+
Also works as a RubyGems plugin:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
gem install --source myvault.gemv foo
|
|
30
|
+
gem install --source file:///path/to/myvault.gemv foo
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Architecture
|
|
34
|
+
|
|
35
|
+
- `gemvault.gemspec` — main gem spec (name: `gemvault`)
|
|
36
|
+
- `lib/gemvault/vault.rb` — Core vault class (SQLite CRUD for gem blobs + specs)
|
|
37
|
+
- `lib/gemvault/cli.rb` — CLI dispatcher (new/add/list/remove/extract)
|
|
38
|
+
- `lib/bundler/plugin/vault_source.rb` — Bundler `Plugin::API::Source` implementation
|
|
39
|
+
- `lib/rubygems_plugin.rb` — RubyGems plugin: monkey-patches for `--source myvault.gemv` support
|
|
40
|
+
- `lib/rubygems/source/vault.rb` — `Gem::Source::Vault` class (spec loading, download, `file://` URI handling, verbose logging)
|
|
41
|
+
- `lib/rubygems/resolver/vault_set.rb` — `Gem::Resolver::VaultSet` for dependency resolution
|
|
42
|
+
- `exe/gemvault` — CLI executable
|
|
43
|
+
- `shim/bundler-source-vault.gemspec` — thin shim gemspec depending on `gemvault`
|
|
44
|
+
- `shim/plugins.rb` — Bundler plugin registration + `Gem::Specification.dirs` workaround
|
|
45
|
+
- `plugins.rb` — development-only redirect to `shim/plugins.rb` (not shipped in gems)
|
|
46
|
+
|
|
47
|
+
## Key Design Decisions
|
|
48
|
+
|
|
49
|
+
- SQLite storage — random access, ACID, single file, inspectable with `sqlite3` CLI
|
|
50
|
+
- Specs extracted from gem blobs at runtime (no separate spec storage)
|
|
51
|
+
- Vault opened/closed per operation in the source plugin (no persistent connection)
|
|
52
|
+
- `fetch_gemspec_files` checks installed state — Bundler computes `full_gem_path` as `dirname(loaded_from)`, so `loaded_from` must point inside the gem directory
|
|
53
|
+
- `bundler-source-vault` name exists because Bundler auto-infers plugin name from `type: :vault` → `bundler-source-vault`
|
|
54
|
+
- `file://` URIs stripped to plain paths in `Gem::Source::Vault#initialize`
|
|
55
|
+
- Verbose logging via `Gem::UserInteraction#verbose` for `--verbose` support
|
|
56
|
+
|
|
57
|
+
## Testing
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
bundle exec rake test # 122 tests, 289 assertions
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- `test/vault_test.rb` — 33 unit tests for Vault class
|
|
64
|
+
- `test/vault_source_test.rb` — 17 unit tests for Bundler source plugin
|
|
65
|
+
- `test/integration_test.rb` — 12 end-to-end bundle install tests
|
|
66
|
+
- `test/cli_test.rb` — 32 CLI tests
|
|
67
|
+
- `test/rubygems_plugin_test.rb` — 28 tests (source, resolver, monkey-patches, gem install integration, file:// URI, verbose logging)
|
|
68
|
+
|
|
69
|
+
Integration tests use a manually-written Bundler plugin index to avoid rubygems.org resolution during testing.
|
|
70
|
+
|
|
71
|
+
## Dependencies
|
|
72
|
+
|
|
73
|
+
- `sqlite3` (~> 2.0) — runtime
|
|
74
|
+
- `bundler` (>= 2.0) — runtime
|
|
75
|
+
- `command_kit` (~> 0.6) — runtime (CLI)
|
|
76
|
+
- `minitest`, `rake` — development
|
data/Dockerfile.test
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
FROM docker.io/library/ruby:4.0.1-slim
|
|
2
|
+
|
|
3
|
+
COPY . /tmp/build/
|
|
4
|
+
|
|
5
|
+
RUN cd /tmp/build \
|
|
6
|
+
&& gem build gemvault.gemspec \
|
|
7
|
+
&& gem install --no-document gemvault-*.gem \
|
|
8
|
+
&& cd shim \
|
|
9
|
+
&& gem build bundler-source-vault.gemspec \
|
|
10
|
+
&& gem install --no-document bundler-source-vault-*.gem \
|
|
11
|
+
&& rm -rf /tmp/build
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David Gillis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/MACROPLAN.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Gemvault Implementation Plan
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
Bundler supports `path:`, `git:`, and remote sources but not `.gem` files directly. The `bundler-source-package` plugin proves single `.gem` file support works. Gemvault extends this to **multi-gem portable archives** — a single `.gemv` file containing multiple gems, backed by SQLite. Commit it, send it over Slack, reference it in your Gemfile. Like a `.jar` directory but for Ruby.
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
# CLI
|
|
9
|
+
gemvault new randomgems # creates randomgems.gemv
|
|
10
|
+
gemvault add randomgems.gemv foo.gem bar.gem # add gems
|
|
11
|
+
gemvault list randomgems.gemv # list contents
|
|
12
|
+
|
|
13
|
+
# Gemfile
|
|
14
|
+
source "randomgems.gemv", type: :vault do
|
|
15
|
+
gem "foo"
|
|
16
|
+
gem "bar"
|
|
17
|
+
end
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Phase Dependency Graph
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Phase 1 (Vault lib + tests)
|
|
24
|
+
└──> Phase 2 (Source plugin + tests) [needs Vault]
|
|
25
|
+
└──> Phase 3 (Integration tests) [needs Source]
|
|
26
|
+
└──> Phase 4 (CLI) [thin wrapper, last]
|
|
27
|
+
└──> Phase 5 (Encryption) [future]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## SQLite Schema
|
|
31
|
+
|
|
32
|
+
```sql
|
|
33
|
+
CREATE TABLE metadata (
|
|
34
|
+
key TEXT PRIMARY KEY,
|
|
35
|
+
value TEXT NOT NULL
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
CREATE TABLE gems (
|
|
39
|
+
name TEXT NOT NULL,
|
|
40
|
+
version TEXT NOT NULL,
|
|
41
|
+
platform TEXT NOT NULL DEFAULT 'ruby',
|
|
42
|
+
spec TEXT NOT NULL,
|
|
43
|
+
data BLOB NOT NULL,
|
|
44
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
45
|
+
PRIMARY KEY (name, version, platform)
|
|
46
|
+
);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Status
|
|
50
|
+
|
|
51
|
+
- Phase 0: Complete (project scaffolding)
|
|
52
|
+
- Phase 1: Complete (core Vault library — 27 unit tests)
|
|
53
|
+
- Phase 2: Complete (Bundler source plugin — 15 unit tests)
|
|
54
|
+
- Phase 3: Complete (integration tests — 11 end-to-end tests)
|
|
55
|
+
- Phase 4: Complete (CLI tool with CommandKit auto-loaded subcommands — 27 CLI tests)
|
|
56
|
+
- Phase 5: Future (encryption)
|
|
57
|
+
|
|
58
|
+
Post-phase refinements:
|
|
59
|
+
- Schema: dropped `spec` column, specs derived from gem blobs at runtime
|
|
60
|
+
- Tests: idiomatic Minitest assertions, Pathname throughout
|
|
61
|
+
- CLI: refactored from hand-rolled dispatcher to CommandKit::Commands::AutoLoad
|
|
62
|
+
|
|
63
|
+
Total: 84 tests, 215 assertions
|
data/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Gemvault
|
|
2
|
+
|
|
3
|
+
A gem server in a file. No HTTP. No infrastructure.
|
|
4
|
+
|
|
5
|
+
A `.gemv` file is a SQLite database that contains Ruby gems. Commit it to your repo, drop it on S3, email it, put it on a USB drive — Bundler and RubyGems read from it directly. Private gems without running a server.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install gemvault
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Bundler
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
# Gemfile
|
|
19
|
+
source "https://rubygems.org"
|
|
20
|
+
|
|
21
|
+
source "vendor/private.gemv", type: :vault do
|
|
22
|
+
gem "my_private_gem"
|
|
23
|
+
end
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bundle install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Bundler auto-discovers the `bundler-source-vault` plugin, installs it, and resolves gems from the vault alongside rubygems.org. No extra configuration.
|
|
31
|
+
|
|
32
|
+
### RubyGems CLI
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
gem install --source myvault.gemv my_private_gem
|
|
36
|
+
gem install --source file:///path/to/myvault.gemv my_private_gem
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Creating and managing vaults
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
gemvault new myvault # creates myvault.gemv
|
|
43
|
+
gemvault add myvault.gemv foo.gem bar.gem # add .gem files
|
|
44
|
+
gemvault list myvault.gemv # list contents
|
|
45
|
+
gemvault remove myvault.gemv foo 1.0.0 # remove a gem
|
|
46
|
+
gemvault extract myvault.gemv foo -o vendor/ # extract .gem file to disk
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## How It Works
|
|
50
|
+
|
|
51
|
+
A `.gemv` file is a SQLite database containing gem metadata and raw `.gem` blobs. You can inspect it directly:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
sqlite3 myvault.gemv "SELECT name, version, platform FROM gems"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
When Bundler sees `type: :vault` in your Gemfile, it auto-installs the `bundler-source-vault` plugin from rubygems.org. The plugin implements the `Bundler::Plugin::API::Source` interface — it reads gemspecs from the vault, participates in dependency resolution, then extracts and installs gems from the vault's blob storage.
|
|
58
|
+
|
|
59
|
+
The RubyGems plugin works similarly: `gem install --source vault.gemv` loads specs and extracts gems on demand.
|
|
60
|
+
|
|
61
|
+
## Development
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/gillisd/gemvault
|
|
65
|
+
cd gemvault
|
|
66
|
+
bin/setup
|
|
67
|
+
bundle exec rake test # unit tests
|
|
68
|
+
bundle exec rake spec # specs + container integration tests
|
|
69
|
+
bundle exec rake # all of the above + rubocop
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
|
|
3
|
+
require "minitest/test_task"
|
|
4
|
+
|
|
5
|
+
Minitest::TestTask.create do |t|
|
|
6
|
+
t.test_globs = ["test/*_test.rb"]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
require "rspec/core/rake_task"
|
|
10
|
+
|
|
11
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
12
|
+
|
|
13
|
+
require "rubocop/rake_task"
|
|
14
|
+
RuboCop::RakeTask.new
|
|
15
|
+
|
|
16
|
+
require "gempilot/version_task"
|
|
17
|
+
Gempilot::VersionTask.new
|
|
18
|
+
|
|
19
|
+
CACHED_IMAGE = "gemvault-test:latest".freeze
|
|
20
|
+
|
|
21
|
+
namespace :spec do
|
|
22
|
+
desc "Build cached container image with gemvault pre-installed"
|
|
23
|
+
task :build do
|
|
24
|
+
sh "podman", "build",
|
|
25
|
+
"--network=host",
|
|
26
|
+
"-t", CACHED_IMAGE,
|
|
27
|
+
"-f", "Dockerfile.test",
|
|
28
|
+
"."
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
namespace :shim do
|
|
33
|
+
desc "Build the bundler-source-vault shim gem"
|
|
34
|
+
task :build do
|
|
35
|
+
Dir.chdir("shim") { sh "gem build bundler-source-vault.gemspec" }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
task default: [:test, :spec, :rubocop]
|