gemstash 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/lib/gemstash.rb +0 -1
  4. data/lib/gemstash/authorization.rb +1 -5
  5. data/lib/gemstash/cli.rb +4 -4
  6. data/lib/gemstash/cli/authorize.rb +4 -2
  7. data/lib/gemstash/cli/base.rb +5 -4
  8. data/lib/gemstash/cli/setup.rb +2 -2
  9. data/lib/gemstash/cli/status.rb +1 -1
  10. data/lib/gemstash/cli/stop.rb +1 -1
  11. data/lib/gemstash/configuration.rb +3 -2
  12. data/lib/gemstash/gem_pusher.rb +7 -0
  13. data/lib/gemstash/gem_source/private_source.rb +0 -4
  14. data/lib/gemstash/gem_source/upstream_source.rb +0 -4
  15. data/lib/gemstash/health.rb +3 -3
  16. data/lib/gemstash/logging.rb +2 -4
  17. data/lib/gemstash/man/gemstash-authorize.1.txt +53 -33
  18. data/lib/gemstash/man/gemstash-configuration.5.txt +10 -141
  19. data/lib/gemstash/man/gemstash-customize.7.txt +66 -175
  20. data/lib/gemstash/man/gemstash-debugging.7.txt +54 -17
  21. data/lib/gemstash/man/gemstash-deploy.7.txt +51 -44
  22. data/lib/gemstash/man/gemstash-mirror.7.txt +53 -20
  23. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +48 -53
  24. data/lib/gemstash/man/gemstash-private-gems.7.txt +15 -117
  25. data/lib/gemstash/man/gemstash-readme.7.txt +10 -126
  26. data/lib/gemstash/man/gemstash-setup.1.txt +54 -28
  27. data/lib/gemstash/man/gemstash-start.1.txt +56 -16
  28. data/lib/gemstash/man/gemstash-status.1.txt +57 -13
  29. data/lib/gemstash/man/gemstash-stop.1.txt +57 -13
  30. data/lib/gemstash/man/gemstash-version.1.txt +57 -12
  31. data/lib/gemstash/migrations/01_gem_dependencies.rb +2 -2
  32. data/lib/gemstash/migrations/03_cached_gems.rb +1 -1
  33. data/lib/gemstash/migrations/04_health_tests.rb +8 -0
  34. data/lib/gemstash/puma.rb +1 -1
  35. data/lib/gemstash/storage.rb +1 -0
  36. data/lib/gemstash/upstream.rb +2 -2
  37. data/lib/gemstash/version.rb +1 -1
  38. data/lib/gemstash/web.rb +5 -4
  39. metadata +20 -28
  40. data/lib/gemstash/gem_unyanker.rb +0 -67
  41. data/lib/gemstash/man/gemstash-authorize.1 +0 -51
  42. data/lib/gemstash/man/gemstash-configuration.5 +0 -215
  43. data/lib/gemstash/man/gemstash-customize.7 +0 -280
  44. data/lib/gemstash/man/gemstash-debugging.7 +0 -34
  45. data/lib/gemstash/man/gemstash-deploy.7 +0 -72
  46. data/lib/gemstash/man/gemstash-mirror.7 +0 -40
  47. data/lib/gemstash/man/gemstash-multiple-sources.7 +0 -89
  48. data/lib/gemstash/man/gemstash-private-gems.7 +0 -244
  49. data/lib/gemstash/man/gemstash-readme.7 +0 -234
  50. data/lib/gemstash/man/gemstash-setup.1 +0 -43
  51. data/lib/gemstash/man/gemstash-start.1 +0 -26
  52. data/lib/gemstash/man/gemstash-status.1 +0 -20
  53. data/lib/gemstash/man/gemstash-stop.1 +0 -20
  54. data/lib/gemstash/man/gemstash-version.1 +0 -22
