gemstash 2.0.0 → 2.1.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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/exe/gemstash +3 -0
  3. data/lib/gemstash.rb +2 -0
  4. data/lib/gemstash/api_key_authorization.rb +3 -0
  5. data/lib/gemstash/authorization.rb +7 -3
  6. data/lib/gemstash/cache.rb +5 -2
  7. data/lib/gemstash/cli.rb +2 -0
  8. data/lib/gemstash/cli/authorize.rb +3 -3
  9. data/lib/gemstash/cli/base.rb +4 -1
  10. data/lib/gemstash/cli/setup.rb +8 -1
  11. data/lib/gemstash/cli/start.rb +4 -1
  12. data/lib/gemstash/cli/status.rb +2 -0
  13. data/lib/gemstash/cli/stop.rb +2 -0
  14. data/lib/gemstash/config.ru +3 -3
  15. data/lib/gemstash/configuration.rb +7 -1
  16. data/lib/gemstash/db.rb +3 -0
  17. data/lib/gemstash/db/authorization.rb +2 -0
  18. data/lib/gemstash/db/cached_rubygem.rb +3 -0
  19. data/lib/gemstash/db/dependency.rb +2 -0
  20. data/lib/gemstash/db/rubygem.rb +3 -0
  21. data/lib/gemstash/db/upstream.rb +3 -0
  22. data/lib/gemstash/db/version.rb +3 -0
  23. data/lib/gemstash/dependencies.rb +4 -0
  24. data/lib/gemstash/env.rb +22 -4
  25. data/lib/gemstash/gem_fetcher.rb +2 -0
  26. data/lib/gemstash/gem_pusher.rb +5 -3
  27. data/lib/gemstash/gem_source.rb +2 -0
  28. data/lib/gemstash/gem_source/dependency_caching.rb +4 -4
  29. data/lib/gemstash/gem_source/private_source.rb +3 -0
  30. data/lib/gemstash/gem_source/rack_middleware.rb +3 -0
  31. data/lib/gemstash/gem_source/upstream_source.rb +9 -3
  32. data/lib/gemstash/gem_yanker.rb +4 -0
  33. data/lib/gemstash/health.rb +2 -0
  34. data/lib/gemstash/http_client.rb +4 -1
  35. data/lib/gemstash/logging.rb +2 -0
  36. data/lib/gemstash/man/gemstash-authorize.1 +51 -0
  37. data/lib/gemstash/man/gemstash-authorize.1.txt +33 -53
  38. data/lib/gemstash/man/gemstash-configuration.5 +229 -0
  39. data/lib/gemstash/man/gemstash-configuration.5.txt +150 -6
  40. data/lib/gemstash/man/gemstash-customize.7 +301 -0
  41. data/lib/gemstash/man/gemstash-customize.7.txt +183 -62
  42. data/lib/gemstash/man/gemstash-debugging.7 +34 -0
  43. data/lib/gemstash/man/gemstash-debugging.7.txt +17 -54
  44. data/lib/gemstash/man/gemstash-deploy.7 +72 -0
  45. data/lib/gemstash/man/gemstash-deploy.7.txt +44 -51
  46. data/lib/gemstash/man/gemstash-mirror.7 +40 -0
  47. data/lib/gemstash/man/gemstash-mirror.7.txt +20 -53
  48. data/lib/gemstash/man/gemstash-multiple-sources.7 +89 -0
  49. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +53 -48
  50. data/lib/gemstash/man/gemstash-private-gems.7 +227 -0
  51. data/lib/gemstash/man/gemstash-private-gems.7.txt +108 -18
  52. data/lib/gemstash/man/gemstash-readme.7 +233 -0
  53. data/lib/gemstash/man/gemstash-readme.7.txt +126 -10
  54. data/lib/gemstash/man/gemstash-setup.1 +43 -0
  55. data/lib/gemstash/man/gemstash-setup.1.txt +28 -54
  56. data/lib/gemstash/man/gemstash-start.1 +26 -0
  57. data/lib/gemstash/man/gemstash-start.1.txt +16 -56
  58. data/lib/gemstash/man/gemstash-status.1 +20 -0
  59. data/lib/gemstash/man/gemstash-status.1.txt +13 -57
  60. data/lib/gemstash/man/gemstash-stop.1 +20 -0
  61. data/lib/gemstash/man/gemstash-stop.1.txt +13 -57
  62. data/lib/gemstash/man/gemstash-version.1 +22 -0
  63. data/lib/gemstash/man/gemstash-version.1.txt +12 -57
  64. data/lib/gemstash/migrations/01_gem_dependencies.rb +2 -0
  65. data/lib/gemstash/migrations/02_authorizations.rb +2 -0
  66. data/lib/gemstash/migrations/03_cached_gems.rb +2 -0
  67. data/lib/gemstash/migrations/04_health_tests.rb +2 -0
  68. data/lib/gemstash/puma.rb +2 -0
  69. data/lib/gemstash/rack_env_rewriter.rb +11 -2
  70. data/lib/gemstash/specs_builder.rb +5 -1
  71. data/lib/gemstash/storage.rb +12 -3
  72. data/lib/gemstash/upstream.rb +2 -0
  73. data/lib/gemstash/version.rb +3 -1
  74. data/lib/gemstash/web.rb +2 -0
  75. metadata +69 -22
