gemstash 1.0.0.pre.1-java → 2.6.0-java

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 (99) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +303 -0
  3. data/exe/gemstash +3 -0
  4. data/lib/gemstash/api_key_authorization.rb +32 -0
  5. data/lib/gemstash/authorization.rb +15 -8
  6. data/lib/gemstash/cache.rb +42 -2
  7. data/lib/gemstash/cli/authorize.rb +52 -9
  8. data/lib/gemstash/cli/base.rb +14 -6
  9. data/lib/gemstash/cli/setup.rb +67 -39
  10. data/lib/gemstash/cli/start.rb +6 -2
  11. data/lib/gemstash/cli/status.rb +3 -1
  12. data/lib/gemstash/cli/stop.rb +4 -1
  13. data/lib/gemstash/cli.rb +59 -1
  14. data/lib/gemstash/config.ru +4 -3
  15. data/lib/gemstash/configuration.rb +61 -8
  16. data/lib/gemstash/db/authorization.rb +5 -3
  17. data/lib/gemstash/db/cached_rubygem.rb +20 -0
  18. data/lib/gemstash/db/dependency.rb +2 -0
  19. data/lib/gemstash/db/rubygem.rb +3 -0
  20. data/lib/gemstash/db/upstream.rb +15 -0
  21. data/lib/gemstash/db/version.rb +25 -2
  22. data/lib/gemstash/db.rb +5 -0
  23. data/lib/gemstash/dependencies.rb +6 -2
  24. data/lib/gemstash/env.rb +44 -13
  25. data/lib/gemstash/gem_fetcher.rb +5 -3
  26. data/lib/gemstash/gem_pusher.rb +25 -18
  27. data/lib/gemstash/gem_source/dependency_caching.rb +4 -4
  28. data/lib/gemstash/gem_source/private_source.rb +34 -50
  29. data/lib/gemstash/gem_source/rack_middleware.rb +3 -0
  30. data/lib/gemstash/gem_source/upstream_source.rb +71 -27
  31. data/lib/gemstash/gem_source.rb +4 -2
  32. data/lib/gemstash/gem_yanker.rb +14 -4
  33. data/lib/gemstash/health.rb +55 -0
  34. data/lib/gemstash/http_client.rb +15 -5
  35. data/lib/gemstash/logging.rb +19 -7
  36. data/lib/gemstash/man/gemstash-authorize.1 +54 -0
  37. data/lib/gemstash/man/gemstash-authorize.1.txt +52 -0
  38. data/lib/gemstash/man/gemstash-configuration.5 +186 -0
  39. data/lib/gemstash/man/gemstash-configuration.5.txt +208 -0
  40. data/lib/gemstash/man/gemstash-customize.7 +273 -0
  41. data/lib/gemstash/man/gemstash-customize.7.txt +184 -0
  42. data/lib/gemstash/man/gemstash-debugging.7 +30 -0
  43. data/lib/gemstash/man/gemstash-debugging.7.txt +27 -0
  44. data/lib/gemstash/man/gemstash-deploy.7 +63 -0
  45. data/lib/gemstash/man/gemstash-deploy.7.txt +57 -0
  46. data/lib/gemstash/man/gemstash-mirror.7 +34 -0
  47. data/lib/gemstash/man/gemstash-mirror.7.txt +31 -0
  48. data/lib/gemstash/man/gemstash-multiple-sources.7 +131 -0
  49. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +116 -0
  50. data/lib/gemstash/man/gemstash-private-gems.7 +191 -0
  51. data/lib/gemstash/man/gemstash-private-gems.7.txt +154 -0
  52. data/lib/gemstash/man/gemstash-readme.7 +199 -0
  53. data/lib/gemstash/man/gemstash-readme.7.txt +177 -0
  54. data/lib/gemstash/man/gemstash-setup.1 +38 -0
  55. data/lib/gemstash/man/gemstash-setup.1.txt +38 -0
  56. data/lib/gemstash/man/gemstash-start.1 +23 -0
  57. data/lib/gemstash/man/gemstash-start.1.txt +24 -0
  58. data/lib/gemstash/man/gemstash-status.1 +17 -0
  59. data/lib/gemstash/man/gemstash-status.1.txt +20 -0
  60. data/lib/gemstash/man/gemstash-stop.1 +17 -0
  61. data/lib/gemstash/man/gemstash-stop.1.txt +20 -0
  62. data/lib/gemstash/man/gemstash-version.1 +17 -0
  63. data/lib/gemstash/man/gemstash-version.1.txt +19 -0
  64. data/lib/gemstash/migrations/01_gem_dependencies.rb +11 -9
  65. data/lib/gemstash/migrations/02_authorizations.rb +4 -2
  66. data/lib/gemstash/migrations/03_cached_gems.rb +26 -0
  67. data/lib/gemstash/migrations/04_health_tests.rb +10 -0
  68. data/lib/gemstash/migrations/05_authorization_names.rb +10 -0
  69. data/lib/gemstash/puma.rb +5 -3
  70. data/lib/gemstash/rack_env_rewriter.rb +11 -2
  71. data/lib/gemstash/specs_builder.rb +25 -15
  72. data/lib/gemstash/storage.rb +175 -32
  73. data/lib/gemstash/upstream.rb +43 -8
  74. data/lib/gemstash/version.rb +4 -2
  75. data/lib/gemstash/web.rb +13 -8
  76. data/lib/gemstash.rb +6 -2
  77. metadata +135 -110
  78. data/.gitignore +0 -10
  79. data/.rspec +0 -2
  80. data/.rubocop-bundler.yml +0 -92
  81. data/.rubocop-relax.yml +0 -11
  82. data/.rubocop.yml +0 -8
  83. data/.travis.yml +0 -20
  84. data/Gemfile +0 -4
  85. data/README.md +0 -139
  86. data/Rakefile +0 -35
  87. data/bin/console +0 -14
  88. data/bin/gemstash +0 -3
  89. data/bin/setup +0 -5
  90. data/docs/config.md +0 -136
  91. data/docs/debug.md +0 -24
  92. data/docs/deploy.md +0 -30
  93. data/docs/mirror.md +0 -30
  94. data/docs/multiple_sources.md +0 -68
  95. data/docs/private_gems.md +0 -140
  96. data/docs/reference.md +0 -308
  97. data/gemstash.gemspec +0 -47
  98. data/gemstash.png +0 -0
  99. data/lib/gemstash/gem_unyanker.rb +0 -61
