gemstash 2.2.0 → 2.2.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 +1 -1
- data/lib/gemstash/man/gemstash-authorize.1 +66 -0
- data/lib/gemstash/man/gemstash-authorize.1.txt +47 -0
- data/lib/gemstash/man/gemstash-configuration.5 +241 -0
- data/lib/gemstash/man/gemstash-configuration.5.txt +211 -0
- data/lib/gemstash/man/gemstash-customize.7 +316 -0
- data/lib/gemstash/man/gemstash-customize.7.txt +187 -0
- data/lib/gemstash/man/gemstash-debugging.7 +49 -0
- data/lib/gemstash/man/gemstash-debugging.7.txt +30 -0
- data/lib/gemstash/man/gemstash-deploy.7 +87 -0
- data/lib/gemstash/man/gemstash-deploy.7.txt +60 -0
- data/lib/gemstash/man/gemstash-mirror.7 +55 -0
- data/lib/gemstash/man/gemstash-mirror.7.txt +34 -0
- data/lib/gemstash/man/gemstash-multiple-sources.7 +103 -0
- data/lib/gemstash/man/gemstash-multiple-sources.7.txt +71 -0
- data/lib/gemstash/man/gemstash-private-gems.7 +242 -0
- data/lib/gemstash/man/gemstash-private-gems.7.txt +157 -0
- data/lib/gemstash/man/gemstash-readme.7 +245 -0
- data/lib/gemstash/man/gemstash-readme.7.txt +181 -0
- data/lib/gemstash/man/gemstash-setup.1 +58 -0
- data/lib/gemstash/man/gemstash-setup.1.txt +41 -0
- data/lib/gemstash/man/gemstash-start.1 +41 -0
- data/lib/gemstash/man/gemstash-start.1.txt +27 -0
- data/lib/gemstash/man/gemstash-status.1 +35 -0
- data/lib/gemstash/man/gemstash-status.1.txt +23 -0
- data/lib/gemstash/man/gemstash-stop.1 +35 -0
- data/lib/gemstash/man/gemstash-stop.1.txt +23 -0
- data/lib/gemstash/man/gemstash-version.1 +37 -0
- data/lib/gemstash/man/gemstash-version.1.txt +22 -0
- data/lib/gemstash/version.rb +1 -1
- metadata +17 -3
@@ -1 +1,61 @@
|
|
1
|
+
gemstash-deploy(7) gemstash-deploy(7)
|
1
2
|
|
3
|
+
|
4
|
+
|
5
|
+
<!-- Automatically generated by Pandoc -->
|
6
|
+
|
7
|
+
1mDeploying Gemstash0m
|
8
|
+
Bundler is here for the rescue to keep Gemstash up to date! Create a
|
9
|
+
1mGemfile 22mpointing to Gemstash:
|
10
|
+
|
11
|
+
# ./Gemfile
|
12
|
+
source "https://rubygems.org"
|
13
|
+
gem "gemstash"
|
14
|
+
|
15
|
+
Then 1mbundle 22mto create your 1mGemfile.lock22m. When you are ready to up-
|
16
|
+
grade, simply 1mbundle update22m. You may need to run 1mgemstash 22mvia 1mbundle0m
|
17
|
+
1mexec22m. Alternatively, you can 1mgem uninstall gemstash 22mand 1mgem install0m
|
18
|
+
1mgemstash 22mwhen you want to upgrade.
|
19
|
+
|
20
|
+
Gemstash will automatically run any necessary migrations, so updating
|
21
|
+
the gem is all that needs to be done.
|
22
|
+
|
23
|
+
It is probably wise to stop Gemstash before upgrading, then starting
|
24
|
+
again once you are done:
|
25
|
+
|
26
|
+
$ bundle exec gemstash stop
|
27
|
+
$ bundle update
|
28
|
+
$ bundle exec gemstash start
|
29
|
+
|
30
|
+
1mMonitoring0m
|
31
|
+
Health monitoring is built in to Gemstash using the serv-
|
32
|
+
er_health_check-rack (https://github.com/on-site/server_health_check-
|
33
|
+
rack) gem. If you request 1m/health 22mfrom your Gemstash instance, you
|
34
|
+
will get a JSON response along with an HTTP status code indicating suc-
|
35
|
+
cess or failure. The JSON response will look something like this for a
|
36
|
+
success case:
|
37
|
+
|
38
|
+
{
|
39
|
+
"status": {
|
40
|
+
"heartbeat": "OK",
|
41
|
+
"storage_read": "OK",
|
42
|
+
"storage_write": "OK",
|
43
|
+
"db_read": "OK",
|
44
|
+
"db_write": "OK"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
This request will test storage and database access and report on the
|
49
|
+
result. Each key in the status can be requested alone to just report
|
50
|
+
on that status. For example, if you would like a health check that
|
51
|
+
doesn't interact with storage or the database, you can use
|
52
|
+
1m/health/heartbeat 22mwhich will always respond with a success while your
|
53
|
+
Gemstash server is running.
|
54
|
+
|
55
|
+
1mDowngrading0m
|
56
|
+
It is not recommended to go backwards in Gemstash versions. Migrations
|
57
|
+
may have run that could leave the database in a bad state.
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
October 25, 2015 gemstash-deploy(7)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<!-- Automatically generated by Pandoc -->
|
2
|
+
.\" Automatically generated by Pandoc 3.0.1
|
3
|
+
.\"
|
4
|
+
.\" Define V font for inline verbatim, using C font in formats
|
5
|
+
.\" that render this, and otherwise B font.
|
6
|
+
.ie "\f[CB]x\f[]"x" \{\
|
7
|
+
. ftr V B
|
8
|
+
. ftr VI BI
|
9
|
+
. ftr VB B
|
10
|
+
. ftr VBI BI
|
11
|
+
.\}
|
12
|
+
.el \{\
|
13
|
+
. ftr V CR
|
14
|
+
. ftr VI CI
|
15
|
+
. ftr VB CB
|
16
|
+
. ftr VBI CBI
|
17
|
+
.\}
|
18
|
+
.TH "gemstash-mirror" "7" "October 25, 2015" "" ""
|
19
|
+
.hy
|
20
|
+
.SH Using Gemstash as a Mirror
|
21
|
+
.PP
|
22
|
+
If you don\[cq]t have control over your \f[V]Gemfile\f[R], or you
|
23
|
+
don\[cq]t want to force everyone on your team to go through the Gemstash
|
24
|
+
server, you can use Bundler mirroring to bundle against your Gemstash
|
25
|
+
server.
|
26
|
+
.PP
|
27
|
+
For each source in your \f[V]Gemfile\f[R], add a mirror pointing to your
|
28
|
+
Gemstash server:
|
29
|
+
.IP
|
30
|
+
.nf
|
31
|
+
\f[C]
|
32
|
+
$ bundle config mirror.http://rubygems.org http://localhost:9292
|
33
|
+
$ bundle config mirror.https://my.gem-source.local http://localhost:9292/upstream/$(ruby -rcgi -e \[aq]puts CGI.escape(\[dq]https://my.gem-source.local\[dq])\[aq])
|
34
|
+
\f[R]
|
35
|
+
.fi
|
36
|
+
.PP
|
37
|
+
From now on, bundler will fetch gems from those sources via your
|
38
|
+
Gemstash server.
|
39
|
+
.SH Simpler Gemstash Mirrors
|
40
|
+
.PP
|
41
|
+
\f[B]This feature requires Bundler to be at least version
|
42
|
+
\f[VB]1.11.0\f[B].\f[R]
|
43
|
+
.PP
|
44
|
+
If you are using Bundler version \f[V]1.11.0\f[R] or greater, the
|
45
|
+
mirroring becomes a bit easier:
|
46
|
+
.IP
|
47
|
+
.nf
|
48
|
+
\f[C]
|
49
|
+
$ bundle config mirror.http://rubygems.org http://localhost:9292
|
50
|
+
$ bundle config mirror.https://my.gem-source.local http://localhost:9292
|
51
|
+
\f[R]
|
52
|
+
.fi
|
53
|
+
.PP
|
54
|
+
Bundler will then send headers to Gemstash to indicate the correct
|
55
|
+
upstream.
|
@@ -1 +1,35 @@
|
|
1
|
+
gemstash-mirror(7) gemstash-mirror(7)
|
1
2
|
|
3
|
+
|
4
|
+
|
5
|
+
<!-- Automatically generated by Pandoc -->
|
6
|
+
|
7
|
+
1mUsing Gemstash as a Mirror0m
|
8
|
+
If you don't have control over your 1mGemfile22m, or you don't want to force
|
9
|
+
everyone on your team to go through the Gemstash server, you can use
|
10
|
+
Bundler mirroring to bundle against your Gemstash server.
|
11
|
+
|
12
|
+
For each source in your 1mGemfile22m, add a mirror pointing to your Gemstash
|
13
|
+
server:
|
14
|
+
|
15
|
+
$ bundle config mirror.http://rubygems.org http://localhost:9292
|
16
|
+
$ bundle config mirror.https://my.gem-source.local http://localhost:9292/upstream/$(ruby -rcgi -e 'puts CGI.escape("https://my.gem-source.local")')
|
17
|
+
|
18
|
+
From now on, bundler will fetch gems from those sources via your Gem-
|
19
|
+
stash server.
|
20
|
+
|
21
|
+
1mSimpler Gemstash Mirrors0m
|
22
|
+
1mThis feature requires Bundler to be at least version 1.11.0.0m
|
23
|
+
|
24
|
+
If you are using Bundler version 1m1.11.0 22mor greater, the mirroring be-
|
25
|
+
comes a bit easier:
|
26
|
+
|
27
|
+
$ bundle config mirror.http://rubygems.org http://localhost:9292
|
28
|
+
$ bundle config mirror.https://my.gem-source.local http://localhost:9292
|
29
|
+
|
30
|
+
Bundler will then send headers to Gemstash to indicate the correct up-
|
31
|
+
stream.
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
October 25, 2015 gemstash-mirror(7)
|
@@ -0,0 +1,103 @@
|
|
1
|
+
<!-- Automatically generated by Pandoc -->
|
2
|
+
.\" Automatically generated by Pandoc 3.0.1
|
3
|
+
.\"
|
4
|
+
.\" Define V font for inline verbatim, using C font in formats
|
5
|
+
.\" that render this, and otherwise B font.
|
6
|
+
.ie "\f[CB]x\f[]"x" \{\
|
7
|
+
. ftr V B
|
8
|
+
. ftr VI BI
|
9
|
+
. ftr VB B
|
10
|
+
. ftr VBI BI
|
11
|
+
.\}
|
12
|
+
.el \{\
|
13
|
+
. ftr V CR
|
14
|
+
. ftr VI CI
|
15
|
+
. ftr VB CB
|
16
|
+
. ftr VBI CBI
|
17
|
+
.\}
|
18
|
+
.TH "gemstash-multiple-sources" "7" "October 8, 2015" "" ""
|
19
|
+
.hy
|
20
|
+
.SH Multiple Gem Sources
|
21
|
+
.PP
|
22
|
+
Gemstash will stash from any amount of gem sources.
|
23
|
+
By the end of this guide, you will be able to bundle using multiple gem
|
24
|
+
sources, all stashed within your Gemstash server.
|
25
|
+
.SS Default Source
|
26
|
+
.PP
|
27
|
+
When you don\[cq]t provide an explicit source (as with the Quickstart
|
28
|
+
Guide), your gems will be fetched from https://rubygems.org.
|
29
|
+
This default source is not set in stone.
|
30
|
+
To change it, you need only edit the Gemstash configuration found at
|
31
|
+
\f[V]\[ti]/.gemstash/config.yml\f[R]:
|
32
|
+
.IP
|
33
|
+
.nf
|
34
|
+
\f[C]
|
35
|
+
# \[ti]/.gemstash/config.yml
|
36
|
+
---
|
37
|
+
:rubygems_url: https://my.gem-source.local
|
38
|
+
\f[R]
|
39
|
+
.fi
|
40
|
+
.PP
|
41
|
+
Make sure to restart your Gemstash server after changing the config:
|
42
|
+
.IP
|
43
|
+
.nf
|
44
|
+
\f[C]
|
45
|
+
$ gemstash stop
|
46
|
+
$ gemstash start
|
47
|
+
\f[R]
|
48
|
+
.fi
|
49
|
+
.PP
|
50
|
+
Once restarted, bundling against \f[V]http://localhost:9292\f[R] will
|
51
|
+
fetch gems from \f[V]https://my.gem-source.local\f[R].
|
52
|
+
If you had bundled before making these changes, fear not; bundling with
|
53
|
+
a different default gem source will store gems in a separate location,
|
54
|
+
ensuring different sources won\[cq]t leak between each other.
|
55
|
+
.SS Bundling with Multiple Sources
|
56
|
+
.PP
|
57
|
+
Changing the default source won\[cq]t help you if you need to bundle
|
58
|
+
against https://rubygems.org along with additional sources.
|
59
|
+
If you need to bundle with multiple gem sources, Gemstash doesn\[cq]t
|
60
|
+
need to be specially configured.
|
61
|
+
Your Gemstash server will honor any gem source specified via a
|
62
|
+
specialized URL.
|
63
|
+
Consider the following \f[V]Gemfile\f[R]:
|
64
|
+
.IP
|
65
|
+
.nf
|
66
|
+
\f[C]
|
67
|
+
# ./Gemfile
|
68
|
+
require \[dq]cgi\[dq]
|
69
|
+
source \[dq]http://localhost:9292\[dq]
|
70
|
+
gem \[dq]rubywarrior\[dq]
|
71
|
+
|
72
|
+
source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]https://my.gem-source.local\[dq])}\[dq] do
|
73
|
+
gem \[dq]my-gem\[dq]
|
74
|
+
end
|
75
|
+
\f[R]
|
76
|
+
.fi
|
77
|
+
.PP
|
78
|
+
Notice the \f[V]CGI.escape\f[R] call in the second source.
|
79
|
+
This is important, as it properly URL escapes the source URL so Gemstash
|
80
|
+
knows what gem source you want.
|
81
|
+
The \f[V]/upstream\f[R] prefix tells Gemstash to use a gem source other
|
82
|
+
than the default source.
|
83
|
+
You can now bundle with the additional source.
|
84
|
+
.SS Redirecting
|
85
|
+
.PP
|
86
|
+
Gemstash supports an alternate mode of specifying your gem sources.
|
87
|
+
If you want Gemstash to redirect Bundler to your given gem sources, then
|
88
|
+
you can specify your \f[V]Gemfile\f[R] like so:
|
89
|
+
.IP
|
90
|
+
.nf
|
91
|
+
\f[C]
|
92
|
+
# ./Gemfile
|
93
|
+
require \[dq]cgi\[dq]
|
94
|
+
source \[dq]http://localhost:9292/redirect/#{CGI.escape(\[dq]https://rubygems.org\[dq])}\[dq]
|
95
|
+
gem \[dq]rubywarrior\[dq]
|
96
|
+
\f[R]
|
97
|
+
.fi
|
98
|
+
.PP
|
99
|
+
Notice the \f[V]/redirect\f[R] prefix.
|
100
|
+
This prefix tells Gemstash to redirect API calls to the provided URL.
|
101
|
+
Redirected calls like this will not be cached by Gemstash, and gem files
|
102
|
+
will not be stashed, even if they were previously cached or stashed from
|
103
|
+
the same gem source.
|
@@ -1 +1,72 @@
|
|
1
|
+
gemstash-multiple-sources(7) gemstash-multiple-sources(7)
|
1
2
|
|
3
|
+
|
4
|
+
|
5
|
+
<!-- Automatically generated by Pandoc -->
|
6
|
+
|
7
|
+
1mMultiple Gem Sources0m
|
8
|
+
Gemstash will stash from any amount of gem sources. By the end of this
|
9
|
+
guide, you will be able to bundle using multiple gem sources, all
|
10
|
+
stashed within your Gemstash server.
|
11
|
+
|
12
|
+
1mDefault Source0m
|
13
|
+
When you don't provide an explicit source (as with the Quickstart
|
14
|
+
Guide), your gems will be fetched from https://rubygems.org. This de-
|
15
|
+
fault source is not set in stone. To change it, you need only edit the
|
16
|
+
Gemstash configuration found at 1m~/.gemstash/config.yml22m:
|
17
|
+
|
18
|
+
# ~/.gemstash/config.yml
|
19
|
+
---
|
20
|
+
:rubygems_url: https://my.gem-source.local
|
21
|
+
|
22
|
+
Make sure to restart your Gemstash server after changing the config:
|
23
|
+
|
24
|
+
$ gemstash stop
|
25
|
+
$ gemstash start
|
26
|
+
|
27
|
+
Once restarted, bundling against 1mhttp://localhost:9292 22mwill fetch gems
|
28
|
+
from 1mhttps://my.gem-source.local22m. If you had bundled before making
|
29
|
+
these changes, fear not; bundling with a different default gem source
|
30
|
+
will store gems in a separate location, ensuring different sources
|
31
|
+
won't leak between each other.
|
32
|
+
|
33
|
+
1mBundling with Multiple Sources0m
|
34
|
+
Changing the default source won't help you if you need to bundle
|
35
|
+
against https://rubygems.org along with additional sources. If you
|
36
|
+
need to bundle with multiple gem sources, Gemstash doesn't need to be
|
37
|
+
specially configured. Your Gemstash server will honor any gem source
|
38
|
+
specified via a specialized URL. Consider the following 1mGemfile22m:
|
39
|
+
|
40
|
+
# ./Gemfile
|
41
|
+
require "cgi"
|
42
|
+
source "http://localhost:9292"
|
43
|
+
gem "rubywarrior"
|
44
|
+
|
45
|
+
source "http://localhost:9292/upstream/#{CGI.escape("https://my.gem-source.local")}" do
|
46
|
+
gem "my-gem"
|
47
|
+
end
|
48
|
+
|
49
|
+
Notice the 1mCGI.escape 22mcall in the second source. This is important, as
|
50
|
+
it properly URL escapes the source URL so Gemstash knows what gem
|
51
|
+
source you want. The 1m/upstream 22mprefix tells Gemstash to use a gem
|
52
|
+
source other than the default source. You can now bundle with the ad-
|
53
|
+
ditional source.
|
54
|
+
|
55
|
+
1mRedirecting0m
|
56
|
+
Gemstash supports an alternate mode of specifying your gem sources. If
|
57
|
+
you want Gemstash to redirect Bundler to your given gem sources, then
|
58
|
+
you can specify your 1mGemfile 22mlike so:
|
59
|
+
|
60
|
+
# ./Gemfile
|
61
|
+
require "cgi"
|
62
|
+
source "http://localhost:9292/redirect/#{CGI.escape("https://rubygems.org")}"
|
63
|
+
gem "rubywarrior"
|
64
|
+
|
65
|
+
Notice the 1m/redirect 22mprefix. This prefix tells Gemstash to redirect
|
66
|
+
API calls to the provided URL. Redirected calls like this will not be
|
67
|
+
cached by Gemstash, and gem files will not be stashed, even if they
|
68
|
+
were previously cached or stashed from the same gem source.
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
October 8, 2015 gemstash-multiple-sources(7)
|
@@ -0,0 +1,242 @@
|
|
1
|
+
<!-- Automatically generated by Pandoc -->
|
2
|
+
.\" Automatically generated by Pandoc 3.0.1
|
3
|
+
.\"
|
4
|
+
.\" Define V font for inline verbatim, using C font in formats
|
5
|
+
.\" that render this, and otherwise B font.
|
6
|
+
.ie "\f[CB]x\f[]"x" \{\
|
7
|
+
. ftr V B
|
8
|
+
. ftr VI BI
|
9
|
+
. ftr VB B
|
10
|
+
. ftr VBI BI
|
11
|
+
.\}
|
12
|
+
.el \{\
|
13
|
+
. ftr V CR
|
14
|
+
. ftr VI CI
|
15
|
+
. ftr VB CB
|
16
|
+
. ftr VBI CBI
|
17
|
+
.\}
|
18
|
+
.TH "gemstash-private-gems" "7" "October 8, 2015" "" ""
|
19
|
+
.hy
|
20
|
+
.SH Private Gems
|
21
|
+
.PP
|
22
|
+
Stashing private gems in your Gemstash server requires a bit of
|
23
|
+
additional setup.
|
24
|
+
If you haven\[cq]t read through the Quickstart Guide, you should do that
|
25
|
+
first.
|
26
|
+
By the end of this guide, you will be able to interact with your
|
27
|
+
Gemstash server to store and retrieve your private gems.
|
28
|
+
.SS Authorizing
|
29
|
+
.PP
|
30
|
+
\f[B]IMPORTANT NOTE:\f[R] Do not use the actual key value in this
|
31
|
+
document, otherwise your Gemstash server will be vulnerable to anyone
|
32
|
+
who wants to try to use the key against your server.
|
33
|
+
Instead of the key value here, use whatever key is generated from
|
34
|
+
running the commands.
|
35
|
+
.PP
|
36
|
+
In order to push a gem to your Gemstash server, you need to first create
|
37
|
+
an API key.
|
38
|
+
Utilize the \f[V]gemstash authorize\f[R] command to create the API key:
|
39
|
+
.IP
|
40
|
+
.nf
|
41
|
+
\f[C]
|
42
|
+
$ gemstash authorize
|
43
|
+
Your new key is: e374e237fdf5fa5718d2a21bd63dc911
|
44
|
+
\f[R]
|
45
|
+
.fi
|
46
|
+
.PP
|
47
|
+
This new key can \f[V]push\f[R], \f[V]yank\f[R], and \f[V]fetch\f[R]
|
48
|
+
gems from your Gemstash server.
|
49
|
+
Run \f[V]gemstash authorize\f[R] with just the permissions you want to
|
50
|
+
limit what the key will be allowed to do.
|
51
|
+
You can similarly update a specific key by providing it via the
|
52
|
+
\f[V]--key\f[R] option:
|
53
|
+
.IP
|
54
|
+
.nf
|
55
|
+
\f[C]
|
56
|
+
$ gemstash authorize push yank --key e374e237fdf5fa5718d2a21bd63dc911
|
57
|
+
\f[R]
|
58
|
+
.fi
|
59
|
+
.PP
|
60
|
+
When no permissions are provided (like the first example), the key will
|
61
|
+
be authorized for all permissions.
|
62
|
+
Leave the key authorized with everything if you want to use it to try
|
63
|
+
all private gem interactions:
|
64
|
+
.IP
|
65
|
+
.nf
|
66
|
+
\f[C]
|
67
|
+
$ gemstash authorize --key e374e237fdf5fa5718d2a21bd63dc911
|
68
|
+
\f[R]
|
69
|
+
.fi
|
70
|
+
.PP
|
71
|
+
With the key generated, you\[cq]ll need to tell Rubygems about your new
|
72
|
+
key.
|
73
|
+
If you\[cq]ve pushed a gem to https://rubygems.org, then you will
|
74
|
+
already have a credentials file to add the key to.
|
75
|
+
If not, run the following commands before modifying the credentials
|
76
|
+
file:
|
77
|
+
.IP
|
78
|
+
.nf
|
79
|
+
\f[C]
|
80
|
+
$ mkdir -p \[ti]/.gem
|
81
|
+
$ touch \[ti]/.gem/credentials
|
82
|
+
$ chmod 0600 \[ti]/.gem/credentials
|
83
|
+
\f[R]
|
84
|
+
.fi
|
85
|
+
.PP
|
86
|
+
Add your new key to credentials such that it looks something like this
|
87
|
+
(but make sure not to remove any existing keys):
|
88
|
+
.IP
|
89
|
+
.nf
|
90
|
+
\f[C]
|
91
|
+
# \[ti]/.gem/credentials
|
92
|
+
---
|
93
|
+
:test_key: e374e237fdf5fa5718d2a21bd63dc911
|
94
|
+
\f[R]
|
95
|
+
.fi
|
96
|
+
.PP
|
97
|
+
The name \f[V]test_key\f[R] can be anything you want, but you will need
|
98
|
+
to remember it and use it again later in this guide for the
|
99
|
+
\f[V]--key\f[R] option.
|
100
|
+
.SS Creating a Test Gem
|
101
|
+
.PP
|
102
|
+
You\[cq]ll need a test gem before you can play with private gems on your
|
103
|
+
Gemstash server.
|
104
|
+
If you have a gem you can use, move along to the next section.
|
105
|
+
You can start by instantiating a test gem via Bundler:
|
106
|
+
.IP
|
107
|
+
.nf
|
108
|
+
\f[C]
|
109
|
+
$ bundle gem private-example
|
110
|
+
\f[R]
|
111
|
+
.fi
|
112
|
+
.PP
|
113
|
+
You\[cq]ll need to add a summary and description to the new gem\[cq]s
|
114
|
+
gemspec file in order to successfully build it.
|
115
|
+
Once you\[cq]ve built the gem, you will be ready to push the new gem.
|
116
|
+
.IP
|
117
|
+
.nf
|
118
|
+
\f[C]
|
119
|
+
$ cd private-example
|
120
|
+
$ rake build
|
121
|
+
\f[R]
|
122
|
+
.fi
|
123
|
+
.PP
|
124
|
+
You will now have a gem at
|
125
|
+
\f[V]private-example/pkg/private-example-0.1.0.gem\f[R].
|
126
|
+
.SS Pushing
|
127
|
+
.PP
|
128
|
+
If your Gemstash server isn\[cq]t running, go ahead and start it:
|
129
|
+
.IP
|
130
|
+
.nf
|
131
|
+
\f[C]
|
132
|
+
$ gemstash start
|
133
|
+
\f[R]
|
134
|
+
.fi
|
135
|
+
.PP
|
136
|
+
Push your test gem using Rubygems:
|
137
|
+
.IP
|
138
|
+
.nf
|
139
|
+
\f[C]
|
140
|
+
$ gem push --key test_key --host http://localhost:9292/private pkg/private-example-0.1.0.gem
|
141
|
+
\f[R]
|
142
|
+
.fi
|
143
|
+
.PP
|
144
|
+
The \f[V]/private\f[R] portion of the \f[V]--host\f[R] option tells
|
145
|
+
Gemstash you are interacting with the private gems.
|
146
|
+
Gemstash will not let you push, or yank from anything except
|
147
|
+
\f[V]/private\f[R].
|
148
|
+
.SS Bundling
|
149
|
+
.PP
|
150
|
+
Once your gem is pushed to your Gemstash server, you are ready to bundle
|
151
|
+
it.
|
152
|
+
Create a \f[V]Gemfile\f[R] and specify the gem.
|
153
|
+
You will probably want to wrap the private gem in a source block, and
|
154
|
+
let the rest of Gemstash handle all other gems:
|
155
|
+
.IP
|
156
|
+
.nf
|
157
|
+
\f[C]
|
158
|
+
# ./Gemfile
|
159
|
+
source \[dq]http://localhost:9292\[dq]
|
160
|
+
gem \[dq]rubywarrior\[dq]
|
161
|
+
|
162
|
+
source \[dq]http://localhost:9292/private\[dq] do
|
163
|
+
gem \[dq]private-example\[dq]
|
164
|
+
end
|
165
|
+
\f[R]
|
166
|
+
.fi
|
167
|
+
.PP
|
168
|
+
Notice that the Gemstash server points to \f[V]/private\f[R] again when
|
169
|
+
installing your private gem.
|
170
|
+
Go ahead and bundle to install your new private gem:
|
171
|
+
.IP
|
172
|
+
.nf
|
173
|
+
\f[C]
|
174
|
+
$ bundle
|
175
|
+
\f[R]
|
176
|
+
.fi
|
177
|
+
.SS Yanking
|
178
|
+
.PP
|
179
|
+
If you push a private gem by accident, you can yank the gem with
|
180
|
+
Rubygems:
|
181
|
+
.IP
|
182
|
+
.nf
|
183
|
+
\f[C]
|
184
|
+
$ RUBYGEMS_HOST=http://localhost:9292/private gem yank --key test_key private-example --version 0.1.0
|
185
|
+
\f[R]
|
186
|
+
.fi
|
187
|
+
.PP
|
188
|
+
Like with pushing, the \f[V]/private\f[R] portion of the host option
|
189
|
+
tells Gemstash you are interacting with private gems.
|
190
|
+
Gemstash will only let you yank from \f[V]/private\f[R].
|
191
|
+
Unlike pushing, Rubygems doesn\[cq]t support \f[V]--host\f[R] for yank
|
192
|
+
(yet), so you need to specify the host via the \f[V]RUBYGEMS_HOST\f[R]
|
193
|
+
environment variable.
|
194
|
+
.SS Protected Fetching
|
195
|
+
.PP
|
196
|
+
By default, private gems and specs can be accessed without
|
197
|
+
authentication.
|
198
|
+
.PP
|
199
|
+
Private gems often require protected fetching.
|
200
|
+
For backwards compatibility this is disabled by default, but can be
|
201
|
+
enabled via \f[V]$ gemstash setup\f[R] command.
|
202
|
+
.PP
|
203
|
+
When protected fetching is enabled API keys with the permissions
|
204
|
+
\f[V]all\f[R] or \f[V]fetch\f[R] can be used to download gems and specs.
|
205
|
+
.PP
|
206
|
+
On the Bundler side, there are a few ways to configure credentials for a
|
207
|
+
given gem source:
|
208
|
+
.PP
|
209
|
+
Add credentials globally:
|
210
|
+
.IP
|
211
|
+
.nf
|
212
|
+
\f[C]
|
213
|
+
$ bundle config my-gemstash.dev api_key
|
214
|
+
\f[R]
|
215
|
+
.fi
|
216
|
+
.PP
|
217
|
+
Add credentials in Gemfile:
|
218
|
+
.IP
|
219
|
+
.nf
|
220
|
+
\f[C]
|
221
|
+
source \[dq]https://api_key\[at]my-gemstash.dev\[dq]
|
222
|
+
\f[R]
|
223
|
+
.fi
|
224
|
+
.PP
|
225
|
+
However, it\[cq]s not a good practice to commit credentials to source
|
226
|
+
control.
|
227
|
+
A recommended solution is to use Bundler\[cq]s configuration
|
228
|
+
keys (http://bundler.io/man/bundle-config.1.html#CONFIGURATION-KEYS),
|
229
|
+
e.g.:
|
230
|
+
.IP
|
231
|
+
.nf
|
232
|
+
\f[C]
|
233
|
+
$ export BUNDLE_MYGEMSTASH__DEV=api_key
|
234
|
+
\f[R]
|
235
|
+
.fi
|
236
|
+
.PP
|
237
|
+
Behind the scene, Bundler will pick up the ENV var according to the host
|
238
|
+
name (e.g.\ mygemstash.dev) and add to \f[V]URI.userinfo\f[R] for making
|
239
|
+
requests.
|
240
|
+
.PP
|
241
|
+
The API key is treated as a HTTP Basic Auth username and any HTTP Basic
|
242
|
+
password supplied will be ignored.
|