@@ -0,0 +1,40 @@
1
+ .\" Automatically generated by Pandoc 2.5
2
+ .\"
3
+ .TH "gemstash\-mirror" "7" "October 25, 2015" "" ""
4
+ .hy
5
+ .SH USING GEMSTASH AS A MIRROR
6
+ .PP
7
+ If you don\[cq]t have control over your \f[C]Gemfile\f[R], or you
8
+ don\[cq]t want to force everyone on your team to go through the Gemstash
9
+ server, you can use Bundler mirroring to bundle against your Gemstash
10
+ server.
11
+ .PP
12
+ For each source in your \f[C]Gemfile\f[R], add a mirror pointing to your
13
+ Gemstash server:
14
+ .IP
15
+ .nf
16
+ \f[C]
17
+ $ bundle config mirror.http://rubygems.org http://localhost:9292
18
+ $ 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])
19
+ \f[R]
20
+ .fi
21
+ .PP
22
+ From now on, bundler will fetch gems from those sources via your
23
+ Gemstash server.
24
+ .SH SIMPLER GEMSTASH MIRRORS
25
+ .PP
26
+ \f[B]This feature requires Bundler to be at least version
27
+ \f[CB]1.11.0\f[B].\f[R]
28
+ .PP
29
+ If you are using Bundler version \f[C]1.11.0\f[R] or greater, the
30
+ mirroring becomes a bit easier:
31
+ .IP
32
+ .nf
33
+ \f[C]
34
+ $ bundle config mirror.http://rubygems.org http://localhost:9292
35
+ $ bundle config mirror.https://my.gem\-source.local http://localhost:9292
36
+ \f[R]
37
+ .fi
38
+ .PP
39
+ Bundler will then send headers to Gemstash to indicate the correct
40
+ upstream.
@@ -1,66 +1,33 @@
1
+ gemstash-mirror(7) gemstash-mirror(7)
1
2
 
2
3
 
3
4
 
5
+ 1mUSING GEMSTASH AS A MIRROR0m
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
8
+ Bundler mirroring to bundle against your Gemstash server.
4
9
 
10
+ For each source in your Gemfile, add a mirror pointing to your Gemstash
11
+ server:
5
12
 
13
+ $ bundle config mirror.http://rubygems.org http://localhost:9292
14
+ $ bundle config mirror.https://my.gem-source.local http://localhost:9292/upstream/$(ruby -rcgi -e 'puts CGI.escape("https://my.gem-source.local")')
6
15
 
16
+ From now on, bundler will fetch gems from those sources via your Gem-
17
+ stash server.
7
18
 
19
+ 1mSIMPLER GEMSTASH MIRRORS0m
20
+ 1mThis feature requires Bundler to be at least version 1.11.0.0m
8
21
 
22
+ If you are using Bundler version 1.11.0 or greater, the mirroring be-
23
+ comes a bit easier:
9
24
 
25
+ $ bundle config mirror.http://rubygems.org http://localhost:9292
26
+ $ bundle config mirror.https://my.gem-source.local http://localhost:9292
10
27
 
28
+ Bundler will then send headers to Gemstash to indicate the correct up-
29
+ stream.
11
30
 
