gemstash 2.8.1 → 2.9.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemstash/authorization.rb +0 -2
  3. data/lib/gemstash/cache.rb +5 -4
  4. data/lib/gemstash/cli/base.rb +9 -2
  5. data/lib/gemstash/cli/setup.rb +1 -1
  6. data/lib/gemstash/cli/start.rb +4 -0
  7. data/lib/gemstash/configuration.rb +71 -1
  8. data/lib/gemstash/db/upstream.rb +30 -2
  9. data/lib/gemstash/dependencies.rb +28 -5
  10. data/lib/gemstash/env.rb +4 -2
  11. data/lib/gemstash/gem_fetcher.rb +1 -2
  12. data/lib/gemstash/gem_pusher.rb +24 -20
  13. data/lib/gemstash/gem_source/private_source.rb +22 -6
  14. data/lib/gemstash/gem_source/upstream_source.rb +129 -34
  15. data/lib/gemstash/http_client.rb +167 -8
  16. data/lib/gemstash/logging.rb +3 -1
  17. data/lib/gemstash/man/gemstash-authorize.1 +29 -48
  18. data/lib/gemstash/man/gemstash-authorize.1.txt +14 -14
  19. data/lib/gemstash/man/gemstash-configuration.5 +231 -154
  20. data/lib/gemstash/man/gemstash-configuration.5.txt +208 -93
  21. data/lib/gemstash/man/gemstash-customize.7 +150 -168
  22. data/lib/gemstash/man/gemstash-customize.7.txt +80 -86
  23. data/lib/gemstash/man/gemstash-debugging.7 +20 -33
  24. data/lib/gemstash/man/gemstash-debugging.7.txt +5 -7
  25. data/lib/gemstash/man/gemstash-deploy.7 +31 -53
  26. data/lib/gemstash/man/gemstash-deploy.7.txt +17 -18
  27. data/lib/gemstash/man/gemstash-mirror.7 +24 -37
  28. data/lib/gemstash/man/gemstash-mirror.7.txt +14 -9
  29. data/lib/gemstash/man/gemstash-multiple-sources.7 +105 -110
  30. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +62 -41
  31. data/lib/gemstash/man/gemstash-private-gems.7 +87 -136
  32. data/lib/gemstash/man/gemstash-private-gems.7.txt +30 -30
  33. data/lib/gemstash/man/gemstash-readme.7 +105 -127
  34. data/lib/gemstash/man/gemstash-readme.7.txt +43 -49
  35. data/lib/gemstash/man/gemstash-setup.1 +22 -42
  36. data/lib/gemstash/man/gemstash-setup.1.txt +12 -12
  37. data/lib/gemstash/man/gemstash-start.1 +9 -27
  38. data/lib/gemstash/man/gemstash-start.1.txt +5 -5
  39. data/lib/gemstash/man/gemstash-status.1 +9 -27
  40. data/lib/gemstash/man/gemstash-status.1.txt +5 -5
  41. data/lib/gemstash/man/gemstash-stop.1 +9 -27
  42. data/lib/gemstash/man/gemstash-stop.1.txt +5 -5
  43. data/lib/gemstash/man/gemstash-version.1 +8 -28
  44. data/lib/gemstash/man/gemstash-version.1.txt +2 -2
  45. data/lib/gemstash/puma.rb +1 -0
  46. data/lib/gemstash/rack_env_rewriter.rb +3 -0
  47. data/lib/gemstash/upstream.rb +83 -6
  48. data/lib/gemstash/version.rb +1 -1
  49. data/lib/gemstash/web.rb +12 -0
  50. metadata +7 -7
@@ -1,29 +1,34 @@
1
- 4mgemstash-mirror24m(7) 4mgemstash-mirror24m(7)
1
+ 4mgemstash-mirror24m(7) Miscellaneous Information Manual 4mgemstash-mirror24m(7)
2
2
 
3
3
  1mUsing Gemstash as a Mirror0m
4
- If you don't have control over your 1mGemfile22m, or you don't want to force
4
+ If you don't have control over your Gemfile, or you don't want to force
5
5
  everyone on your team to go through the Gemstash server, you can use