data/docs/reference.md DELETED
@@ -1,308 +0,0 @@
1
-
2
- Table of Contents
3
- =================
4
-
5
- * [Reference](#reference)
6
- * [Configuration](#configuration)
7
- * [:base_path](#base_path)
8
- * [:cache_type](#cache_type)
9
- * [:memcached_servers](#memcached_servers)
10
- * [:db_adapter](#db_adapter)
11
- * [:db_url](#db_url)
12
- * [:rubygems_url](#rubygems_url)
13
- * [:bind](#bind)
14
- * [Authorize](#authorize)
15
- * [Usage](#usage)
16
- * [Arguments](#arguments)
17
- * [Options](#options)
18
- * [--config-file](#--config-file)
19
- * [--key](#--key)
20
- * [--remove](#--remove)
21
- * [Start](#start)
22
- * [Usage](#usage-1)
23
- * [Options](#options-1)
24
- * [--config-file](#--config-file-1)
25
- * [--no-daemonize](#--no-daemonize)
26
- * [Stop](#stop)
27
- * [Usage](#usage-2)
28
- * [Options](#options-2)
29
- * [--config-file](#--config-file-2)
30
- * [Status](#status)
31
- * [Usage](#usage-3)
32
- * [Options](#options-3)
33
- * [--config-file](#--config-file-3)
34
- * [Setup](#setup)
35
- * [Usage](#usage-4)
36
- * [Options](#options-4)
37
- * [--redo](#--redo)
38
- * [--debug](#--debug)
39
- * [--config-file](#--config-file-4)
40
-
41
-
42
-
43
- ---
44
-
45
- # Reference
46
-
47
- ## Configuration
48
-
49
- **Example:**
50
- ```yaml
51
- # ~/.gemstash/config.yml
52
- ---
53
- :base_path: "/var/gemstash"
54
- :cache_type: memcached
55
- :memcached_servers: localhost:11211
56
- :db_adapter: postgres
57
- :db_url: postgres:///gemstash
58
- :rubygems_url: https://my.gem-source.local
59
- :bind: tcp://0.0.0.0:4242
60
- ```
61
-
62
- ### :base_path
63
-
64
- **Default value:** `~/.gemstash`
65
-
66
- **Valid values:** Any valid path
67
-
68
- **Description**<br />
69
- Specifies where to store local files like the server log, cached gem files, and
70
- the database (when using SQLite). If the default is being used, the directory
71
- will be created if it does not exist. Any other directory needs to be created
72
- ahead of time and be writable to the Gemstash server process. Specifying the
73
- `:base_path` via [`gemstash setup`](reference.md#setup) will create the
74
- directory for you.
75
-
76
- ### :cache_type
77
-
78
- **Default value:** `memory`
79
-
80
- **Valid values:** `memory`, `memcached`
81
-
82
- **Description**<br />
83
- Specifies how to cache values other than gem files (such as gem dependencies).
84
- `memory` will use an in memory cache while `memcached` will point to 1 or more
85
- Memcached servers. Use the `:memcached_servers` configuration key for specifying
86
- where the Memcached server(s) are.
87
-
88
- ### :memcached_servers
89
-
90
- **Default value:** `localhost:11211`
91
-
92
- **Valid values:** A comma delimited list of Memcached servers
93
-
94
- **Description**<br />
95
- Specifies the Memcached servers to connect to when using `memcached` for the
96
- `:cache_type`. Only used when `memcached` is used for `:cache_type`.
97
-
98
- ### :db_adapter
99
-
100
- **Default value:** `sqlite3`
101
-
102
- **Valid values:** `sqlite3`, `postgres`
103
-
104
- **Description**<br />
105
- Specifies what database adapter to use. When `sqlite3` is used, the database
106
- will be located at `gemstash.db` within the directory specified by `:base_path`.
107
- The database will automatically be created when using `sqlite3`. When `postgres`
108
- is used, the database to connect to must be specified in the `:db_url`
109
- configuration key. The database must already be created when using `postgres`.
110
-
111
- ### :db_url
112
-
113
- **Default value:** None
114
-
115
- **Valid values:** A valid database URL for the [Sequel
116
- gem](http://sequel.jeremyevans.net/)
117
-
118
- **Description**<br />
119
- Specifies the database to connect to when using `postgres` for the
120
- `:db_adapter`. Only used when `postgres` is used for `:db_adapter`.
121
-
122
- ### :rubygems_url
123
-
124
- **Default value:** `https://www.rubygems.org`
125
-
126
- **Valid values:** A valid gem source URL
127
-
128
- **Description**<br />
129
- Specifies the default gem source URL. When any API endpoint is called without a
130
- `/private` or `/upstream/<url>` prefix, this URL will be used to fetch the
131
- result. This value can be safely changed even if there are already gems stashed
132
- for the previous value.
133
-
134
- ### :bind
135
-
136
- **Default value:** `tcp://0.0.0.0:9292`
137
-
138
- **Valid values:** Any valid binding that [is supported by
139
- Puma](https://github.com/puma/puma#binding-tcp--sockets)
140
-
141
- **Description**<br />
142
- Specifies the binding used to start the Gemstash server. Keep in mind the user
143
- starting Gemstash needs to have access to bind in this manner. For example, if
144
- you use a port below 1024, you will need to run Gemstash as the root user.
145
-
146
- ## Authorize
147
-
148
- Adds or removes authorization to interact with privately stored gems.
149
-
150
- ### Usage
151
-
152
- ```
153
- gemstash authorize
154
- gemstash authorize push yank
155
- gemstash authorize yank unyank --key <secure-key>
156
- gemstash authorize --remove --key <secure-key>
157
- ```
158
-
159
- ### Arguments
160
-
161
- Any arguments will be used as specific permissions. Valid permissions include
162
- `push`, `yank`, and `unyank`. If no permissions are provided, then all
163
- permissions will be granted (including any that may be added in future versions
164
- of Gemstash).
165
-
166
- ### Options
167
-
168
- #### --config-file
169
-
170
- **Usage:** `--config-file <file>`
171
-
172
- **Description**<br />
173
- Specify the config file to use. If you aren't using the default config file at
174
- `~/.gemstash/config.yml`, then you must specify the config file via this option.
175
-
176
- #### --key
177
-
178
- **Usage:** `--key <secure-key>`
179
-
180
- **Description**<br />
181
- Specify the API key to affect. This should be the actual key value, not a name.
182
- This option is required when using `--remove` but is optional otherwise. If
183
- adding an authorization, using this will either create or update the permissions
184
- for the specified API key. If missing, a new API key will always be generated.
185
-
186
- #### --remove
187
-
188
- **Usage:** `--remove`
189
-
190
- **Description**<br />
191
- Remove an authorization rather than add or update one. When removing, permission
192
- values are not allowed. The `--key <secure-key>` option is required.
193
-
194
- ## Start
195
-
196
- Starts the Gemstash server.
197
-
198
- ### Usage
199
-
200
- ```
201
- gemstash start
202
- gemstash start --no-daemonize
203
- ```
204
-
205
- ### Options
206
-
207
- #### --config-file
208
-
209
- **Usage:** `--config-file <file>`
210
-
211
- **Description**<br />
212
- Specify the config file to use. If you aren't using the default config file at
213
- `~/.gemstash/config.yml`, then you must specify the config file via this option.
214
-
215
- #### --no-daemonize
216
-
217
- **Usage:** `--no-daemonize`
218
-
219
- **Description**<br />
220
- The Gemstash server daemonizes itself by default. Provide this option to instead
221
- run the server until `Ctrl-C` is typed. When not daemonized, the log will be
222
- output to standard out.
223
-
224
- ## Stop
225
-
226
- Stops the Gemstash server.
227
-
228
- ### Usage
229
-
230
- ```
231
- gemstash stop
232
- ```
233
-
234
- ### Options
235
-
236
- #### --config-file
237
-
238
- **Usage:** `--config-file <file>`
239
-
240
- **Description**<br />
241
- Specify the config file to use. If you aren't using the default config file at
242
- `~/.gemstash/config.yml`, then you must specify the config file via this option.
243
-
244
- ## Status
245
-
246
- Checks status of the Gemstash server.
247
-
248
- ### Usage
249
-
250
- ```
251
- gemstash status
252
- ```
253
-
254
- ### Options
255
-
256
- #### --config-file
257
-
258
- **Usage:** `--config-file <file>`
259
-
260
- **Description**<br />
261
- Specify the config file to use. If you aren't using the default config file at
262
- `~/.gemstash/config.yml`, then you must specify the config file via this option.
263
-
264
- ## Setup
265
-
266
- Customize your Gemstash configuration interactively. This will save your config
267
- file, but only if a few checks pass after you've provided your answers.
268
-
269
- ### Usage
270
-
271
- ```
272
- gemstash setup
273
- gemstash setup --redo
274
- gemstash setup --config-file <file>
275
- ```
276
-
277
- ### Options
278
-
279
- #### --redo
280
-
281
- **Usage:** `--redo`
282
-
283
- **Description**<br />
284
- Redo the configuration. This does nothing the first time `gemstash setup` is
285
- run. If you want to change your configuration using `gemstash setup` after
286
- you've run it before, you must provide this option, otherwise Gemstash will
287
- simply indicate your setup is complete.
288
-
289
- #### --debug
290
-
291
- **Usage:** `--debug`
292
-
293
- **Description**<br />
294
- Output additional information if one of the checks at the end of setup fails.
295
- This will do nothing if all checks pass.
296
-
297
- #### --config-file
298
-
299
- **Usage:** `--config-file <file>`
300
-
301
- **Description**<br />
302
- Specify the config file to write to. Without this option, your configuration
303
- will be written to `~/.gemstash/config.yml`. If you write to a custom location,
304
- you will need to pass the `--config-file` option to all Gemstash commands.
305
-
306
- ---
307
-
308
- Table of contents thanks to [gh-md-toc](https://github.com/ekalinin/github-markdown-toc).
data/gemstash.gemspec DELETED
@@ -1,47 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "gemstash/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "gemstash"
8
- spec.version = Gemstash::VERSION
9
- spec.authors = ["Andre Arko"]
10
- spec.email = ["andre@arko.net"]
11
- spec.platform = "java" if RUBY_PLATFORM == "java"
12
-
13
- spec.summary = "A place to stash gems you'll need"
14
- spec.description = "Gemstash acts as a local RubyGems server, caching \
15
- copies of gems from RubyGems.org automatically, and eventually letting \
16
- you push your own private gems as well."
17
- spec.homepage = "https://github.com/bundler/gemstash"
18
- spec.license = "MIT"
19
-
20
- spec.files = `git ls-files -z`.split("\x0").reject {|f|
21
- f.match(%r{^(test|spec|features)/})
22
- }
23
- spec.bindir = "exe"
24
- spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
25
- spec.require_paths = ["lib"]
26
-
27
- spec.add_runtime_dependency "dalli", "~> 2.7"
28
- spec.add_runtime_dependency "lru_redux", "~> 1.1"
29
- spec.add_runtime_dependency "puma", "~> 2.14"
30
- spec.add_runtime_dependency "sequel", "~> 4.26"
31
- spec.add_runtime_dependency "sinatra", "~> 1.4"
32
- spec.add_runtime_dependency "thor", "~> 0.19"
33
- spec.add_runtime_dependency "faraday", "~> 0.9"
34
- spec.add_runtime_dependency "faraday_middleware", "~> 0.10"
35
-
36
- if RUBY_PLATFORM == "java"
37
- spec.add_runtime_dependency "jdbc-sqlite3", "~> 3.8"
38
- else
39
- spec.add_runtime_dependency "sqlite3", "~> 1.3"
40
- end
41
-
42
- spec.add_development_dependency "bundler", "~> 1.10"
43
- spec.add_development_dependency "rack-test", "~> 0.6"
44
- spec.add_development_dependency "rake", "~> 10.0"
45
- spec.add_development_dependency "rspec", "~> 3.3"
46
- spec.add_development_dependency "rubocop", "~> 0.34"
47
- end
data/gemstash.png DELETED
Binary file
@@ -1,61 +0,0 @@
1
- require "gemstash"
2
-
3
- module Gemstash
4
- # Class that supports unyanking a gem from the private repository of gems.
5
- class GemUnyanker
6
- include Gemstash::Env::Helper
7
-
8
- # This error is thrown when unyanking a non-existing gem name.
9
- class UnknownGemError < StandardError
10
- end
11
-
12
- # This error is thrown when unyanking a non-existing gem version.
13
- class UnknownVersionError < StandardError
14
- end
15
-
16
- # This error is thrown when unyanking a non-yanked gem version.
17
- class NotYankedVersionError < StandardError
18
- end
19
-
20
- def initialize(auth_key, gem_name, slug)
21
- @auth_key = auth_key
22
- @gem_name = gem_name
23
- @slug = slug
24
- end
25
-
26
- def unyank
27
- check_auth
28
- update_database
29
- invalidate_cache
30
- end
31
-
32
- private
33
-
34
- def storage
35
- @storage ||= Gemstash::Storage.for("private").for("gems")
36
- end
37
-
38
- def full_name
39
- @full_name ||= "#{@gem_name}-#{@slug}"
40
- end
41
-
42
- def check_auth
43
- Gemstash::Authorization.check(@auth_key, "unyank")
44
- end
45
-
46
- def update_database
47
- gemstash_env.db.transaction do
48
- raise UnknownGemError, "Cannot unyank an unknown gem!" unless Gemstash::DB::Rubygem[name: @gem_name]
49
- version = Gemstash::DB::Version.find_by_full_name(full_name)
50
- raise UnknownVersionError, "Cannot unyank an unknown version!" unless version
51
- raise NotYankedVersionError, "Cannot unyank a non-yanked version!" if version.indexed
52
- version.reindex
53
- storage.resource(version.storage_id).update_properties(indexed: true)
54
- end
55
- end
56
-
57
- def invalidate_cache
58
- gemstash_env.cache.invalidate_gem("private", @gem_name)
59
- end
60
- end
61
- end