gemstash 2.2.2 → 2.7.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/CHANGELOG.md +61 -17
- data/lib/gemstash/authorization.rb +5 -2
- data/lib/gemstash/cli/authorize.rb +42 -1
- data/lib/gemstash/cli/setup.rb +2 -2
- data/lib/gemstash/cli/start.rb +5 -25
- data/lib/gemstash/cli.rb +6 -2
- data/lib/gemstash/config.ru +0 -2
- data/lib/gemstash/configuration.rb +5 -0
- data/lib/gemstash/db/authorization.rb +3 -3
- data/lib/gemstash/env.rb +0 -11
- data/lib/gemstash/gem_source/upstream_source.rb +15 -0
- data/lib/gemstash/logging.rb +14 -2
- data/lib/gemstash/man/gemstash-authorize.1 +21 -33
- data/lib/gemstash/man/gemstash-authorize.1.txt +20 -16
- data/lib/gemstash/man/gemstash-configuration.5 +61 -119
- data/lib/gemstash/man/gemstash-configuration.5.txt +58 -65
- data/lib/gemstash/man/gemstash-customize.7 +60 -103
- data/lib/gemstash/man/gemstash-customize.7.txt +52 -56
- data/lib/gemstash/man/gemstash-debugging.7 +11 -31
- data/lib/gemstash/man/gemstash-debugging.7.txt +8 -13
- data/lib/gemstash/man/gemstash-deploy.7 +15 -39
- data/lib/gemstash/man/gemstash-deploy.7.txt +18 -22
- data/lib/gemstash/man/gemstash-mirror.7 +10 -31
- data/lib/gemstash/man/gemstash-mirror.7.txt +6 -10
- data/lib/gemstash/man/gemstash-multiple-sources.7 +72 -44
- data/lib/gemstash/man/gemstash-multiple-sources.7.txt +66 -22
- data/lib/gemstash/man/gemstash-private-gems.7 +51 -102
- data/lib/gemstash/man/gemstash-private-gems.7.txt +35 -39
- data/lib/gemstash/man/gemstash-readme.7 +42 -88
- data/lib/gemstash/man/gemstash-readme.7.txt +43 -48
- data/lib/gemstash/man/gemstash-setup.1 +13 -33
- data/lib/gemstash/man/gemstash-setup.1.txt +13 -17
- data/lib/gemstash/man/gemstash-start.1 +5 -29
- data/lib/gemstash/man/gemstash-start.1.txt +6 -14
- data/lib/gemstash/man/gemstash-status.1 +5 -23
- data/lib/gemstash/man/gemstash-status.1.txt +6 -10
- data/lib/gemstash/man/gemstash-stop.1 +5 -23
- data/lib/gemstash/man/gemstash-stop.1.txt +6 -10
- data/lib/gemstash/man/gemstash-version.1 +4 -24
- data/lib/gemstash/man/gemstash-version.1.txt +3 -7
- data/lib/gemstash/migrations/05_authorization_names.rb +10 -0
- data/lib/gemstash/upstream.rb +33 -2
- data/lib/gemstash/version.rb +1 -1
- data/lib/gemstash.rb +1 -0
- metadata +35 -14
@@ -1,40 +1,22 @@
|
|
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-deploy" "7" "October 25, 2015" "" ""
|
19
|
-
.hy
|
20
5
|
.SH Deploying Gemstash
|
21
|
-
.PP
|
22
6
|
Bundler is here for the rescue to keep Gemstash up to date!
|
23
|
-
Create a \f[
|
7
|
+
Create a \f[CR]Gemfile\f[R] pointing to Gemstash:
|
24
8
|
.IP
|
25
|
-
.
|
26
|
-
\f[C]
|
9
|
+
.EX
|
27
10
|
# ./Gemfile
|
28
11
|
source \[dq]https://rubygems.org\[dq]
|
29
12
|
gem \[dq]gemstash\[dq]
|
30
|
-
|
31
|
-
.fi
|
13
|
+
.EE
|
32
14
|
.PP
|
33
|
-
Then \f[
|
34
|
-
When you are ready to upgrade, simply \f[
|
35
|
-
You may need to run \f[
|
36
|
-
Alternatively, you can \f[
|
37
|
-
\f[
|
15
|
+
Then \f[CR]bundle\f[R] to create your \f[CR]Gemfile.lock\f[R].
|
16
|
+
When you are ready to upgrade, simply \f[CR]bundle update\f[R].
|
17
|
+
You may need to run \f[CR]gemstash\f[R] via \f[CR]bundle exec\f[R].
|
18
|
+
Alternatively, you can \f[CR]gem uninstall gemstash\f[R] and
|
19
|
+
\f[CR]gem install gemstash\f[R] when you want to upgrade.
|
38
20
|
.PP
|
39
21
|
Gemstash will automatically run any necessary migrations, so updating
|
40
22
|
the gem is all that needs to be done.
|
@@ -42,25 +24,21 @@ the gem is all that needs to be done.
|
|
42
24
|
It is probably wise to stop Gemstash before upgrading, then starting
|
43
25
|
again once you are done:
|
44
26
|
.IP
|
45
|
-
.
|
46
|
-
\f[C]
|
27
|
+
.EX
|
47
28
|
$ bundle exec gemstash stop
|
48
29
|
$ bundle update
|
49
30
|
$ bundle exec gemstash start
|
50
|
-
|
51
|
-
.fi
|
31
|
+
.EE
|
52
32
|
.SS Monitoring
|
53
|
-
.PP
|
54
33
|
Health monitoring is built in to Gemstash using the
|
55
34
|
server_health_check-rack (https://github.com/on-site/server_health_check-rack)
|
56
35
|
gem.
|
57
|
-
If you request \f[
|
36
|
+
If you request \f[CR]/health\f[R] from your Gemstash instance, you will
|
58
37
|
get a JSON response along with an HTTP status code indicating success or
|
59
38
|
failure.
|
60
39
|
The JSON response will look something like this for a success case:
|
61
40
|
.IP
|
62
|
-
.
|
63
|
-
\f[C]
|
41
|
+
.EX
|
64
42
|
{
|
65
43
|
\[dq]status\[dq]: {
|
66
44
|
\[dq]heartbeat\[dq]: \[dq]OK\[dq],
|
@@ -70,18 +48,16 @@ The JSON response will look something like this for a success case:
|
|
70
48
|
\[dq]db_write\[dq]: \[dq]OK\[dq]
|
71
49
|
}
|
72
50
|
}
|
73
|
-
|
74
|
-
.fi
|
51
|
+
.EE
|
75
52
|
.PP
|
76
53
|
This request will test storage and database access and report on the
|
77
54
|
result.
|
78
55
|
Each key in the status can be requested alone to just report on that
|
79
56
|
status.
|
80
57
|
For example, if you would like a health check that doesn\[cq]t interact
|
81
|
-
with storage or the database, you can use \f[
|
58
|
+
with storage or the database, you can use \f[CR]/health/heartbeat\f[R]
|
82
59
|
which will always respond with a success while your Gemstash server is
|
83
60
|
running.
|
84
61
|
.SS Downgrading
|
85
|
-
.PP
|
86
62
|
It is not recommended to go backwards in Gemstash versions.
|
87
63
|
Migrations may have run that could leave the database in a bad state.
|
@@ -1,21 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
4mgemstash-deploy24m(7) 4mgemstash-deploy24m(7)
|
4
2
|
|
5
3
|
<!-- Automatically generated by Pandoc -->
|
6
4
|
|
7
5
|
1mDeploying Gemstash0m
|
8
6
|
Bundler is here for the rescue to keep Gemstash up to date! Create a
|
9
|
-
|
7
|
+
Gemfile pointing to Gemstash:
|
10
8
|
|
11
9
|
# ./Gemfile
|
12
10
|
source "https://rubygems.org"
|
13
11
|
gem "gemstash"
|
14
12
|
|
15
|
-
Then
|
16
|
-
grade, simply
|
17
|
-
|
18
|
-
|
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.
|
19
17
|
|
20
18
|
Gemstash will automatically run any necessary migrations, so updating
|
21
19
|
the gem is all that needs to be done.
|
@@ -28,12 +26,12 @@ gemstash-deploy(7) gemstash-deploy(7)
|
|
28
26
|
$ bundle exec gemstash start
|
29
27
|
|
30
28
|
1mMonitoring0m
|
31
|
-
Health
|
32
|
-
|
33
|
-
rack) gem. If
|
34
|
-
will get a JSON response along with an HTTP
|
35
|
-
|
36
|
-
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:
|
37
35
|
|
38
36
|
{
|
39
37
|
"status": {
|
@@ -45,17 +43,15 @@ gemstash-deploy(7) gemstash-deploy(7)
|
|
45
43
|
}
|
46
44
|
}
|
47
45
|
|
48
|
-
This
|
49
|
-
result.
|
50
|
-
on
|
51
|
-
doesn't
|
52
|
-
|
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
|
53
51
|
Gemstash server is running.
|
54
52
|
|
55
53
|
1mDowngrading0m
|
56
54
|
It is not recommended to go backwards in Gemstash versions. Migrations
|
57
55
|
may have run that could leave the database in a bad state.
|
58
56
|
|
59
|
-
|
60
|
-
|
61
|
-
October 25, 2015 gemstash-deploy(7)
|
57
|
+
October 25, 2015 4mgemstash-deploy24m(7)
|
@@ -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.
|
@@ -1,15 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
4mgemstash-mirror24m(7) 4mgemstash-mirror24m(7)
|
4
2
|
|
5
3
|
<!-- Automatically generated by Pandoc -->
|
6
4
|
|
7
5
|
1mUsing Gemstash as a Mirror0m
|
8
|
-
If you don't have control over your
|
9
|
-
everyone
|
6
|
+
If you don't have control over your Gemfile, or you don't want to force
|
7
|
+
everyone on your team to go through the Gemstash server, you can use
|
10
8
|
Bundler mirroring to bundle against your Gemstash server.
|
11
9
|
|
12
|
-
For each source in your
|
10
|
+
For each source in your Gemfile, add a mirror pointing to your Gemstash
|
13
11
|
server:
|
14
12
|
|
15
13
|
$ bundle config mirror.http://rubygems.org http://localhost:9292
|
@@ -21,7 +19,7 @@ gemstash-mirror(7) gemstash-mirror(7)
|
|
21
19
|
1mSimpler Gemstash Mirrors0m
|
22
20
|
1mThis feature requires Bundler to be at least version 1.11.0.0m
|
23
21
|
|
24
|
-
If you are using Bundler version
|
22
|
+
If you are using Bundler version 1.11.0 or greater, the mirroring be-
|
25
23
|
comes a bit easier:
|
26
24
|
|
27
25
|
$ bundle config mirror.http://rubygems.org http://localhost:9292
|
@@ -30,6 +28,4 @@ gemstash-mirror(7) gemstash-mirror(7)
|
|
30
28
|
Bundler will then send headers to Gemstash to indicate the correct up-
|
31
29
|
stream.
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
October 25, 2015 gemstash-mirror(7)
|
31
|
+
October 25, 2015 4mgemstash-mirror24m(7)
|
@@ -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,82 @@ 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
|
-
.
|
52
|
+
|
53
|
+
source \[dq]http://localhost:9292/upstream/my-other.gem-source.local\[dq] do
|
54
|
+
gem \[dq]my-other-gem\[dq]
|
55
|
+
end
|
56
|
+
.EE
|
77
57
|
.PP
|
78
|
-
Notice the \f[
|
58
|
+
Notice the \f[CR]CGI.escape\f[R] call in the second source.
|
79
59
|
This is important, as it properly URL escapes the source URL so Gemstash
|
80
60
|
knows what gem source you want.
|
81
|
-
The \f[
|
61
|
+
The \f[CR]/upstream\f[R] prefix tells Gemstash to use a gem source other
|
82
62
|
than the default source.
|
83
63
|
You can now bundle with the additional source.
|
84
|
-
.SS Redirecting
|
85
64
|
.PP
|
65
|
+
Notice that the third source doesn\[cq]t need to be escaped.
|
66
|
+
This is because the \f[CR]https://\f[R] is used by default when no
|
67
|
+
scheme is set, and the source URL does not contain any characters that
|
68
|
+
need to be escaped.
|
69
|
+
.SS Authentication with Multiple Sources
|
70
|
+
You can use basic authentication or API keys on sources directly in
|
71
|
+
Gemfile or using ENV variables on the Gemstash instance.
|
72
|
+
.PP
|
73
|
+
Example \f[CR]Gemfile\f[R]:
|
74
|
+
.IP
|
75
|
+
.EX
|
76
|
+
# ./Gemfile
|
77
|
+
require \[dq]cgi\[dq]
|
78
|
+
source \[dq]http://localhost:9292\[dq]
|
79
|
+
|
80
|
+
source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]user:password\[at]my.gem-source.local\[dq])}\[dq] do
|
81
|
+
gem \[dq]my-gem\[dq]
|
82
|
+
end
|
83
|
+
|
84
|
+
source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]api_key\[at]my-other.gem-source.local\[dq])}\[dq] do
|
85
|
+
gem \[dq]my-other-gem\[dq]
|
86
|
+
end
|
87
|
+
.EE
|
88
|
+
.PP
|
89
|
+
If you set \f[CR]GEMSTASH_<HOST>\f[R] ENV variable with your
|
90
|
+
authentication information, you can omit it from the \f[CR]Gemfile\f[R]:
|
91
|
+
.IP
|
92
|
+
.EX
|
93
|
+
# ./Gemfile
|
94
|
+
source \[dq]http://localhost:9292\[dq]
|
95
|
+
|
96
|
+
source \[dq]http://localhost:9292/upstream/my.gem-source.local\[dq] do
|
97
|
+
gem \[dq]my-gem\[dq]
|
98
|
+
end
|
99
|
+
.EE
|
100
|
+
.PP
|
101
|
+
And run the Gemstash with the credentials set in an ENV variable:
|
102
|
+
.IP
|
103
|
+
.EX
|
104
|
+
GEMSTASH_MY__GEM___SOURCE__LOCAL=user:password gemstash start --config-file config.yml.erb
|
105
|
+
.EE
|
106
|
+
.PP
|
107
|
+
The name of the ENV variable is the uppercase version of the host name,
|
108
|
+
with all \f[CR].\f[R] characters replaced with \f[CR]__\f[R], all
|
109
|
+
\f[CR]-\f[R] with \f[CR]___\f[R] and a \f[CR]GEMSTASH_\f[R] prefix (it
|
110
|
+
uses the same syntax as
|
111
|
+
Bundler (https://bundler.io/v2.4/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-SOURCES)).
|
112
|
+
.PP
|
113
|
+
Example: \f[CR]my.gem-source.local\f[R] =>
|
114
|
+
\f[CR]GEMSTASH_MY__GEM___SOURCE__LOCAL\f[R]
|
115
|
+
.SS Redirecting
|
86
116
|
Gemstash supports an alternate mode of specifying your gem sources.
|
87
117
|
If you want Gemstash to redirect Bundler to your given gem sources, then
|
88
|
-
you can specify your \f[
|
118
|
+
you can specify your \f[CR]Gemfile\f[R] like so:
|
89
119
|
.IP
|
90
|
-
.
|
91
|
-
\f[C]
|
120
|
+
.EX
|
92
121
|
# ./Gemfile
|
93
122
|
require \[dq]cgi\[dq]
|
94
123
|
source \[dq]http://localhost:9292/redirect/#{CGI.escape(\[dq]https://rubygems.org\[dq])}\[dq]
|
95
124
|
gem \[dq]rubywarrior\[dq]
|
96
|
-
|
97
|
-
.fi
|
125
|
+
.EE
|
98
126
|
.PP
|
99
|
-
Notice the \f[
|
127
|
+
Notice the \f[CR]/redirect\f[R] prefix.
|
100
128
|
This prefix tells Gemstash to redirect API calls to the provided URL.
|
101
129
|
Redirected calls like this will not be cached by Gemstash, and gem files
|
102
130
|
will not be stashed, even if they were previously cached or stashed from
|
@@ -1,19 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
4mgemstash-multiple-sources24m(7) 4mgemstash-multiple-sources24m(7)
|
4
2
|
|
5
3
|
<!-- Automatically generated by Pandoc -->
|
6
4
|
|
7
5
|
1mMultiple Gem Sources0m
|
8
6
|
Gemstash will stash from any amount of gem sources. By the end of this
|
9
|
-
guide,
|
7
|
+
guide, you will be able to bundle using multiple gem sources, all
|
10
8
|
stashed within your Gemstash server.
|
11
9
|
|
12
10
|
1mDefault Source0m
|
13
|
-
When
|
14
|
-
Guide),
|
11
|
+
When you don't provide an explicit source (as with the Quickstart
|
12
|
+
Guide), your gems will be fetched from https://rubygems.org. This de-
|
15
13
|
fault source is not set in stone. To change it, you need only edit the
|
16
|
-
Gemstash configuration found at
|
14
|
+
Gemstash configuration found at ~/.gemstash/config.yml:
|
17
15
|
|
18
16
|
# ~/.gemstash/config.yml
|
19
17
|
---
|
@@ -24,8 +22,8 @@ gemstash-multiple-sources(7) gemstash-multiple-sources(7)
|
|
24
22
|
$ gemstash stop
|
25
23
|
$ gemstash start
|
26
24
|
|
27
|
-
Once restarted, bundling against
|
28
|
-
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
|
29
27
|
these changes, fear not; bundling with a different default gem source
|
30
28
|
will store gems in a separate location, ensuring different sources
|
31
29
|
won't leak between each other.
|
@@ -35,7 +33,7 @@ gemstash-multiple-sources(7) gemstash-multiple-sources(7)
|
|
35
33
|
against https://rubygems.org along with additional sources. If you
|
36
34
|
need to bundle with multiple gem sources, Gemstash doesn't need to be
|
37
35
|
specially configured. Your Gemstash server will honor any gem source
|
38
|
-
specified via a specialized URL. Consider the following
|
36
|
+
specified via a specialized URL. Consider the following Gemfile:
|
39
37
|
|
40
38
|
# ./Gemfile
|
41
39
|
require "cgi"
|
@@ -46,27 +44,73 @@ gemstash-multiple-sources(7) gemstash-multiple-sources(7)
|
|
46
44
|
gem "my-gem"
|
47
45
|
end
|
48
46
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
source "http://localhost:9292/upstream/my-other.gem-source.local" do
|
48
|
+
gem "my-other-gem"
|
49
|
+
end
|
50
|
+
|
51
|
+
Notice the CGI.escape call in the second source. This is important, as
|
52
|
+
it properly URL escapes the source URL so Gemstash knows what gem
|
53
|
+
source you want. The /upstream prefix tells Gemstash to use a gem
|
54
|
+
source other than the default source. You can now bundle with the ad-
|
53
55
|
ditional source.
|
54
56
|
|
57
|
+
Notice that the third source doesn't need to be escaped. This is be-
|
58
|
+
cause the https:// is used by default when no scheme is set, and the
|
59
|
+
source URL does not contain any characters that need to be escaped.
|
60
|
+
|
61
|
+
1mAuthentication with Multiple Sources0m
|
62
|
+
You can use basic authentication or API keys on sources directly in
|
63
|
+
Gemfile or using ENV variables on the Gemstash instance.
|
64
|
+
|
65
|
+
Example Gemfile:
|
66
|
+
|
67
|
+
# ./Gemfile
|
68
|
+
require "cgi"
|
69
|
+
source "http://localhost:9292"
|
70
|
+
|
71
|
+
source "http://localhost:9292/upstream/#{CGI.escape("user:password@my.gem-source.local")}" do
|
72
|
+
gem "my-gem"
|
73
|
+
end
|
74
|
+
|
75
|
+
source "http://localhost:9292/upstream/#{CGI.escape("api_key@my-other.gem-source.local")}" do
|
76
|
+
gem "my-other-gem"
|
77
|
+
end
|
78
|
+
|
79
|
+
If you set GEMSTASH_<HOST> ENV variable with your authentication infor-
|
80
|
+
mation, you can omit it from the Gemfile:
|
81
|
+
|
82
|
+
# ./Gemfile
|
83
|
+
source "http://localhost:9292"
|
84
|
+
|
85
|
+
source "http://localhost:9292/upstream/my.gem-source.local" do
|
86
|
+
gem "my-gem"
|
87
|
+
end
|
88
|
+
|
89
|
+
And run the Gemstash with the credentials set in an ENV variable:
|
90
|
+
|
91
|
+
GEMSTASH_MY__GEM___SOURCE__LOCAL=user:password gemstash start --config-file config.yml.erb
|
92
|
+
|
93
|
+
The name of the ENV variable is the uppercase version of the host name,
|
94
|
+
with all . characters replaced with __, all - with ___ and a GEMSTASH_
|
95
|
+
prefix (it uses the same syntax as Bundler
|
96
|
+
(https://bundler.io/v2.4/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-
|
97
|
+
SOURCES)).
|
98
|
+
|
99
|
+
Example: my.gem-source.local => GEMSTASH_MY__GEM___SOURCE__LOCAL
|
100
|
+
|
55
101
|
1mRedirecting0m
|
56
102
|
Gemstash supports an alternate mode of specifying your gem sources. If
|
57
|
-
you
|
58
|
-
you can specify your
|
103
|
+
you want Gemstash to redirect Bundler to your given gem sources, then
|
104
|
+
you can specify your Gemfile like so:
|
59
105
|
|
60
106
|
# ./Gemfile
|
61
107
|
require "cgi"
|
62
108
|
source "http://localhost:9292/redirect/#{CGI.escape("https://rubygems.org")}"
|
63
109
|
gem "rubywarrior"
|
64
110
|
|
65
|
-
Notice
|
66
|
-
API
|
67
|
-
cached
|
111
|
+
Notice the /redirect prefix. This prefix tells Gemstash to redirect
|
112
|
+
API calls to the provided URL. Redirected calls like this will not be
|
113
|
+
cached by Gemstash, and gem files will not be stashed, even if they
|
68
114
|
were previously cached or stashed from the same gem source.
|
69
115
|
|
70
|
-
|
71
|
-
|
72
|
-
October 8, 2015 gemstash-multiple-sources(7)
|
116
|
+
October 8, 2015 4mgemstash-multiple-sources24m(7)
|