12
31
 
13
32
 
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
33
+ October 25, 2015 gemstash-mirror(7)
@@ -0,0 +1,89 @@
1
+ .\" Automatically generated by Pandoc 2.5
2
+ .\"
3
+ .TH "gemstash\-multiple\-sources" "7" "October 8, 2015" "" ""
4
+ .hy
5
+ .SH MULTIPLE GEM SOURCES
6
+ .PP
7
+ Gemstash will stash from any amount of gem sources.
8
+ By the end of this guide, you will be able to bundle using multiple gem
9
+ sources, all stashed within your Gemstash server.
10
+ .SS DEFAULT SOURCE
11
+ .PP
12
+ When you don\[cq]t provide an explicit source (as with the Quickstart
13
+ Guide (../readme.md#quickstart-guide)), your gems will be fetched from
14
+ https://rubygems.org.
15
+ This default source is not set in stone.
16
+ To change it, you need only edit the Gemstash configuration found at
17
+ \f[C]\[ti]/.gemstash/config.yml\f[R]:
18
+ .IP
19
+ .nf
20
+ \f[C]
21
+ # \[ti]/.gemstash/config.yml
22
+ \-\-\-
23
+ :rubygems_url: https://my.gem\-source.local
24
+ \f[R]
25
+ .fi
26
+ .PP
27
+ Make sure to restart your Gemstash server after changing the config:
28
+ .IP
29
+ .nf
30
+ \f[C]
31
+ $ gemstash stop
32
+ $ gemstash start
33
+ \f[R]
34
+ .fi
35
+ .PP
36
+ Once restarted, bundling against \f[C]http://localhost:9292\f[R] will
37
+ fetch gems from \f[C]https://my.gem\-source.local\f[R].
38
+ If you had bundled before making these changes, fear not; bundling with
39
+ a different default gem source will store gems in a separate location,
40
+ ensuring different sources won\[cq]t leak between each other.
41
+ .SS BUNDLING WITH MULTIPLE SOURCES
42
+ .PP
43
+ Changing the default source won\[cq]t help you if you need to bundle
44
+ against https://rubygems.org along with additional sources.
45
+ If you need to bundle with multiple gem sources, Gemstash doesn\[cq]t
46
+ need to be specially configured.
47
+ Your Gemstash server will honor any gem source specified via a
48
+ specialized URL.
49
+ Consider the following \f[C]Gemfile\f[R]:
50
+ .IP
51
+ .nf
52
+ \f[C]
53
+ # ./Gemfile
54
+ require \[dq]cgi\[dq]
55
+ source \[dq]http://localhost:9292\[dq]
56
+ gem \[dq]rubywarrior\[dq]
57
+
58
+ source \[dq]http://localhost:9292/upstream/#{CGI.escape(\[dq]https://my.gem\-source.local\[dq])}\[dq] do
59
+ gem \[dq]my\-gem\[dq]
60
+ end
61
+ \f[R]
62
+ .fi
63
+ .PP
64
+ Notice the \f[C]CGI.escape\f[R] call in the second source.
65
+ This is important, as it properly URL escapes the source URL so Gemstash
66
+ knows what gem source you want.
67
+ The \f[C]/upstream\f[R] prefix tells Gemstash to use a gem source other
68
+ than the default source.
69
+ You can now bundle with the additional source.
70
+ .SS REDIRECTING
71
+ .PP
72
+ Gemstash supports an alternate mode of specifying your gem sources.
73
+ If you want Gemstash to redirect Bundler to your given gem sources, then
74
+ you can specify your \f[C]Gemfile\f[R] like so:
75
+ .IP
76
+ .nf
77
+ \f[C]
78
+ # ./Gemfile
79
+ require \[dq]cgi\[dq]
80
+ source \[dq]http://localhost:9292/redirect/#{CGI.escape(\[dq]https://rubygems.org\[dq])}\[dq]
81
+ gem \[dq]rubywarrior\[dq]
82
+ \f[R]
83
+ .fi
84
+ .PP
85
+ Notice the \f[C]/redirect\f[R] prefix.
86
+ This prefix tells Gemstash to redirect API calls to the provided URL.
87
+ Redirected calls like this will not be cached by Gemstash, and gem files
88
+ will not be stashed, even if they were previously cached or stashed from
89
+ the same gem source.
@@ -1,66 +1,71 @@
1
+ gemstash-multiple-sources(7) gemstash-multiple-sources(7)
1
2
 
2
3
 
3
4
 
5
+ 1mMULTIPLE GEM SOURCES0m
6
+ Gemstash will stash from any amount of gem sources. By the end of this
7
+ guide, you will be able to bundle using multiple gem sources, all
8
+ stashed within your Gemstash server.
4
9
 
10
+ 1mDEFAULT SOURCE0m
11
+ When you don't provide an explicit source (as with the Quickstart Guide
12
+ (../readme.md#quickstart-guide)), your gems will be fetched from
13
+ https://rubygems.org. This default source is not set in stone. To
14
+ change it, you need only edit the Gemstash configuration found at
15
+ ~/.gemstash/config.yml:
5
16
 
17
+ # ~/.gemstash/config.yml
18
+ ---
19
+ :rubygems_url: https://my.gem-source.local
6
20
 
21
+ Make sure to restart your Gemstash server after changing the config:
7
22
 
23
+ $ gemstash stop
24
+ $ gemstash start
8
25
 
26
+ Once restarted, bundling against http://localhost:9292 will fetch gems
27
+ from https://my.gem-source.local. If you had bundled before making
28
+ these changes, fear not; bundling with a different default gem source
29
+ will store gems in a separate location, ensuring different sources
30
+ won't leak between each other.
9
31
 
32
+ 1mBUNDLING WITH MULTIPLE SOURCES0m
33
+ Changing the default source won't help you if you need to bundle
34
+ against https://rubygems.org along with additional sources. If you
35
+ need to bundle with multiple gem sources, Gemstash doesn't need to be
36
+ specially configured. Your Gemstash server will honor any gem source
37
+ specified via a specialized URL. Consider the following Gemfile:
10
38
 
39
+ # ./Gemfile
40
+ require "cgi"
41
+ source "http://localhost:9292"
42
+ gem "rubywarrior"
11
43
 
44
+ source "http://localhost:9292/upstream/#{CGI.escape("https://my.gem-source.local")}" do
45
+ gem "my-gem"
46
+ end
12
47
 
48
+ Notice the CGI.escape call in the second source. This is important, as
49
+ it properly URL escapes the source URL so Gemstash knows what gem
50
+ source you want. The /upstream prefix tells Gemstash to use a gem
51
+ source other than the default source. You can now bundle with the ad-
52
+ ditional source.
13
53
 
54
+ 1mREDIRECTING0m
55
+ Gemstash supports an alternate mode of specifying your gem sources. If
56
+ you want Gemstash to redirect Bundler to your given gem sources, then
57
+ you can specify your Gemfile like so:
14
58
 
59
+ # ./Gemfile
60
+ require "cgi"
61
+ source "http://localhost:9292/redirect/#{CGI.escape("https://rubygems.org")}"
62
+ gem "rubywarrior"
15
63
 
64
+ Notice the /redirect prefix. This prefix tells Gemstash to redirect
65
+ API calls to the provided URL. Redirected calls like this will not be
66
+ cached by Gemstash, and gem files will not be stashed, even if they
67
+ were previously cached or stashed from the same gem source.
16
68
 
17
69
 
18
70
 
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
71
+ October 8, 2015 gemstash-multiple-sources(7)
@@ -0,0 +1,227 @@
1
+ .\" Automatically generated by Pandoc 2.5
2
+ .\"
3
+ .TH "gemstash\-private\-gems" "7" "October 8, 2015" "" ""
4
+ .hy
5
+ .SH PRIVATE GEMS
6
+ .PP
7
+ Stashing private gems in your Gemstash server requires a bit of
8
+ additional setup.
9
+ If you haven\[cq]t read through the Quickstart
10
+ Guide (../readme.md#quickstart-guide), you should do that first.
11
+ By the end of this guide, you will be able to interact with your
12
+ Gemstash server to store and retrieve your private gems.
13
+ .SS AUTHORIZING
14
+ .PP
15
+ \f[B]IMPORTANT NOTE:\f[R] Do not use the actual key value in this
16
+ document, otherwise your Gemstash server will be vulnerable to anyone
17
+ who wants to try to use the key against your server.
18
+ Instead of the key value here, use whatever key is generated from
19
+ running the commands.
20
+ .PP
21
+ In order to push a gem to your Gemstash server, you need to first create
22
+ an API key.
23
+ Utilize the \f[C]gemstash authorize\f[R] command to create the API key:
24
+ .IP
25
+ .nf
26
+ \f[C]
27
+ $ gemstash authorize
28
+ Your new key is: e374e237fdf5fa5718d2a21bd63dc911
29
+ \f[R]
30
+ .fi
31
+ .PP
32
+ This new key can \f[C]push\f[R], \f[C]yank\f[R], and \f[C]fetch\f[R]
33
+ gems from your Gemstash server.
34
+ Run \f[C]gemstash authorize\f[R] with just the permissions you want to
35
+ limit what the key will be allowed to do.
36
+ You can similarly update a specific key by providing it via the
37
+ \f[C]\-\-key\f[R] option:
38
+ .IP
39
+ .nf
40
+ \f[C]
41
+ $ gemstash authorize push yank \-\-key e374e237fdf5fa5718d2a21bd63dc911
42
+ \f[R]
43
+ .fi
44
+ .PP
45
+ When no permissions are provided (like the first example), the key will
46
+ be authorized for all permissions.
47
+ Leave the key authorized with everything if you want to use it to try
48
+ all private gem interactions:
49
+ .IP
50
+ .nf
51
+ \f[C]
52
+ $ gemstash authorize \-\-key e374e237fdf5fa5718d2a21bd63dc911
53
+ \f[R]
54
+ .fi
55
+ .PP
56
+ With the key generated, you\[cq]ll need to tell Rubygems about your new
57
+ key.
58
+ If you\[cq]ve pushed a gem to https://rubygems.org, then you will
59
+ already have a credentials file to add the key to.
60
+ If not, run the following commands before modifying the credentials
61
+ file:
62
+ .IP
63
+ .nf
64
+ \f[C]
65
+ $ mkdir \-p \[ti]/.gem
66
+ $ touch \[ti]/.gem/credentials
67
+ $ chmod 0600 \[ti]/.gem/credentials
68
+ \f[R]
69
+ .fi
70
+ .PP
71
+ Add your new key to credentials such that it looks something like this
72
+ (but make sure not to remove any existing keys):
73
+ .IP
74
+ .nf
75
+ \f[C]
76
+ # \[ti]/.gem/credentials
77
+ \-\-\-
78
+ :test_key: e374e237fdf5fa5718d2a21bd63dc911
79
+ \f[R]
80
+ .fi
81
+ .PP
82
+ The name \f[C]test_key\f[R] can be anything you want, but you will need
83
+ to remember it and use it again later in this guide for the
84
+ \f[C]\-\-key\f[R] option.
85
+ .SS CREATING A TEST GEM
86
+ .PP
87
+ You\[cq]ll need a test gem before you can play with private gems on your
88
+ Gemstash server.
89
+ If you have a gem you can use, move along to the next section.
90
+ You can start by instantiating a test gem via Bundler:
91
+ .IP
92
+ .nf
93
+ \f[C]
94
+ $ bundle gem private\-example
95
+ \f[R]
96
+ .fi
97
+ .PP
98
+ You\[cq]ll need to add a summary and description to the new gem\[cq]s
99
+ gemspec file in order to successfully build it.
100
+ Once you\[cq]ve built the gem, you will be ready to push the new gem.
101
+ .IP
102
+ .nf
103
+ \f[C]
104
+ $ cd private\-example
105
+ $ rake build
106
+ \f[R]
107
+ .fi
108
+ .PP
109
+ You will now have a gem at
110
+ \f[C]private\-example/pkg/private\-example\-0.1.0.gem\f[R].
111
+ .SS PUSHING
112
+ .PP
113
+ If your Gemstash server isn\[cq]t running, go ahead and start it:
114
+ .IP
115
+ .nf
116
+ \f[C]
117
+ $ gemstash start
118
+ \f[R]
119
+ .fi
120
+ .PP
121
+ Push your test gem using Rubygems:
122
+ .IP
123
+ .nf
124
+ \f[C]
125
+ $ gem push \-\-key test_key \-\-host http://localhost:9292/private pkg/private\-example\-0.1.0.gem
126
+ \f[R]
127
+ .fi
128
+ .PP
129
+ The \f[C]/private\f[R] portion of the \f[C]\-\-host\f[R] option tells
130
+ Gemstash you are interacting with the private gems.
131
+ Gemstash will not let you push, or yank from anything except
132
+ \f[C]/private\f[R].
133
+ .SS BUNDLING
134
+ .PP
135
+ Once your gem is pushed to your Gemstash server, you are ready to bundle
136
+ it.
137
+ Create a \f[C]Gemfile\f[R] and specify the gem.
138
+ You will probably want to wrap the private gem in a source block, and
139
+ let the rest of Gemstash handle all other gems:
140
+ .IP
141
+ .nf
142
+ \f[C]
143
+ # ./Gemfile
144
+ source \[dq]http://localhost:9292\[dq]
145
+ gem \[dq]rubywarrior\[dq]
146
+
147
+ source \[dq]http://localhost:9292/private\[dq] do
148
+ gem \[dq]private\-example\[dq]
149
+ end
150
+ \f[R]
151
+ .fi
152
+ .PP
153
+ Notice that the Gemstash server points to \f[C]/private\f[R] again when
154
+ installing your private gem.
155
+ Go ahead and bundle to install your new private gem:
156
+ .IP
157
+ .nf
158
+ \f[C]
159
+ $ bundle
160
+ \f[R]
161
+ .fi
162
+ .SS YANKING
163
+ .PP
164
+ If you push a private gem by accident, you can yank the gem with
165
+ Rubygems:
166
+ .IP
167
+ .nf
168
+ \f[C]
169
+ $ RUBYGEMS_HOST=http://localhost:9292/private gem yank \-\-key test_key private\-example \-\-version 0.1.0
170
+ \f[R]
171
+ .fi
172
+ .PP
173
+ Like with pushing, the \f[C]/private\f[R] portion of the host option
174
+ tells Gemstash you are interacting with private gems.
175
+ Gemstash will only let you yank from \f[C]/private\f[R].
176
+ Unlike pushing, Rubygems doesn\[cq]t support \f[C]\-\-host\f[R] for yank
177
+ (yet), so you need to specify the host via the \f[C]RUBYGEMS_HOST\f[R]
178
+ environment variable.
179
+ .SS PROTECTED FETCHING
180
+ .PP
181
+ By default, private gems and specs can be accessed without
182
+ authentication.
183
+ .PP
184
+ Private gems often require protected fetching.
185
+ For backwards compatibility this is disabled by default, but can be
186
+ enabled via \f[C]$ gemstash setup\f[R] command.
187
+ .PP
188
+ When protected fetching is enabled API keys with the permissions
189
+ \f[C]all\f[R] or \f[C]fetch\f[R] can be used to download gems and specs.
190
+ .PP
191
+ On the Bundler side, there are a few ways to configure credentials for a
192
+ given gem source:
193
+ .PP
194
+ Add credentials globally:
195
+ .IP
196
+ .nf
197
+ \f[C]
198
+ $ bundle config my\-gemstash.dev api_key
199
+ \f[R]
200
+ .fi
201
+ .PP
202
+ Add credentials in Gemfile:
203
+ .IP
204
+ .nf
205
+ \f[C]
206
+ source \[dq]https://api_key\[at]my\-gemstash.dev\[dq]
207
+ \f[R]
208
+ .fi
209
+ .PP
210
+ However, it\[cq]s not a good practice to commit credentials to source
211
+ control.
212
+ A recommended solution is to use Bundler\[cq]s configuration
213
+ keys (http://bundler.io/man/bundle-config.1.html#CONFIGURATION-KEYS),
214
+ e.g.:
215
+ .IP
216
+ .nf
217
+ \f[C]
218
+ $ export BUNDLE_MYGEMSTASH__DEV=api_key
219
+ \f[R]
220
+ .fi
221
+ .PP
222
+ Behind the scene, Bundler will pick up the ENV var according to the host
223
+ name (e.g.\ mygemstash.dev) and add to \f[C]URI.userinfo\f[R] for making
224
+ requests.
225
+ .PP
226
+ The API key is treated as a HTTP Basic Auth username and any HTTP Basic
227
+ password supplied will be ignored.