@@ -1,244 +0,0 @@
1
- .\" Automatically generated by Pandoc 1.19.2.1
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\[aq]t read through the Quickstart
10
- Guide (gemstash help readme.7), 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[] 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[] command to create the API key:
24
- .IP
25
- .nf
26
- \f[C]
27
- $\ gemstash\ authorize
28
- Your\ new\ key\ is:\ e374e237fdf5fa5718d2a21bd63dc911
29
- \f[]
30
- .fi
31
- .PP
32
- This new key can \f[C]push\f[], \f[C]yank\f[], \f[C]unyank\f[], and
33
- \f[C]fetch\f[] gems from your Gemstash server.
34
- Run \f[C]gemstash\ authorize\f[] 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[] option:
38
- .IP
39
- .nf
40
- \f[C]
41
- $\ gemstash\ authorize\ push\ yank\ \-\-key\ e374e237fdf5fa5718d2a21bd63dc911
42
- \f[]
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[]
54
- .fi
55
- .PP
56
- With the key generated, you\[aq]ll need to tell Rubygems about your new
57
- key.
58
- If you\[aq]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\ ~/.gem
66
- $\ touch\ ~/.gem/credentials
67
- $\ chmod\ 0600\ ~/.gem/credentials
68
- \f[]
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
- #\ ~/.gem/credentials
77
- \-\-\-
78
- :test_key:\ e374e237fdf5fa5718d2a21bd63dc911
79
- \f[]
80
- .fi
81
- .PP
82
- The name \f[C]test_key\f[] 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[] option.
85
- .SS CREATING A TEST GEM
86
- .PP
87
- You\[aq]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[]
96
- .fi
97
- .PP
98
- You\[aq]ll need to add a summary and description to the new gem\[aq]s
99
- gemspec file in order to successfully build it.
100
- Once you\[aq]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[]
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[].
111
- .SS PUSHING
112
- .PP
113
- If your Gemstash server isn\[aq]t running, go ahead and start it:
114
- .IP
115
- .nf
116
- \f[C]
117
- $\ gemstash\ start
118
- \f[]
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[]
127
- .fi
128
- .PP
129
- The \f[C]/private\f[] portion of the \f[C]\-\-host\f[] option tells
130
- Gemstash you are interacting with the private gems.
131
- Gemstash will not let you push, yank, or unyank from anything except
132
- \f[C]/private\f[].
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[] 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\ "http://localhost:9292"
145
- gem\ "rubywarrior"
146
-
147
- source\ "http://localhost:9292/private"\ do
148
- \ \ gem\ "private\-example"
149
- end
150
- \f[]
151
- .fi
152
- .PP
153
- Notice that the Gemstash server points to \f[C]/private\f[] 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[]
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[]
171
- .fi
172
- .PP
173
- Like with pushing, the \f[C]/private\f[] 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[].
176
- Unlike pushing, Rubygems doesn\[aq]t support \f[C]\-\-host\f[] for yank
177
- and unyank (yet), so you need to specify the host via the
178
- \f[C]RUBYGEMS_HOST\f[] environment variable.
179
- .SS UNYANKING
180
- .PP
181
- If you yank a private gem by accident, you can unyank the gem with
182
- Rubygems:
183
- .IP
184
- .nf
185
- \f[C]
186
- $\ RUBYGEMS_HOST=http://localhost:9292/private\ gem\ yank\ \-\-key\ test_key\ private\-example\ \-\-version\ 0.1.0\ \-\-undo
187
- \f[]
188
- .fi
189
- .PP
190
- Like with pushing and yanking, the \f[C]/private\f[] portion of the host
191
- option tells Gemstash you are interacting with private gems.
192
- Gemstash will only let you unyank from \f[C]/private\f[].
193
- Unlike pushing, Rubygems doesn\[aq]t support \f[C]\-\-host\f[] for
194
- unyank and yank (yet), so you need to specify the host via the
195
- \f[C]RUBYGEMS_HOST\f[] environment variable.
196
- .SS PROTECTED FETCHING
197
- .PP
198
- By default, private gems and specs can be accessed without
199
- authentication.
200
- .PP
201
- Private gems often require protected fetching.
202
- For backwards compatibility this is disabled by default, but can be
203
- enabled via \f[C]$\ gemstash\ setup\f[] command.
204
- .PP
205
- When protected fetching is enabled API keys with the permissions
206
- \f[C]all\f[] or \f[C]fetch\f[] can be used to download gems and specs.
207
- .PP
208
- On the Bundler side, there are a few ways to configure credentials for a
209
- given gem source:
210
- .PP
211
- Add credentials globally:
212
- .IP
213
- .nf
214
- \f[C]
215
- $\ bundle\ config\ my\-gemstash.dev\ api_key
216
- \f[]
217
- .fi
218
- .PP
219
- Add credentials in Gemfile:
220
- .IP
221
- .nf
222
- \f[C]
223
- source\ "https://api_key\@my\-gemstash.dev"
224
- \f[]
225
- .fi
226
- .PP
227
- However, it\[aq]s not a good practice to commit credentials to source
228
- control.
229
- A recommended solution is to use Bundler\[aq]s configuration
230
- keys (http://bundler.io/man/bundle-config.1.html#CONFIGURATION-KEYS),
231
- e.g.:
232
- .IP
233
- .nf
234
- \f[C]
235
- $\ export\ BUNDLE_MYGEMSTASH__DEV=api_key
236
- \f[]
237
- .fi
238
- .PP
239
- Behind the scene, Bundler will pick up the ENV var according to the host
240
- name (e.g.
241
- mygemstash.dev) and add to \f[C]URI.userinfo\f[] for making requests.
242
- .PP
243
- The API key is treated as a HTTP Basic Auth username and any HTTP Basic
244
- password supplied will be ignored.
@@ -1,234 +0,0 @@
1
- .\" Automatically generated by Pandoc 1.19.2.1
2
- .\"
3
- .TH "gemstash\-readme" "7" "November 30, 2015" "" ""
4
- .hy
5
- .SH GEMSTASH
6
- .SS WHAT IS GEMSTASH?
7
- .PP
8
- Gemstash is both a cache for remote servers such as
9
- https://rubygems.org, and a private gem source.
10
- .PP
11
- If you are using bundler (http://bundler.io/) across many machines that
12
- have access to a server within your control, you might want to use
13
- Gemstash.
14
- .PP
15
- If you produce gems that you don\[aq]t want everyone in the world to
16
- have access to, you might want to use Gemstash.
17
- .PP
18
- If you frequently bundle the same set of gems across multiple projects,
19
- you might want to use Gemstash.
20
- .PP
21
- Are you only using gems from https://rubygems.org, and don\[aq]t bundle
22
- the same gems frequently?
23
- Well, maybe you don\[aq]t need Gemstash...
24
- yet.
25
- .PP
26
- Gemstash is maintained by Ruby Together (https://rubytogether.org/), a
27
- grassroots initiative committed to supporting the critical Ruby
28
- infrastructure you rely on.
29
- Contribute today as an individual (https://rubytogether.org/developers)
30
- or even better, as a company (https://rubytogether.org/companies), and
31
- ensure that Bundler, RubyGems, Gemstash, and other shared tooling is
32
- around for years to come.
33
- .SS QUICKSTART GUIDE
34
- .SS SETUP
35
- .PP
36
- Gemstash is designed to be quick and painless to get set up.
37
- By the end of this Quickstart Guide, you will be able to bundle stashed
38
- gems from public sources against a Gemstash server running on your
39
- machine.
40
- .PP
41
- Install Gemstash to get started:
42
- .IP
43
- .nf
44
- \f[C]
45
- $\ gem\ install\ gemstash
46
- \f[]
47
- .fi
48
- .PP
49
- After it is installed, starting Gemstash requires no additional steps.
50
- Simply start the Gemstash server with the \f[C]gemstash\f[] command:
51
- .IP
52
- .nf
53
- \f[C]
54
- $\ gemstash\ start
55
- \f[]
56
- .fi
57
- .PP
58
- You may have noticed that the command finished quickly.
59
- This is because Gemstash will run the server in the background by
60
- default.
61
- The server runs on port 9292.
62
- .SS BUNDLING
63
- .PP
64
- With the server running, you can bundle against it.
65
- Tell Bundler that you want to use Gemstash to find gems from
66
- RubyGems.org:
67
- .IP
68
- .nf
69
- \f[C]
70
- $\ bundle\ config\ mirror.https://rubygems.org\ http://localhost:9292
71
- \f[]
72
- .fi
73
- .PP
74
- Now you can create a Gemfile and install gems through Gemstash:
75
- .IP
76
- .nf
77
- \f[C]
78
- #\ ./Gemfile
79
- source\ "https://rubygems.org"
80
- gem\ "rubywarrior"
81
- \f[]
82
- .fi
83
- .PP
84
- The gems you include should be gems you don\[aq]t yet have installed,
85
- otherwise Gemstash will have nothing to stash.
86
- Now bundle:
87
- .IP
88
- .nf
89
- \f[C]
90
- $\ bundle\ install\ \-\-path\ .bundle
91
- \f[]
92
- .fi
93
- .PP
94
- Your Gemstash server has fetched the gems from https://rubygems.org and
95
- cached them for you! To prove this, you can disable your Internet
96
- connection and try again.
97
- Gem files (*.gem) are cached indefinitely.
98
- Gem dependencies metadata are cached for 30 minutes, so if you bundle
99
- again before that, you can successfully bundle without an Internet
100
- connection:
101
- .IP
102
- .nf
103
- \f[C]
104
- $\ #\ Disable\ your\ Internet\ first!
105
- $\ rm\ \-rf\ Gemfile.lock\ .bundle
106
- $\ bundle
107
- \f[]
108
- .fi
109
- .SS FALLING BACK TO RUBYGEMS.ORG
110
- .PP
111
- If you want to make sure that your bundling from https://rubygems.org
112
- still works as expected when the Gemstash server is not running, you can
113
- easily configure Bundler to fallback to https://rubygems.org.
114
- .IP
115
- .nf
116
- \f[C]
117
- $\ bundle\ config\ mirror.https://rubygems.org.fallback_timeout\ true
118
- \f[]
119
- .fi
120
- .PP
121
- You can also configure this fallback as a number of seconds in case the
122
- Gemstash server is simply unresponsive.
123
- This example uses a 3 second timeout:
124
- .IP
125
- .nf
126
- \f[C]
127
- $\ bundle\ config\ mirror.https://rubygems.org.fallback_timeout\ 3
128
- \f[]
129
- .fi
130
- .SS STOPPING THE SERVER
131
- .PP
132
- Once you\[aq]ve finish using your Gemstash server, you can stop it just
133
- as easily as you started it:
134
- .IP
135
- .nf
136
- \f[C]
137
- $\ gemstash\ stop
138
- \f[]
139
- .fi
140
- .PP
141
- You\[aq]ll also want to tell Bundler that it can go back to getting gems
142
- from RubyGems.org directly, instead of going through Gemstash:
143
- .IP
144
- .nf
145
- \f[C]
146
- $\ bundle\ config\ \-\-delete\ mirror.https://rubygems.org
147
- \f[]
148
- .fi
149
- .SS UNDER THE HOOD
150
- .PP
151
- You might wonder where the gems are stored.
152
- After running the commands above, you will find a new directory at
153
- \f[C]~/.gemstash\f[].
154
- This directory holds all the cached and private gems.
155
- It also has a server log, the database, and configuration for Gemstash.
156
- If you prefer, you can point to a different
157
- directory (gemstash help customize.7).
158
- .PP
159
- Gemstash uses SQLite (https://www.sqlite.org/) to store details about
160
- private gems.
161
- The database will be located in \f[C]~/.gemstash\f[], however you
162
- won\[aq]t see the database appear until you start using private gems.
163
- If you prefer, you can use a different
164
- database (gemstash help customize.7).
165
- .PP
166
- Gemstash temporarily caches things like gem dependencies in memory.
167
- Anything cached in memory will last for 30 minutes before being
168
- retrieved again.
169
- You can use memcached (gemstash help customize.7) instead of caching in
170
- memory.
171
- Gem files are always cached permanently, so bundling with a
172
- \f[C]Gemfile.lock\f[] with all gems cached will never call out to
173
- https://rubygems.org.
174
- .PP
175
- The server you ran is provided via Puma (http://puma.io/) and
176
- Rack (http://rack.github.io/), however they are not customizable at this
177
- point.
178
- .SS DEEP DIVE
179
- .PP
180
- Deep dive into more subjects:
181
- .IP \[bu] 2
182
- Private gems (gemstash help private-gems.7)
183
- .IP \[bu] 2
184
- Multiple gem sources (gemstash help multiple-sources.7)
185
- .IP \[bu] 2
186
- Using Gemstash as a mirror (gemstash help mirror.7)
187
- .IP \[bu] 2
188
- Customizing the server (database, storage, caching, and
189
- more) (gemstash help customize.7)
190
- .IP \[bu] 2
191
- Deploying Gemstash (gemstash help deploy.7)
192
- .IP \[bu] 2
193
- Debugging Gemstash (gemstash help debugging.7)
194
- .SS REFERENCE
195
- .PP
196
- An anatomy of various configuration and commands:
197
- .IP \[bu] 2
198
- Configuration (gemstash help configuration.5)
199
- .IP \[bu] 2
200
- Authorize (gemstash help authorize.1)
201
- .IP \[bu] 2
202
- Start (gemstash help start.1)
203
- .IP \[bu] 2
204
- Stop (gemstash help stop.1)
205
- .IP \[bu] 2
206
- Status (gemstash help status.1)
207
- .IP \[bu] 2
208
- Setup (gemstash help setup.1)
209
- .IP \[bu] 2
210
- Version (gemstash help version.1)
211
- .PP
212
- To see what has changed in recent versions of Gemstash, see the
213
- CHANGELOG (https://github.com/bundler/gemstash/blob/master/CHANGELOG.md).
214
- .SS DEVELOPMENT
215
- .PP
216
- After checking out the repo, run \f[C]bin/setup\f[] to install
217
- dependencies.
218
- Then, run \f[C]rake\f[] to run RuboCop and the tests.
219
- While developing, you can run \f[C]bin/gemstash\f[] to run Gemstash.
220
- You can also run \f[C]bin/console\f[] for an interactive prompt that
221
- will allow you to experiment.
222
- .SS CONTRIBUTING
223
- .PP
224
- Bug reports and pull requests are welcome on GitHub at
225
- https://github.com/bundler/gemstash.
226
- This project is intended to be a safe, welcoming space for
227
- collaboration, and contributors are expected to adhere to the
228
- Contributor
229
- Covenant (https://github.com/bundler/gemstash/blob/master/CODE_OF_CONDUCT.md)
230
- code of conduct.
231
- .SS LICENSE
232
- .PP
233
- The gem is available as open source under the terms of the MIT
234
- License (http://opensource.org/licenses/MIT).