6
6
  Bundler mirroring to bundle against your Gemstash server.
7
7
 
8
- For each source in your 1mGemfile22m, add a mirror pointing to your Gemstash
9
- server:
8
+ For each source in your Gemfile, add a mirror pointing to your Gemstash
9
+ server. Before upgrading, add every source other than the configured
10
+ :rubygems_url to :allowed_upstreams in Gemstash's configuration. Un-
11
+ listed mirror sources return 403; list any CDN used for redirects in
12
+ :allowed_redirects. The mirror source scheme must match its :al-
13
+ lowed_upstreams entry (or :rubygems_url for the default source). For
14
+ example:
10
15
 
11
- $ bundle config mirror.http://rubygems.org http://localhost:9292
16
+ $ bundle config mirror.https://rubygems.org http://localhost:9292
12
17
  $ bundle config mirror.https://my.gem-source.local http://localhost:9292/upstream/$(ruby -rcgi -e 'puts CGI.escape("https://my.gem-source.local")')
13
18
 
14
- From now on, bundler will fetch gems from those sources via your Gem-
19
+ From now on, bundler will fetch gems from those sources via your Gem-
15
20
  stash server.
16
21
 
17
22
  1mSimpler Gemstash Mirrors0m
18
23
  1mThis feature requires Bundler to be at least version 1.11.0.0m
19
24
 
20
- If you are using Bundler version 1m1.11.0 22mor greater, the mirroring be-
25
+ If you are using Bundler version 1.11.0 or greater, the mirroring be-
21
26
  comes a bit easier:
22
27
 
23
- $ bundle config mirror.http://rubygems.org http://localhost:9292
28
+ $ bundle config mirror.https://rubygems.org http://localhost:9292
24
29
  $ bundle config mirror.https://my.gem-source.local http://localhost:9292
25
30
 
26
- Bundler will then send headers to Gemstash to indicate the correct up-
31
+ Bundler will then send headers to Gemstash to indicate the correct up-
27
32
  stream.
28
33
 
29
34
  October 25, 2015 4mgemstash-mirror24m(7)
@@ -1,164 +1,159 @@
1
- .\" Automatically generated by Pandoc 3.1.3
1
+ .\" Automatically generated by Pandoc 3.7.0.2
2
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
- .\}
17
- .TH "gemstash-multiple-sources" "7" "October 8, 2015" "" ""
18
- .hy
3
+ .TH "gemstash\-multiple\-sources" "7" "October 8, 2015" ""
19
4
  .SH Multiple Gem Sources
20
- .PP
21
5
  Gemstash will stash from any amount of gem sources.
22
6
  By the end of this guide, you will be able to bundle using multiple gem
23
7
  sources, all stashed within your Gemstash server.
24
8
  .SS Default Source
