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