gemstash 2.7.1 → 2.8.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 +4 -4
- data/lib/gemstash/cache.rb +2 -1
- data/lib/gemstash/cli/info.rb +29 -0
- data/lib/gemstash/cli/setup.rb +11 -3
- data/lib/gemstash/cli.rb +6 -0
- data/lib/gemstash/config.ru +4 -1
- data/lib/gemstash/configuration.rb +5 -0
- data/lib/gemstash/db/version.rb +0 -5
- data/lib/gemstash/env.rb +5 -2
- data/lib/gemstash/http_client.rb +2 -1
- data/lib/gemstash/logging.rb +4 -1
- data/lib/gemstash/man/gemstash-authorize.1 +36 -17
- data/lib/gemstash/man/gemstash-authorize.1.txt +15 -17
- data/lib/gemstash/man/gemstash-configuration.5 +136 -63
- data/lib/gemstash/man/gemstash-configuration.5.txt +80 -64
- data/lib/gemstash/man/gemstash-customize.7 +114 -61
- data/lib/gemstash/man/gemstash-customize.7.txt +56 -51
- data/lib/gemstash/man/gemstash-debugging.7 +27 -9
- data/lib/gemstash/man/gemstash-debugging.7.txt +6 -8
- data/lib/gemstash/man/gemstash-deploy.7 +39 -16
- data/lib/gemstash/man/gemstash-deploy.7.txt +19 -21
- data/lib/gemstash/man/gemstash-mirror.7 +31 -11
- data/lib/gemstash/man/gemstash-mirror.7.txt +6 -8
- data/lib/gemstash/man/gemstash-multiple-sources.7 +68 -35
- data/lib/gemstash/man/gemstash-multiple-sources.7.txt +20 -22
- data/lib/gemstash/man/gemstash-private-gems.7 +102 -52
- data/lib/gemstash/man/gemstash-private-gems.7.txt +31 -33
- data/lib/gemstash/man/gemstash-readme.7 +75 -30
- data/lib/gemstash/man/gemstash-readme.7.txt +24 -26
- data/lib/gemstash/man/gemstash-setup.1 +33 -14
- data/lib/gemstash/man/gemstash-setup.1.txt +12 -14
- data/lib/gemstash/man/gemstash-start.1 +23 -6
- data/lib/gemstash/man/gemstash-start.1.txt +5 -7
- data/lib/gemstash/man/gemstash-status.1 +23 -6
- data/lib/gemstash/man/gemstash-status.1.txt +6 -8
- data/lib/gemstash/man/gemstash-stop.1 +23 -6
- data/lib/gemstash/man/gemstash-stop.1.txt +5 -7
- data/lib/gemstash/man/gemstash-version.1 +24 -5
- data/lib/gemstash/man/gemstash-version.1.txt +1 -3
- data/lib/gemstash/puma.rb +2 -0
- data/lib/gemstash/specs_builder.rb +16 -2
- data/lib/gemstash/upstream.rb +1 -1
- data/lib/gemstash/version.rb +1 -1
- data/lib/gemstash/web.rb +1 -1
- metadata +37 -21
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
.\" Automatically generated by Pandoc 3.1.8
|
|
1
|
+
.\" Automatically generated by Pandoc 3.1.3
|
|
3
2
|
.\"
|
|
3
|
+
.\" Define V font for inline verbatim, using C font in formats
|
|
4
|
+
.\" that render this, and otherwise B font.
|
|
5
|
+
.ie "\f[CB]x\f[]"x" \{\
|
|
6
|
+
. ftr V B
|
|
7
|
+
. ftr VI BI
|
|
8
|
+
. ftr VB B
|
|
9
|
+
. ftr VBI BI
|
|
10
|
+
.\}
|
|
11
|
+
.el \{\
|
|
12
|
+
. ftr V CR
|
|
13
|
+
. ftr VI CI
|
|
14
|
+
. ftr VB CB
|
|
15
|
+
. ftr VBI CBI
|
|
16
|
+
.\}
|
|
4
17
|
.TH "gemstash-private-gems" "7" "October 8, 2015" "" ""
|
|
18
|
+
.hy
|
|
5
19
|
.SH Private Gems
|
|
20
|
+
.PP
|
|
6
21
|
Stashing private gems in your Gemstash server requires a bit of
|
|
7
22
|
additional setup.
|
|
8
23
|
If you haven\[cq]t read through the Quickstart Guide, you should do that
|
|
@@ -10,6 +25,7 @@ first.
|
|
|
10
25
|
By the end of this guide, you will be able to interact with your
|
|
11
26
|
Gemstash server to store and retrieve your private gems.
|
|
12
27
|
.SS Authorizing
|
|
28
|
+
.PP
|
|
13
29
|
\f[B]IMPORTANT NOTE:\f[R] Do not use the actual key value in this
|
|
14
30
|
document, otherwise your Gemstash server will be vulnerable to anyone
|
|
15
31
|
who wants to try to use the key against your server.
|
|
@@ -18,32 +34,38 @@ running the commands.
|
|
|
18
34
|
.PP
|
|
19
35
|
In order to push a gem to your Gemstash server, you need to first create
|
|
20
36
|
an API key.
|
|
21
|
-
Utilize the \f[
|
|
37
|
+
Utilize the \f[V]gemstash authorize\f[R] command to create the API key:
|
|
22
38
|
.IP
|
|
23
|
-
.
|
|
39
|
+
.nf
|
|
40
|
+
\f[C]
|
|
24
41
|
$ gemstash authorize
|
|
25
42
|
Your new key is: e374e237fdf5fa5718d2a21bd63dc911
|
|
26
|
-
|
|
43
|
+
\f[R]
|
|
44
|
+
.fi
|
|
27
45
|
.PP
|
|
28
|
-
This new key can \f[
|
|
46
|
+
This new key can \f[V]push\f[R], \f[V]yank\f[R], and \f[V]fetch\f[R]
|
|
29
47
|
gems from your Gemstash server.
|
|
30
|
-
Run \f[
|
|
48
|
+
Run \f[V]gemstash authorize\f[R] with just the permissions you want to
|
|
31
49
|
limit what the key will be allowed to do.
|
|
32
50
|
You can similarly update a specific key by providing it via the
|
|
33
|
-
\f[
|
|
51
|
+
\f[V]--key\f[R] option:
|
|
34
52
|
.IP
|
|
35
|
-
.
|
|
53
|
+
.nf
|
|
54
|
+
\f[C]
|
|
36
55
|
$ gemstash authorize push yank --key e374e237fdf5fa5718d2a21bd63dc911
|
|
37
|
-
|
|
56
|
+
\f[R]
|
|
57
|
+
.fi
|
|
38
58
|
.PP
|
|
39
59
|
When no permissions are provided (like the first example), the key will
|
|
40
60
|
be authorized for all permissions.
|
|
41
61
|
Leave the key authorized with everything if you want to use it to try
|
|
42
62
|
all private gem interactions:
|
|
43
63
|
.IP
|
|
44
|
-
.
|
|
64
|
+
.nf
|
|
65
|
+
\f[C]
|
|
45
66
|
$ gemstash authorize --key e374e237fdf5fa5718d2a21bd63dc911
|
|
46
|
-
|
|
67
|
+
\f[R]
|
|
68
|
+
.fi
|
|
47
69
|
.PP
|
|
48
70
|
With the key generated, you\[cq]ll need to tell Rubygems about your new
|
|
49
71
|
key.
|
|
@@ -52,70 +74,86 @@ already have a credentials file to add the key to.
|
|
|
52
74
|
If not, run the following commands before modifying the credentials
|
|
53
75
|
file:
|
|
54
76
|
.IP
|
|
55
|
-
.
|
|
77
|
+
.nf
|
|
78
|
+
\f[C]
|
|
56
79
|
$ mkdir -p \[ti]/.gem
|
|
57
80
|
$ touch \[ti]/.gem/credentials
|
|
58
81
|
$ chmod 0600 \[ti]/.gem/credentials
|
|
59
|
-
|
|
82
|
+
\f[R]
|
|
83
|
+
.fi
|
|
60
84
|
.PP
|
|
61
85
|
Add your new key to credentials such that it looks something like this
|
|
62
86
|
(but make sure not to remove any existing keys):
|
|
63
87
|
.IP
|
|
64
|
-
.
|
|
88
|
+
.nf
|
|
89
|
+
\f[C]
|
|
65
90
|
# \[ti]/.gem/credentials
|
|
66
91
|
---
|
|
67
92
|
:test_key: e374e237fdf5fa5718d2a21bd63dc911
|
|
68
|
-
|
|
93
|
+
\f[R]
|
|
94
|
+
.fi
|
|
69
95
|
.PP
|
|
70
|
-
The name \f[
|
|
96
|
+
The name \f[V]test_key\f[R] can be anything you want, but you will need
|
|
71
97
|
to remember it and use it again later in this guide for the
|
|
72
|
-
\f[
|
|
98
|
+
\f[V]--key\f[R] option.
|
|
73
99
|
.SS Creating a Test Gem
|
|
100
|
+
.PP
|
|
74
101
|
You\[cq]ll need a test gem before you can play with private gems on your
|
|
75
102
|
Gemstash server.
|
|
76
103
|
If you have a gem you can use, move along to the next section.
|
|
77
104
|
You can start by instantiating a test gem via Bundler:
|
|
78
105
|
.IP
|
|
79
|
-
.
|
|
106
|
+
.nf
|
|
107
|
+
\f[C]
|
|
80
108
|
$ bundle gem private-example
|
|
81
|
-
|
|
109
|
+
\f[R]
|
|
110
|
+
.fi
|
|
82
111
|
.PP
|
|
83
112
|
You\[cq]ll need to add a summary and description to the new gem\[cq]s
|
|
84
113
|
gemspec file in order to successfully build it.
|
|
85
114
|
Once you\[cq]ve built the gem, you will be ready to push the new gem.
|
|
86
115
|
.IP
|
|
87
|
-
.
|
|
116
|
+
.nf
|
|
117
|
+
\f[C]
|
|
88
118
|
$ cd private-example
|
|
89
119
|
$ rake build
|
|
90
|
-
|
|
120
|
+
\f[R]
|
|
121
|
+
.fi
|
|
91
122
|
.PP
|
|
92
123
|
You will now have a gem at
|
|
93
|
-
\f[
|
|
124
|
+
\f[V]private-example/pkg/private-example-0.1.0.gem\f[R].
|
|
94
125
|
.SS Pushing
|
|
126
|
+
.PP
|
|
95
127
|
If your Gemstash server isn\[cq]t running, go ahead and start it:
|
|
96
128
|
.IP
|
|
97
|
-
.
|
|
129
|
+
.nf
|
|
130
|
+
\f[C]
|
|
98
131
|
$ gemstash start
|
|
99
|
-
|
|
132
|
+
\f[R]
|
|
133
|
+
.fi
|
|
100
134
|
.PP
|
|
101
135
|
Push your test gem using Rubygems:
|
|
102
136
|
.IP
|
|
103
|
-
.
|
|
137
|
+
.nf
|
|
138
|
+
\f[C]
|
|
104
139
|
$ gem push --key test_key --host http://localhost:9292/private pkg/private-example-0.1.0.gem
|
|
105
|
-
|
|
140
|
+
\f[R]
|
|
141
|
+
.fi
|
|
106
142
|
.PP
|
|
107
|
-
The \f[
|
|
143
|
+
The \f[V]/private\f[R] portion of the \f[V]--host\f[R] option tells
|
|
108
144
|
Gemstash you are interacting with the private gems.
|
|
109
145
|
Gemstash will not let you push, or yank from anything except
|
|
110
|
-
\f[
|
|
146
|
+
\f[V]/private\f[R].
|
|
111
147
|
.SS Bundling
|
|
148
|
+
.PP
|
|
112
149
|
Once your gem is pushed to your Gemstash server, you are ready to bundle
|
|
113
150
|
it.
|
|
114
|
-
Create a \f[
|
|
151
|
+
Create a \f[V]Gemfile\f[R] and specify the gem.
|
|
115
152
|
You will probably want to wrap the private gem in a source block, and
|
|
116
153
|
let the rest of Gemstash handle all other gems:
|
|
117
154
|
.IP
|
|
118
|
-
.
|
|
155
|
+
.nf
|
|
156
|
+
\f[C]
|
|
119
157
|
# ./Gemfile
|
|
120
158
|
source \[dq]http://localhost:9292\[dq]
|
|
121
159
|
gem \[dq]rubywarrior\[dq]
|
|
@@ -123,55 +161,65 @@ gem \[dq]rubywarrior\[dq]
|
|
|
123
161
|
source \[dq]http://localhost:9292/private\[dq] do
|
|
124
162
|
gem \[dq]private-example\[dq]
|
|
125
163
|
end
|
|
126
|
-
|
|
164
|
+
\f[R]
|
|
165
|
+
.fi
|
|
127
166
|
.PP
|
|
128
|
-
Notice that the Gemstash server points to \f[
|
|
167
|
+
Notice that the Gemstash server points to \f[V]/private\f[R] again when
|
|
129
168
|
installing your private gem.
|
|
130
169
|
Go ahead and bundle to install your new private gem:
|
|
131
170
|
.IP
|
|
132
|
-
.
|
|
171
|
+
.nf
|
|
172
|
+
\f[C]
|
|
133
173
|
$ bundle
|
|
134
|
-
|
|
174
|
+
\f[R]
|
|
175
|
+
.fi
|
|
135
176
|
.SS Yanking
|
|
177
|
+
.PP
|
|
136
178
|
If you push a private gem by accident, you can yank the gem with
|
|
137
179
|
Rubygems:
|
|
138
180
|
.IP
|
|
139
|
-
.
|
|
181
|
+
.nf
|
|
182
|
+
\f[C]
|
|
140
183
|
$ RUBYGEMS_HOST=http://localhost:9292/private gem yank --key test_key private-example --version 0.1.0
|
|
141
|
-
|
|
184
|
+
\f[R]
|
|
185
|
+
.fi
|
|
142
186
|
.PP
|
|
143
|
-
Like with pushing, the \f[
|
|
187
|
+
Like with pushing, the \f[V]/private\f[R] portion of the host option
|
|
144
188
|
tells Gemstash you are interacting with private gems.
|
|
145
|
-
Gemstash will only let you yank from \f[
|
|
146
|
-
Unlike pushing, Rubygems doesn\[cq]t support \f[
|
|
147
|
-
(yet), so you need to specify the host via the \f[
|
|
189
|
+
Gemstash will only let you yank from \f[V]/private\f[R].
|
|
190
|
+
Unlike pushing, Rubygems doesn\[cq]t support \f[V]--host\f[R] for yank
|
|
191
|
+
(yet), so you need to specify the host via the \f[V]RUBYGEMS_HOST\f[R]
|
|
148
192
|
environment variable.
|
|
149
193
|
.SS Protected Fetching
|
|
194
|
+
.PP
|
|
150
195
|
By default, private gems and specs can be accessed without
|
|
151
196
|
authentication.
|
|
152
197
|
.PP
|
|
153
198
|
Private gems often require protected fetching.
|
|
154
199
|
For backwards compatibility this is disabled by default, but can be
|
|
155
|
-
enabled via \f[
|
|
200
|
+
enabled via \f[V]$ gemstash setup\f[R] command.
|
|
156
201
|
.PP
|
|
157
202
|
When protected fetching is enabled API keys with the permissions
|
|
158
|
-
\f[
|
|
159
|
-
specs.
|
|
203
|
+
\f[V]all\f[R] or \f[V]fetch\f[R] can be used to download gems and specs.
|
|
160
204
|
.PP
|
|
161
205
|
On the Bundler side, there are a few ways to configure credentials for a
|
|
162
206
|
given gem source:
|
|
163
207
|
.PP
|
|
164
208
|
Add credentials globally:
|
|
165
209
|
.IP
|
|
166
|
-
.
|
|
210
|
+
.nf
|
|
211
|
+
\f[C]
|
|
167
212
|
$ bundle config my-gemstash.dev api_key
|
|
168
|
-
|
|
213
|
+
\f[R]
|
|
214
|
+
.fi
|
|
169
215
|
.PP
|
|
170
216
|
Add credentials in Gemfile:
|
|
171
217
|
.IP
|
|
172
|
-
.
|
|
218
|
+
.nf
|
|
219
|
+
\f[C]
|
|
173
220
|
source \[dq]https://api_key\[at]my-gemstash.dev\[dq]
|
|
174
|
-
|
|
221
|
+
\f[R]
|
|
222
|
+
.fi
|
|
175
223
|
.PP
|
|
176
224
|
However, it\[cq]s not a good practice to commit credentials to source
|
|
177
225
|
control.
|
|
@@ -179,13 +227,15 @@ A recommended solution is to use Bundler\[cq]s configuration
|
|
|
179
227
|
keys (http://bundler.io/man/bundle-config.1.html#CONFIGURATION-KEYS),
|
|
180
228
|
e.g.:
|
|
181
229
|
.IP
|
|
182
|
-
.
|
|
230
|
+
.nf
|
|
231
|
+
\f[C]
|
|
183
232
|
$ export BUNDLE_MYGEMSTASH__DEV=api_key
|
|
184
|
-
|
|
233
|
+
\f[R]
|
|
234
|
+
.fi
|
|
185
235
|
.PP
|
|
186
236
|
Behind the scene, Bundler will pick up the ENV var according to the host
|
|
187
|
-
name (e.g.\ mygemstash.dev) and add to \f[
|
|
188
|
-
|
|
237
|
+
name (e.g.\ mygemstash.dev) and add to \f[V]URI.userinfo\f[R] for making
|
|
238
|
+
requests.
|
|
189
239
|
.PP
|
|
190
240
|
The API key is treated as a HTTP Basic Auth username and any HTTP Basic
|
|
191
241
|
password supplied will be ignored.
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
4mgemstash-private-gems24m(7) 4mgemstash-private-gems24m(7)
|
|
2
2
|
|
|
3
|
-
<!-- Automatically generated by Pandoc -->
|
|
4
|
-
|
|
5
3
|
1mPrivate Gems0m
|
|
6
|
-
Stashing
|
|
4
|
+
Stashing private gems in your Gemstash server requires a bit of addi-
|
|
7
5
|
tional setup. If you haven't read through the Quickstart Guide, you
|
|
8
|
-
should do that
|
|
9
|
-
interact with your Gemstash server to store and retrieve
|
|
6
|
+
should do that first. By the end of this guide, you will be able to
|
|
7
|
+
interact with your Gemstash server to store and retrieve your private
|
|
10
8
|
gems.
|
|
11
9
|
|
|
12
10
|
1mAuthorizing0m
|
|
@@ -16,28 +14,28 @@
|
|
|
16
14
|
use whatever key is generated from running the commands.
|
|
17
15
|
|
|
18
16
|
In order to push a gem to your Gemstash server, you need to first cre-
|
|
19
|
-
ate an API key. Utilize the
|
|
17
|
+
ate an API key. Utilize the 1mgemstash authorize 22mcommand to create the
|
|
20
18
|
API key:
|
|
21
19
|
|
|
22
20
|
$ gemstash authorize
|
|
23
21
|
Your new key is: e374e237fdf5fa5718d2a21bd63dc911
|
|
24
22
|
|
|
25
|
-
This new key can
|
|
26
|
-
Run
|
|
23
|
+
This new key can 1mpush22m, 1myank22m, and 1mfetch 22mgems from your Gemstash server.
|
|
24
|
+
Run 1mgemstash authorize 22mwith just the permissions you want to limit what
|
|
27
25
|
the key will be allowed to do. You can similarly update a specific key
|
|
28
|
-
by providing it via the --key
|
|
26
|
+
by providing it via the 1m--key 22moption:
|
|
29
27
|
|
|
30
28
|
$ gemstash authorize push yank --key e374e237fdf5fa5718d2a21bd63dc911
|
|
31
29
|
|
|
32
30
|
When no permissions are provided (like the first example), the key will
|
|
33
|
-
be authorized for all permissions. Leave the
|
|
31
|
+
be authorized for all permissions. Leave the key authorized with
|
|
34
32
|
everything if you want to use it to try all private gem interactions:
|
|
35
33
|
|
|
36
34
|
$ gemstash authorize --key e374e237fdf5fa5718d2a21bd63dc911
|
|
37
35
|
|
|
38
36
|
With the key generated, you'll need to tell Rubygems about your new
|
|
39
37
|
key. If you've pushed a gem to https://rubygems.org, then you will al-
|
|
40
|
-
ready have a credentials file to add the key to.
|
|
38
|
+
ready have a credentials file to add the key to. If not, run the fol-
|
|
41
39
|
lowing commands before modifying the credentials file:
|
|
42
40
|
|
|
43
41
|
$ mkdir -p ~/.gem
|
|
@@ -51,13 +49,13 @@
|
|
|
51
49
|
---
|
|
52
50
|
:test_key: e374e237fdf5fa5718d2a21bd63dc911
|
|
53
51
|
|
|
54
|
-
The name
|
|
55
|
-
ber it and use it again later in this guide for the --key
|
|
52
|
+
The name 1mtest_key 22mcan be anything you want, but you will need to remem-
|
|
53
|
+
ber it and use it again later in this guide for the 1m--key 22moption.
|
|
56
54
|
|
|
57
55
|
1mCreating a Test Gem0m
|
|
58
56
|
You'll need a test gem before you can play with private gems on your
|
|
59
|
-
Gemstash server.
|
|
60
|
-
section.
|
|
57
|
+
Gemstash server. If you have a gem you can use, move along to the next
|
|
58
|
+
section. You can start by instantiating a test gem via Bundler:
|
|
61
59
|
|
|
62
60
|
$ bundle gem private-example
|
|
63
61
|
|
|
@@ -68,8 +66,8 @@
|
|
|
68
66
|
$ cd private-example
|
|
69
67
|
$ rake build
|
|
70
68
|
|
|
71
|
-
You will now have a
|
|
72
|
-
|
|
69
|
+
You will now have a gem at 1mprivate-example/pkg/private-exam-0m
|
|
70
|
+
1mple-0.1.0.gem22m.
|
|
73
71
|
|
|
74
72
|
1mPushing0m
|
|
75
73
|
If your Gemstash server isn't running, go ahead and start it:
|
|
@@ -80,13 +78,13 @@
|
|
|
80
78
|
|
|
81
79
|
$ gem push --key test_key --host http://localhost:9292/private pkg/private-example-0.1.0.gem
|
|
82
80
|
|
|
83
|
-
The /private
|
|
81
|
+
The 1m/private 22mportion of the 1m--host 22moption tells Gemstash you are inter-
|
|
84
82
|
acting with the private gems. Gemstash will not let you push, or yank
|
|
85
|
-
from anything except /
|
|
83
|
+
from anything except 1m/private22m.
|
|
86
84
|
|
|
87
85
|
1mBundling0m
|
|
88
86
|
Once your gem is pushed to your Gemstash server, you are ready to bun-
|
|
89
|
-
dle it.
|
|
87
|
+
dle it. Create a 1mGemfile 22mand specify the gem. You will probably want
|
|
90
88
|
to wrap the private gem in a source block, and let the rest of Gemstash
|
|
91
89
|
handle all other gems:
|
|
92
90
|
|
|
@@ -98,8 +96,8 @@
|
|
|
98
96
|
gem "private-example"
|
|
99
97
|
end
|
|
100
98
|
|
|
101
|
-
Notice that the Gemstash server points to /private
|
|
102
|
-
stalling
|
|
99
|
+
Notice that the Gemstash server points to 1m/private 22magain when in-
|
|
100
|
+
stalling your private gem. Go ahead and bundle to install your new
|
|
103
101
|
private gem:
|
|
104
102
|
|
|
105
103
|
$ bundle
|
|
@@ -110,22 +108,22 @@
|
|
|
110
108
|
|
|
111
109
|
$ RUBYGEMS_HOST=http://localhost:9292/private gem yank --key test_key private-example --version 0.1.0
|
|
112
110
|
|
|
113
|
-
Like with pushing, the /private
|
|
111
|
+
Like with pushing, the 1m/private 22mportion of the host option tells Gem-
|
|
114
112
|
stash you are interacting with private gems. Gemstash will only let
|
|
115
|
-
you yank from /
|
|
116
|
-
--host
|
|
117
|
-
|
|
113
|
+
you yank from 1m/private22m. Unlike pushing, Rubygems doesn't support
|
|
114
|
+
1m--host 22mfor yank (yet), so you need to specify the host via the
|
|
115
|
+
1mRUBYGEMS_HOST 22menvironment variable.
|
|
118
116
|
|
|
119
117
|
1mProtected Fetching0m
|
|
120
118
|
By default, private gems and specs can be accessed without authentica-
|
|
121
119
|
tion.
|
|
122
120
|
|
|
123
121
|
Private gems often require protected fetching. For backwards compati-
|
|
124
|
-
bility this is disabled by default, but can be enabled via $
|
|
125
|
-
|
|
122
|
+
bility this is disabled by default, but can be enabled via 1m$ gemstash0m
|
|
123
|
+
1msetup 22mcommand.
|
|
126
124
|
|
|
127
|
-
When protected fetching is enabled API keys with the permissions
|
|
128
|
-
|
|
125
|
+
When protected fetching is enabled API keys with the permissions 1mall 22mor
|
|
126
|
+
1mfetch 22mcan be used to download gems and specs.
|
|
129
127
|
|
|
130
128
|
On the Bundler side, there are a few ways to configure credentials for
|
|
131
129
|
a given gem source:
|
|
@@ -138,17 +136,17 @@
|
|
|
138
136
|
|
|
139
137
|
source "https://api_key@my-gemstash.dev"
|
|
140
138
|
|
|
141
|
-
However,
|
|
139
|
+
However, it's not a good practice to commit credentials to source con-
|
|
142
140
|
trol. A recommended solution is to use Bundler's configuration keys
|
|
143
141
|
(http://bundler.io/man/bundle-config.1.html#CONFIGURATION-KEYS), e.g.:
|
|
144
142
|
|
|
145
143
|
$ export BUNDLE_MYGEMSTASH__DEV=api_key
|
|
146
144
|
|
|
147
145
|
Behind the scene, Bundler will pick up the ENV var according to the
|
|
148
|
-
host name (e.g. mygemstash.dev) and add to
|
|
146
|
+
host name (e.g. mygemstash.dev) and add to 1mURI.userinfo 22mfor making re-
|
|
149
147
|
quests.
|
|
150
148
|
|
|
151
149
|
The API key is treated as a HTTP Basic Auth username and any HTTP Basic
|
|
152
150
|
password supplied will be ignored.
|
|
153
151
|
|
|
154
|
-
October 8, 2015
|
|
152
|
+
October 8, 2015 4mgemstash-private-gems24m(7)
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
.\" Automatically generated by Pandoc 3.1.8
|
|
1
|
+
.\" Automatically generated by Pandoc 3.1.3
|
|
3
2
|
.\"
|
|
3
|
+
.\" Define V font for inline verbatim, using C font in formats
|
|
4
|
+
.\" that render this, and otherwise B font.
|
|
5
|
+
.ie "\f[CB]x\f[]"x" \{\
|
|
6
|
+
. ftr V B
|
|
7
|
+
. ftr VI BI
|
|
8
|
+
. ftr VB B
|
|
9
|
+
. ftr VBI BI
|
|
10
|
+
.\}
|
|
11
|
+
.el \{\
|
|
12
|
+
. ftr V CR
|
|
13
|
+
. ftr VI CI
|
|
14
|
+
. ftr VB CB
|
|
15
|
+
. ftr VBI CBI
|
|
16
|
+
.\}
|
|
4
17
|
.TH "gemstash-readme" "7" "November 30, 2015" "" ""
|
|
18
|
+
.hy
|
|
5
19
|
.SH Gemstash
|
|
6
20
|
.SS What is Gemstash?
|
|
21
|
+
.PP
|
|
7
22
|
Gemstash is both a cache for remote servers such as
|
|
8
23
|
https://rubygems.org, and a private gem source.
|
|
9
24
|
.PP
|
|
@@ -31,6 +46,7 @@ Bundler, RubyGems, Gemstash, and other shared tooling is around for
|
|
|
31
46
|
years to come.
|
|
32
47
|
.SS Quickstart Guide
|
|
33
48
|
.SS Setup
|
|
49
|
+
.PP
|
|
34
50
|
Gemstash is designed to be quick and painless to get set up.
|
|
35
51
|
By the end of this Quickstart Guide, you will be able to bundle stashed
|
|
36
52
|
gems from public sources against a Gemstash server running on your
|
|
@@ -38,45 +54,56 @@ machine.
|
|
|
38
54
|
.PP
|
|
39
55
|
Install Gemstash to get started:
|
|
40
56
|
.IP
|
|
41
|
-
.
|
|
57
|
+
.nf
|
|
58
|
+
\f[C]
|
|
42
59
|
$ gem install gemstash
|
|
43
|
-
|
|
60
|
+
\f[R]
|
|
61
|
+
.fi
|
|
44
62
|
.PP
|
|
45
63
|
After it is installed, starting Gemstash requires no additional steps.
|
|
46
|
-
Simply start the Gemstash server with the \f[
|
|
64
|
+
Simply start the Gemstash server with the \f[V]gemstash\f[R] command:
|
|
47
65
|
.IP
|
|
48
|
-
.
|
|
66
|
+
.nf
|
|
67
|
+
\f[C]
|
|
49
68
|
$ gemstash start
|
|
50
|
-
|
|
69
|
+
\f[R]
|
|
70
|
+
.fi
|
|
51
71
|
.PP
|
|
52
72
|
You may have noticed that the command finished quickly.
|
|
53
73
|
This is because Gemstash will run the server in the background by
|
|
54
74
|
default.
|
|
55
75
|
The server runs on port 9292.
|
|
56
76
|
.SS Bundling
|
|
77
|
+
.PP
|
|
57
78
|
With the server running, you can bundle against it.
|
|
58
79
|
Tell Bundler that you want to use Gemstash to find gems from
|
|
59
80
|
RubyGems.org:
|
|
60
81
|
.IP
|
|
61
|
-
.
|
|
82
|
+
.nf
|
|
83
|
+
\f[C]
|
|
62
84
|
$ bundle config mirror.https://rubygems.org http://localhost:9292
|
|
63
|
-
|
|
85
|
+
\f[R]
|
|
86
|
+
.fi
|
|
64
87
|
.PP
|
|
65
88
|
Now you can create a Gemfile and install gems through Gemstash:
|
|
66
89
|
.IP
|
|
67
|
-
.
|
|
90
|
+
.nf
|
|
91
|
+
\f[C]
|
|
68
92
|
# ./Gemfile
|
|
69
93
|
source \[dq]https://rubygems.org\[dq]
|
|
70
94
|
gem \[dq]rubywarrior\[dq]
|
|
71
|
-
|
|
95
|
+
\f[R]
|
|
96
|
+
.fi
|
|
72
97
|
.PP
|
|
73
98
|
The gems you include should be gems you don\[cq]t yet have installed,
|
|
74
99
|
otherwise Gemstash will have nothing to stash.
|
|
75
100
|
Now bundle:
|
|
76
101
|
.IP
|
|
77
|
-
.
|
|
102
|
+
.nf
|
|
103
|
+
\f[C]
|
|
78
104
|
$ bundle install --path .bundle
|
|
79
|
-
|
|
105
|
+
\f[R]
|
|
106
|
+
.fi
|
|
80
107
|
.PP
|
|
81
108
|
Your Gemstash server has fetched the gems from https://rubygems.org and
|
|
82
109
|
cached them for you!
|
|
@@ -86,52 +113,65 @@ Gem dependencies metadata are cached for 30 minutes, so if you bundle
|
|
|
86
113
|
again before that, you can successfully bundle without an Internet
|
|
87
114
|
connection:
|
|
88
115
|
.IP
|
|
89
|
-
.
|
|
116
|
+
.nf
|
|
117
|
+
\f[C]
|
|
90
118
|
$ # Disable your Internet first!
|
|
91
119
|
$ rm -rf Gemfile.lock .bundle
|
|
92
120
|
$ bundle
|
|
93
|
-
|
|
121
|
+
\f[R]
|
|
122
|
+
.fi
|
|
94
123
|
.SS Falling back to rubygems.org
|
|
124
|
+
.PP
|
|
95
125
|
If you want to make sure that your bundling from https://rubygems.org
|
|
96
126
|
still works as expected when the Gemstash server is not running, you can
|
|
97
127
|
easily configure Bundler to fallback to https://rubygems.org.
|
|
98
128
|
.IP
|
|
99
|
-
.
|
|
129
|
+
.nf
|
|
130
|
+
\f[C]
|
|
100
131
|
$ bundle config mirror.https://rubygems.org.fallback_timeout true
|
|
101
|
-
|
|
132
|
+
\f[R]
|
|
133
|
+
.fi
|
|
102
134
|
.PP
|
|
103
135
|
You can also configure this fallback as a number of seconds in case the
|
|
104
136
|
Gemstash server is simply unresponsive.
|
|
105
137
|
This example uses a 3 second timeout:
|
|
106
138
|
.IP
|
|
107
|
-
.
|
|
139
|
+
.nf
|
|
140
|
+
\f[C]
|
|
108
141
|
$ bundle config mirror.https://rubygems.org.fallback_timeout 3
|
|
109
|
-
|
|
142
|
+
\f[R]
|
|
143
|
+
.fi
|
|
110
144
|
.SS Stopping the Server
|
|
145
|
+
.PP
|
|
111
146
|
Once you\[cq]ve finish using your Gemstash server, you can stop it just
|
|
112
147
|
as easily as you started it:
|
|
113
148
|
.IP
|
|
114
|
-
.
|
|
149
|
+
.nf
|
|
150
|
+
\f[C]
|
|
115
151
|
$ gemstash stop
|
|
116
|
-
|
|
152
|
+
\f[R]
|
|
153
|
+
.fi
|
|
117
154
|
.PP
|
|
118
155
|
You\[cq]ll also want to tell Bundler that it can go back to getting gems
|
|
119
156
|
from RubyGems.org directly, instead of going through Gemstash:
|
|
120
157
|
.IP
|
|
121
|
-
.
|
|
158
|
+
.nf
|
|
159
|
+
\f[C]
|
|
122
160
|
$ bundle config --delete mirror.https://rubygems.org
|
|
123
|
-
|
|
161
|
+
\f[R]
|
|
162
|
+
.fi
|
|
124
163
|
.SS Under the Hood
|
|
164
|
+
.PP
|
|
125
165
|
You might wonder where the gems are stored.
|
|
126
166
|
After running the commands above, you will find a new directory at
|
|
127
|
-
\f[
|
|
167
|
+
\f[V]\[ti]/.gemstash\f[R].
|
|
128
168
|
This directory holds all the cached and private gems.
|
|
129
169
|
It also has a server log, the database, and configuration for Gemstash.
|
|
130
170
|
If you prefer, you can point to a different directory.
|
|
131
171
|
.PP
|
|
132
172
|
Gemstash uses SQLite (https://www.sqlite.org/) to store details about
|
|
133
173
|
private gems.
|
|
134
|
-
The database will be located in \f[
|
|
174
|
+
The database will be located in \f[V]\[ti]/.gemstash\f[R], however you
|
|
135
175
|
won\[cq]t see the database appear until you start using private gems.
|
|
136
176
|
If you prefer, you can use a different database.
|
|
137
177
|
.PP
|
|
@@ -140,13 +180,14 @@ Anything cached in memory will last for 30 minutes before being
|
|
|
140
180
|
retrieved again.
|
|
141
181
|
You can use memcached instead of caching in memory.
|
|
142
182
|
Gem files are always cached permanently, so bundling with a
|
|
143
|
-
\f[
|
|
183
|
+
\f[V]Gemfile.lock\f[R] with all gems cached will never call out to
|
|
144
184
|
https://rubygems.org.
|
|
145
185
|
.PP
|
|
146
186
|
The server you ran is provided via Puma (https://puma.io/) and
|
|
147
187
|
Rack (https://github.com/rack/rack), however they are not customizable
|
|
148
188
|
at this point.
|
|
149
189
|
.SS Deep Dive
|
|
190
|
+
.PP
|
|
150
191
|
Deep dive into more subjects:
|
|
151
192
|
.IP \[bu] 2
|
|
152
193
|
Private gems
|
|
@@ -161,6 +202,7 @@ Deploying Gemstash
|
|
|
161
202
|
.IP \[bu] 2
|
|
162
203
|
Debugging Gemstash
|
|
163
204
|
.SS Reference
|
|
205
|
+
.PP
|
|
164
206
|
An anatomy of various configuration and commands:
|
|
165
207
|
.IP \[bu] 2
|
|
166
208
|
Configuration
|
|
@@ -180,13 +222,15 @@ Version
|
|
|
180
222
|
To see what has changed in recent versions of Gemstash, see the
|
|
181
223
|
CHANGELOG (https://github.com/rubygems/gemstash/blob/main/CHANGELOG.md).
|
|
182
224
|
.SS Development
|
|
183
|
-
|
|
225
|
+
.PP
|
|
226
|
+
After checking out the repo, run \f[V]bin/setup\f[R] to install
|
|
184
227
|
dependencies.
|
|
185
|
-
Then, run \f[
|
|
186
|
-
While developing, you can run \f[
|
|
187
|
-
You can also run \f[
|
|
228
|
+
Then, run \f[V]rake\f[R] to run RuboCop and the tests.
|
|
229
|
+
While developing, you can run \f[V]bin/gemstash\f[R] to run Gemstash.
|
|
230
|
+
You can also run \f[V]bin/console\f[R] for an interactive prompt that
|
|
188
231
|
will allow you to experiment.
|
|
189
232
|
.SS Contributing
|
|
233
|
+
.PP
|
|
190
234
|
Bug reports and pull requests are welcome on GitHub at
|
|
191
235
|
https://github.com/rubygems/gemstash.
|
|
192
236
|
This project is intended to be a safe, welcoming space for
|
|
@@ -195,5 +239,6 @@ Contributor
|
|
|
195
239
|
Covenant (https://github.com/rubygems/gemstash/blob/main/CODE_OF_CONDUCT.md)
|
|
196
240
|
code of conduct.
|
|
197
241
|
.SS License
|
|
242
|
+
.PP
|
|
198
243
|
The gem is available as open source under the terms of the MIT
|
|
199
244
|
License (http://opensource.org/licenses/MIT).
|