25
- .PP
26
- When you don\[cq]t provide an explicit source (as with the Quickstart
9
+ When you don\(cqt provide an explicit source (as with the Quickstart
27
10
  Guide), your gems will be fetched from https://rubygems.org.
28
11
  This default source is not set in stone.
29
12
  To change it, you need only edit the Gemstash configuration found at
30
- \f[V]\[ti]/.gemstash/config.yml\f[R]:
13
+ \f[CR]\(ti/.gemstash/config.yml\f[R]:
31
14
  .IP
32
- .nf
33
- \f[C]
34
- # \[ti]/.gemstash/config.yml
35
- ---
36
- :rubygems_url: https://my.gem-source.local
37
- \f[R]
38
- .fi
15
+ .EX
16
+ \f[I]# \(ti/.gemstash/config.yml\f[R]
17
+ \-\-\-
18
+ :rubygems_url\f[B]:\f[R] https://my.gem\-source.local
19
+ .EE
39
20
  .PP
40
21
  Make sure to restart your Gemstash server after changing the config:
41
22
  .IP
42
- .nf
43
- \f[C]
23
+ .EX
44
24
  $ gemstash stop
45
25
  $ gemstash start
46
- \f[R]
47
- .fi
26
+ .EE
48
27
  .PP
49
- Once restarted, bundling against \f[V]http://localhost:9292\f[R] will
50
- fetch gems from \f[V]https://my.gem-source.local\f[R].
28
+ Once restarted, bundling against \f[CR]http://localhost:9292\f[R] will
29
+ fetch gems from \f[CR]https://my.gem\-source.local\f[R].
51
30
  If you had bundled before making these changes, fear not; bundling with
52
31
  a different default gem source will store gems in a separate location,
53
- ensuring different sources won\[cq]t leak between each other.
32
+ ensuring different sources won\(cqt leak between each other.
54
33
  .SS Bundling with Multiple Sources
55
- .PP
56
- Changing the default source won\[cq]t help you if you need to bundle
34
+ Changing the default source won\(cqt help you if you need to bundle
57
35
  against https://rubygems.org along with additional sources.
58
- If you need to bundle with multiple gem sources, Gemstash doesn\[cq]t
59
- need to be specially configured.
60
- Your Gemstash server will honor any gem source specified via a
61
- specialized URL.
62
- Consider the following \f[V]Gemfile\f[R]:
36
+ If you need to bundle with multiple gem sources, list each additional
37
+ source in \f[CR]:allowed_upstreams\f[R] before upgrading.
38
+ By default Gemstash permits only its configured
39
+ \f[CR]:rubygems_url\f[R]; an unlisted source returns 403.
40
+ Consider the following \f[CR]Gemfile\f[R]:
63
41
  .IP
64
- .nf
65
- \f[C]
66
- # ./Gemfile
67
- require \[dq]cgi\[dq]
68
- source \[dq]http://localhost:9292\[dq]
69
- gem \[dq]rubywarrior\[dq]
42
+ .EX
43
+ \f[I]# ./Gemfile\f[R]
44
+ require \(dqcgi\(dq
45
+ source \(dqhttp://localhost:9292\(dq
46
+ gem \(dqrubywarrior\(dq
70
47
 
71
- source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]https://my.gem-source.local\[dq])}\[dq] do
72
- gem \[dq]my-gem\[dq]
73
- end
48
+ source \(dqhttp://localhost:9292/upstream/#{CGI.escape(\(dqhttps://my.gem\-source.local\(dq)}\(dq \f[B]do\f[R]
49
+ gem \(dqmy\-gem\(dq
50
+ \f[B]end\f[R]
74
51
 
75
- source \[dq]http://localhost:9292/upstream/my-other.gem-source.local\[dq] do
76
- gem \[dq]my-other-gem\[dq]
77
- end
78
- \f[R]
79
- .fi
52
+ source \(dqhttp://localhost:9292/upstream/my\-other.gem\-source.local\(dq \f[B]do\f[R]
53
+ gem \(dqmy\-other\-gem\(dq
54
+ \f[B]end\f[R]
55
+ .EE
80
56
  .PP
81
- Notice the \f[V]CGI.escape\f[R] call in the second source.
57
+ Notice the \f[CR]CGI.escape\f[R] call in the second source.
82
58
  This is important, as it properly URL escapes the source URL so Gemstash
83
59
  knows what gem source you want.
84
- The \f[V]/upstream\f[R] prefix tells Gemstash to use a gem source other
60
+ The \f[CR]/upstream\f[R] prefix tells Gemstash to use a gem source other
85
61
  than the default source.
86
62
  You can now bundle with the additional source.
87
63
  .PP
88
- Notice that the third source doesn\[cq]t need to be escaped.
89
- This is because the \f[V]https://\f[R] is used by default when no scheme
90
- is set, and the source URL does not contain any characters that need to
91
- be escaped.
64
+ Notice that the third source doesn\(cqt need to be escaped.
65
+ This is because the \f[CR]https://\f[R] is used by default when no
66
+ scheme is set, and the source URL does not contain any characters that
67
+ need to be escaped.
92
68
  .SS Authentication with Multiple Sources
93
- .PP
94
69
  You can use basic authentication or API keys on sources directly in
95
70
  Gemfile or using ENV variables on the Gemstash instance.
96
71
  .PP
97
- Example \f[V]Gemfile\f[R]:
72
+ Example \f[CR]Gemfile\f[R]:
98
73
  .IP
99
- .nf
100
- \f[C]
101
- # ./Gemfile
102
- require \[dq]cgi\[dq]
103
- source \[dq]http://localhost:9292\[dq]
74
+ .EX
75
+ \f[I]# ./Gemfile\f[R]
76
+ require \(dqcgi\(dq
77
+ source \(dqhttp://localhost:9292\(dq
104
78
 
105
- source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]user:password\[at]my.gem-source.local\[dq])}\[dq] do
106
- gem \[dq]my-gem\[dq]
107
- end
79
+ source \(dqhttp://localhost:9292/upstream/#{CGI.escape(\(dquser:password\(atmy.gem\-source.local\(dq)}\(dq \f[B]do\f[R]
80
+ gem \(dqmy\-gem\(dq
81
+ \f[B]end\f[R]
108
82
 
109
- source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]api_key\[at]my-other.gem-source.local\[dq])}\[dq] do
110
- gem \[dq]my-other-gem\[dq]
111
- end
112
- \f[R]
113
- .fi
83
+ source \(dqhttp://localhost:9292/upstream/#{CGI.escape(\(dqapi_key\(atmy\-other.gem\-source.local\(dq)}\(dq \f[B]do\f[R]
84
+ gem \(dqmy\-other\-gem\(dq
85
+ \f[B]end\f[R]
86
+ .EE
114
87
  .PP
115
- If you set \f[V]GEMSTASH_<HOST>\f[R] ENV variable with your
116
- authentication information, you can omit it from the \f[V]Gemfile\f[R]:
88
+ If you set \f[CR]GEMSTASH_<HOST>\f[R] ENV variable with your
89
+ authentication information, you can omit it from the \f[CR]Gemfile\f[R]:
117
90
  .IP
118
- .nf
119
- \f[C]
120
- # ./Gemfile
121
- source \[dq]http://localhost:9292\[dq]
91
+ .EX
92
+ \f[I]# ./Gemfile\f[R]
93
+ source \(dqhttp://localhost:9292\(dq
122
94
 
123
- source \[dq]http://localhost:9292/upstream/my.gem-source.local\[dq] do
124
- gem \[dq]my-gem\[dq]
125
- end
126
- \f[R]
127
- .fi
95
+ source \(dqhttp://localhost:9292/upstream/my.gem\-source.local\(dq \f[B]do\f[R]
96
+ gem \(dqmy\-gem\(dq
97
+ \f[B]end\f[R]
98
+ .EE
128
99
  .PP
129
100
  And run the Gemstash with the credentials set in an ENV variable:
130
101
  .IP
131
- .nf
132
- \f[C]
133
- GEMSTASH_MY__GEM___SOURCE__LOCAL=user:password gemstash start --config-file config.yml.erb
134
- \f[R]
135
- .fi
102
+ .EX
103
+ GEMSTASH_MY__GEM___SOURCE__LOCAL=user:password gemstash start \-\-config\-file config.yml.erb
104
+ .EE
136
105
  .PP
137
106
  The name of the ENV variable is the uppercase version of the host name,
138
- with all \f[V].\f[R] characters replaced with \f[V]__\f[R], all
139
- \f[V]-\f[R] with \f[V]___\f[R] and a \f[V]GEMSTASH_\f[R] prefix (it uses
140
- the same syntax as
141
- Bundler (https://bundler.io/v2.4/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-SOURCES)).
107
+ with all \f[CR].\f[R] characters replaced with \f[CR]__\f[R], all
108
+ \f[CR]\-\f[R] with \f[CR]___\f[R] and a \f[CR]GEMSTASH_\f[R] prefix (it
109
+ uses the same syntax as \c
110
+ .UR https://bundler.io/v2.4/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-SOURCES
111
+ Bundler
112
+ .UE \c
113
+ ).
142
114
  .PP
143
- Example: \f[V]my.gem-source.local\f[R] =>
144
- \f[V]GEMSTASH_MY__GEM___SOURCE__LOCAL\f[R]
145
- .SS Redirecting
115
+ Example: \f[CR]my.gem\-source.local\f[R] =>
116
+ \f[CR]GEMSTASH_MY__GEM___SOURCE__LOCAL\f[R]
146
117
  .PP
118
+ When credentials for a request are available from more than one place,
119
+ Gemstash uses the first of: the URL the client asked for, the matching
120
+ \f[CR]:rubygems_url\f[R] or \f[CR]:allowed_upstreams\f[R] entry, and the
121
+ \f[CR]GEMSTASH_<HOST>\f[R] variable.
122
+ Credentials in a URL are percent\-decoded before use, while the variable
123
+ is used as written.
124
+ .SS Redirecting
147
125
  Gemstash supports an alternate mode of specifying your gem sources.
148
126
  If you want Gemstash to redirect Bundler to your given gem sources, then
149
- you can specify your \f[V]Gemfile\f[R] like so:
127
+ you can specify your \f[CR]Gemfile\f[R] like so:
150
128
  .IP
151
- .nf
152
- \f[C]
153
- # ./Gemfile
154
- require \[dq]cgi\[dq]
155
- source \[dq]http://localhost:9292/redirect/#{CGI.escape(\[dq]https://rubygems.org\[dq])}\[dq]
156
- gem \[dq]rubywarrior\[dq]
157
- \f[R]
158
- .fi
129
+ .EX
130
+ \f[I]# ./Gemfile\f[R]
131
+ require \(dqcgi\(dq
132
+ source \(dqhttp://localhost:9292/redirect/#{CGI.escape(\(dqhttps://rubygems.org\(dq)}\(dq
133
+ gem \(dqrubywarrior\(dq
134
+ .EE
159
135
  .PP
160
- Notice the \f[V]/redirect\f[R] prefix.
136
+ Notice the \f[CR]/redirect\f[R] prefix.
161
137
  This prefix tells Gemstash to redirect API calls to the provided URL.
162
138
  Redirected calls like this will not be cached by Gemstash, and gem files
163
139
  will not be stashed, even if they were previously cached or stashed from
164
140
  the same gem source.
141
+ .SS Restricting Gem Sources
142
+ Gemstash allows only its configured \f[CR]:rubygems_url\f[R] by default.
143
+ Before upgrading, list any additional Gemfile or mirror sources you use
144
+ in the Gemstash configuration so Bundler requests for them continue
145
+ working:
146
+ .IP
147
+ .EX
148
+ \f[I]# \(ti/.gemstash/config.yml\f[R]
149
+ \-\-\-
150
+ :allowed_upstreams\f[B]:\f[R]
151
+ \f[B]\-\f[R] https://my.gem\-source.local
152
+ \f[B]\-\f[R] https://my\-other.gem\-source.local
153
+ .EE
154
+ .PP
155
+ Gemstash will then only fetch from, or redirect to, the default source
156
+ and the listed gem sources.
157
+ Requests for any other gem source are refused.
158
+ See the \f[CR]:allowed_upstreams\f[R] configuration key for how gem
159
+ sources are compared.
@@ -1,4 +1,4 @@
1
- 4mgemstash-multiple-sources24m(7) 4mgemstash-multiple-sources24m(7)
1
+ 4mgemstas...-sources24m(7) Miscellaneous Information Manual 4mgemstas...-sources24m(7)
2
2
 
3
3
  1mMultiple Gem Sources0m
4
4
  Gemstash will stash from any amount of gem sources. By the end of this
@@ -9,19 +9,19 @@
9
9
  When you don't provide an explicit source (as with the Quickstart
10
10
  Guide), your gems will be fetched from https://rubygems.org. This de-
11
11
  fault source is not set in stone. To change it, you need only edit the
12
- Gemstash configuration found at 1m~/.gemstash/config.yml22m:
12
+ Gemstash configuration found at ~/.gemstash/config.yml:
13
13
 
14
- # ~/.gemstash/config.yml
14
+ 4m#24m 4m~/.gemstash/config.yml0m
15
15
  ---
16
- :rubygems_url: https://my.gem-source.local
16
+ :rubygems_url1m: 22mhttps://my.gem-source.local
17
17
 
18
18
  Make sure to restart your Gemstash server after changing the config:
19
19
 
20
20
  $ gemstash stop
21
21
  $ gemstash start
22
22
 
23
- Once restarted, bundling against 1mhttp://localhost:9292 22mwill fetch gems
24
- from 1mhttps://my.gem-source.local22m. If you had bundled before making
23
+ Once restarted, bundling against http://localhost:9292 will fetch gems
24
+ from https://my.gem-source.local. If you had bundled before making
25
25
  these changes, fear not; bundling with a different default gem source
26
26
  will store gems in a separate location, ensuring different sources
27
27
  won't leak between each other.
@@ -29,86 +29,107 @@
29
29
  1mBundling with Multiple Sources0m
30
30
  Changing the default source won't help you if you need to bundle
31
31
  against https://rubygems.org along with additional sources. If you
32
- need to bundle with multiple gem sources, Gemstash doesn't need to be
33
- specially configured. Your Gemstash server will honor any gem source
34
- specified via a specialized URL. Consider the following 1mGemfile22m:
32
+ need to bundle with multiple gem sources, list each additional source
33
+ in :allowed_upstreams before upgrading. By default Gemstash permits
34
+ only its configured :rubygems_url; an unlisted source returns 403.
35
+ Consider the following Gemfile:
35
36
 
36
- # ./Gemfile
37
+ 4m#24m 4m./Gemfile0m
37
38
  require "cgi"
38
39
  source "http://localhost:9292"
39
40
  gem "rubywarrior"
40
41
 
41
- source "http://localhost:9292/upstream/#{CGI.escape("https://my.gem-source.local")}" do
42
+ source "http://localhost:9292/upstream/#{CGI.escape("https://my.gem-source.local")}" 1mdo0m
42
43
  gem "my-gem"
43
- end
44
+ 1mend0m
44
45
 
45
- source "http://localhost:9292/upstream/my-other.gem-source.local" do
46
+ source "http://localhost:9292/upstream/my-other.gem-source.local" 1mdo0m
46
47
  gem "my-other-gem"
47
- end
48
+ 1mend0m
48
49
 
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-
50
+ Notice the CGI.escape call in the second source. This is important, as
51
+ it properly URL escapes the source URL so Gemstash knows what gem
52
+ source you want. The /upstream prefix tells Gemstash to use a gem
53
+ source other than the default source. You can now bundle with the ad-
53
54
  ditional source.
54
55
 
55
- Notice that the third source doesn't need to be escaped. This is be-
56
- cause the 1mhttps:// 22mis used by default when no scheme is set, and the
56
+ Notice that the third source doesn't need to be escaped. This is be-
57
+ cause the https:// is used by default when no scheme is set, and the
57
58
  source URL does not contain any characters that need to be escaped.
58
59
 
59
60
  1mAuthentication with Multiple Sources0m
60
- You can use basic authentication or API keys on sources directly in
61
+ You can use basic authentication or API keys on sources directly in
61
62
  Gemfile or using ENV variables on the Gemstash instance.
62
63
 
63
- Example 1mGemfile22m:
64
+ Example Gemfile:
64
65
 
65
- # ./Gemfile
66
+ 4m#24m 4m./Gemfile0m
66
67
  require "cgi"
67
68
  source "http://localhost:9292"
68
69
 
69
- source "http://localhost:9292/upstream/#{CGI.escape("user:password@my.gem-source.local")}" do
70
+ source "http://localhost:9292/upstream/#{CGI.escape("user:password@my.gem-source.local")}" 1mdo0m
70
71
  gem "my-gem"
71
- end
72
+ 1mend0m
72
73
 
73
- source "http://localhost:9292/upstream/#{CGI.escape("api_key@my-other.gem-source.local")}" do
74
+ source "http://localhost:9292/upstream/#{CGI.escape("api_key@my-other.gem-source.local")}" 1mdo0m
74
75
  gem "my-other-gem"
75
- end
76
+ 1mend0m
76
77
 
77
- If you set 1mGEMSTASH_<HOST> 22mENV variable with your authentication infor-
78
- mation, you can omit it from the 1mGemfile22m:
78
+ If you set GEMSTASH_<HOST> ENV variable with your authentication infor-
79
+ mation, you can omit it from the Gemfile:
79
80
 
80
- # ./Gemfile
81
+ 4m#24m 4m./Gemfile0m
81
82
  source "http://localhost:9292"
82
83
 
83
- source "http://localhost:9292/upstream/my.gem-source.local" do
84
+ source "http://localhost:9292/upstream/my.gem-source.local" 1mdo0m
84
85
  gem "my-gem"
85
- end
86
+ 1mend0m
86
87
 
87
88
  And run the Gemstash with the credentials set in an ENV variable:
88
89
 
89
90
  GEMSTASH_MY__GEM___SOURCE__LOCAL=user:password gemstash start --config-file config.yml.erb
90
91
 
91
92
  The name of the ENV variable is the uppercase version of the host name,
92
- with all 1m. 22mcharacters replaced with 1m__22m, all 1m- 22mwith 1m___ 22mand a 1mGEMSTASH_0m
93
- prefix (it uses the same syntax as Bundler
94
- (https://bundler.io/v2.4/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-
95
- SOURCES)).
93
+ with all . characters replaced with __, all - with ___ and a GEMSTASH_
94
+ prefix (it uses the same syntax as 8;;https://bundler.io/v2.4/man/bundle-config.1.html#CREDENTIALS-FOR-GEM-SOURCESBundler8;;).
96
95
 
97
- Example: 1mmy.gem-source.local 22m=> 1mGEMSTASH_MY__GEM___SOURCE__LOCAL0m
96
+ Example: my.gem-source.local => GEMSTASH_MY__GEM___SOURCE__LOCAL
97
+
98
+ When credentials for a request are available from more than one place,
99
+ Gemstash uses the first of: the URL the client asked for, the matching
100
+ :rubygems_url or :allowed_upstreams entry, and the GEMSTASH_<HOST>
101
+ variable. Credentials in a URL are percent-decoded before use, while
102
+ the variable is used as written.
98
103
 
99
104
  1mRedirecting0m
100
105
  Gemstash supports an alternate mode of specifying your gem sources. If
101
106
  you want Gemstash to redirect Bundler to your given gem sources, then
102
- you can specify your 1mGemfile 22mlike so:
107
+ you can specify your Gemfile like so:
103
108
 
104
- # ./Gemfile
109
+ 4m#24m 4m./Gemfile0m
105
110
  require "cgi"
106
111
  source "http://localhost:9292/redirect/#{CGI.escape("https://rubygems.org")}"
107
112
  gem "rubywarrior"
108
113
 
109
- Notice the 1m/redirect 22mprefix. This prefix tells Gemstash to redirect
114
+ Notice the /redirect prefix. This prefix tells Gemstash to redirect
110
115
  API calls to the provided URL. Redirected calls like this will not be
111
116
  cached by Gemstash, and gem files will not be stashed, even if they
112
117
  were previously cached or stashed from the same gem source.
113
118
 
114
- October 8, 2015 4mgemstash-multiple-sources24m(7)
119
+ 1mRestricting Gem Sources0m
120
+ Gemstash allows only its configured :rubygems_url by default. Before
121
+ upgrading, list any additional Gemfile or mirror sources you use in the
122
+ Gemstash configuration so Bundler requests for them continue working:
123
+
124
+ 4m#24m 4m~/.gemstash/config.yml0m
125
+ ---
126
+ :allowed_upstreams1m:0m
127
+ 1m- 22mhttps://my.gem-source.local
128
+ 1m- 22mhttps://my-other.gem-source.local
129
+
130
+ Gemstash will then only fetch from, or redirect to, the default source
131
+ and the listed gem sources. Requests for any other gem source are re-
132
+ fused. See the :allowed_upstreams configuration key for how gem
133
+ sources are compared.
134
+
135
+ October 8, 2015 4mgemstas...-sources24m(7)