geminabox 2.2.0 → 3.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.
- checksums.yaml +4 -4
- data/README.md +10 -11
- data/lib/geminabox/disk_cache.rb +11 -15
- data/lib/geminabox/hostess.rb +8 -13
- data/lib/geminabox/indexer.rb +1 -0
- data/lib/geminabox/proxy/hostess.rb +10 -15
- data/lib/geminabox/server.rb +5 -3
- data/lib/geminabox/version.rb +1 -1
- data/lib/geminabox.rb +12 -27
- data/lib/geminabox_client.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cfce489e43841df96a314d9a85776328e77a48c3093fabbd9333f5ac0a83079
|
|
4
|
+
data.tar.gz: d3b23957c2ac25f41aab48528e49f85d24fb6701aabec0ae5d8ef622ea189521
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0985c4ba1960c2ef314f18a9a3a6209e76401ffd00ffed6ad79b5e75a3de169f47c315c87e25e930d8d72ecf3f41b94f2cd1d1d41f027ae0aa4c83796cd71cb8'
|
|
7
|
+
data.tar.gz: 9a28c37de926675893b4d620c037531e44894d084025ffbd6deb77d2f55be4e76fbc0f866e8547d29e6454f996dd9b1f5aea43c21ed44f9fd463c011d5e92c5b
|
data/README.md
CHANGED
|
@@ -15,16 +15,8 @@ For basic auth, try [Rack::Auth](http://www.rubydoc.info/github/rack/rack/Rack/A
|
|
|
15
15
|
|
|
16
16
|
## System Requirements
|
|
17
17
|
|
|
18
|
-
- Ruby
|
|
19
|
-
- RubyGems 2.
|
|
20
|
-
- **Ruby 3.3+ users:** You must also install the `rubygems-generate_index` gem.
|
|
21
|
-
`Gem::Indexer` was extracted from RubyGems in 3.3 and geminabox requires it
|
|
22
|
-
to function. Add it to your Gemfile or install it directly:
|
|
23
|
-
|
|
24
|
-
gem install rubygems-generate_index
|
|
25
|
-
|
|
26
|
-
**Note:** Ruby 2.x support is deprecated. geminabox 3.0 will require Ruby >= 3.0.
|
|
27
|
-
Pin to `gem 'geminabox', '~> 2.2'` if you cannot upgrade yet.
|
|
18
|
+
- Ruby 3.0 or later (Ruby 3.2+ recommended)
|
|
19
|
+
- RubyGems 3.2.3 or later (latest version recommended)
|
|
28
20
|
|
|
29
21
|
## Server Setup
|
|
30
22
|
|
|
@@ -51,6 +43,12 @@ Start your gem server with 'rackup' to run WEBrick or hook up the config.ru as y
|
|
|
51
43
|
|
|
52
44
|
## RubyGems Proxy
|
|
53
45
|
|
|
46
|
+
> **Deprecated.** The RubyGems proxy is unmaintained and **will be removed in
|
|
47
|
+
> Geminabox 4.0.** It depends on the RubyGems.org Dependency API
|
|
48
|
+
> (`/api/v1/dependencies`), which was [sunset on 2023-05-24](https://blog.rubygems.org/2023/02/22/dependency-api-deprecation.html)
|
|
49
|
+
> in favour of the Compact Index API, so proxy mode no longer functions.
|
|
50
|
+
> Enabling it now emits a deprecation warning. Do not rely on this feature.
|
|
51
|
+
|
|
54
52
|
Geminabox can be configured to pull gems, it does not currently have, from rubygems.org. To enable this mode you can either:
|
|
55
53
|
|
|
56
54
|
Set RUBYGEM_PROXY to true in the environment:
|
|
@@ -188,7 +186,8 @@ Your Gemfile only needs:
|
|
|
188
186
|
source 'https://rubygems.org'
|
|
189
187
|
|
|
190
188
|
gem 'geminabox'
|
|
191
|
-
gem '
|
|
189
|
+
gem 'rackup'
|
|
190
|
+
gem 'webrick' # or other server you prefer
|
|
192
191
|
```
|
|
193
192
|
|
|
194
193
|
From there
|
data/lib/geminabox/disk_cache.rb
CHANGED
|
@@ -46,26 +46,22 @@ module Geminabox
|
|
|
46
46
|
|
|
47
47
|
def read(key_hash)
|
|
48
48
|
read_int(key_hash) do |path|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
nil
|
|
55
|
-
end
|
|
49
|
+
File.read(path)
|
|
50
|
+
rescue Errno::ENOENT
|
|
51
|
+
# There is a possibility that the file is removed by another process
|
|
52
|
+
# after checking File.exist?. Return nil if the file does not exist.
|
|
53
|
+
nil
|
|
56
54
|
end
|
|
57
55
|
end
|
|
58
56
|
|
|
59
57
|
def marshal_read(key_hash)
|
|
60
58
|
read_int(key_hash) do |path|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
nil
|
|
68
|
-
end
|
|
59
|
+
File.open(path) {|fp| Marshal.load(fp) }
|
|
60
|
+
rescue Errno::ENOENT, EOFError
|
|
61
|
+
# There is a possibility that the file is removed by another process.
|
|
62
|
+
# Marshal.load raises EOFError if the file is removed after File.open(path) succeeds.
|
|
63
|
+
# Return nil if the file does not exist.
|
|
64
|
+
nil
|
|
69
65
|
end
|
|
70
66
|
end
|
|
71
67
|
|
data/lib/geminabox/hostess.rb
CHANGED
|
@@ -5,6 +5,8 @@ require 'sinatra/base'
|
|
|
5
5
|
module Geminabox
|
|
6
6
|
|
|
7
7
|
class Hostess < Sinatra::Base
|
|
8
|
+
set :host_authorization, { permitted_hosts: [] }
|
|
9
|
+
|
|
8
10
|
def serve
|
|
9
11
|
headers["Cache-Control"] = 'no-transform'
|
|
10
12
|
send_file(File.expand_path(File.join(Geminabox.data, *request.path_info)), :type => response['Content-Type'])
|
|
@@ -20,23 +22,16 @@ module Geminabox
|
|
|
20
22
|
end
|
|
21
23
|
end
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
].each do |deflated_index|
|
|
27
|
-
get deflated_index do
|
|
28
|
-
content_type('application/x-deflate')
|
|
29
|
-
serve
|
|
30
|
-
end
|
|
25
|
+
get '/quick/Marshal.4.8/*.gemspec.rz' do
|
|
26
|
+
content_type('application/x-deflate')
|
|
27
|
+
serve
|
|
31
28
|
end
|
|
32
29
|
|
|
33
|
-
%w[/
|
|
34
|
-
/Marshal.4.8
|
|
35
|
-
/specs.4.8
|
|
30
|
+
%w[/specs.4.8
|
|
36
31
|
/latest_specs.4.8
|
|
37
32
|
/prerelease_specs.4.8
|
|
38
|
-
].each do |
|
|
39
|
-
get
|
|
33
|
+
].each do |index|
|
|
34
|
+
get index do
|
|
40
35
|
serve
|
|
41
36
|
end
|
|
42
37
|
end
|
data/lib/geminabox/indexer.rb
CHANGED
|
@@ -6,6 +6,8 @@ require 'net/http'
|
|
|
6
6
|
module Geminabox
|
|
7
7
|
module Proxy
|
|
8
8
|
class Hostess < Sinatra::Base
|
|
9
|
+
set :host_authorization, { permitted_hosts: [] }
|
|
10
|
+
|
|
9
11
|
attr_accessor :file_handler
|
|
10
12
|
def serve
|
|
11
13
|
headers["Cache-Control"] = 'no-transform'
|
|
@@ -27,25 +29,18 @@ module Geminabox
|
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
get "/#{deflated_index}" do
|
|
35
|
-
copy_file request.path_info[1..-1]
|
|
36
|
-
content_type('application/x-deflate')
|
|
37
|
-
serve
|
|
38
|
-
end
|
|
32
|
+
get '/quick/Marshal.4.8/*.gemspec.rz' do
|
|
33
|
+
copy_file request.path_info[1..]
|
|
34
|
+
content_type('application/x-deflate')
|
|
35
|
+
serve
|
|
39
36
|
end
|
|
40
37
|
|
|
41
|
-
%w[
|
|
42
|
-
Marshal.4.8
|
|
43
|
-
specs.4.8
|
|
38
|
+
%w[specs.4.8
|
|
44
39
|
latest_specs.4.8
|
|
45
40
|
prerelease_specs.4.8
|
|
46
|
-
].each do |
|
|
47
|
-
get "/#{
|
|
48
|
-
splice_file
|
|
41
|
+
].each do |index|
|
|
42
|
+
get "/#{index}" do
|
|
43
|
+
splice_file index
|
|
49
44
|
serve
|
|
50
45
|
end
|
|
51
46
|
end
|
data/lib/geminabox/server.rb
CHANGED
|
@@ -9,8 +9,10 @@ module Geminabox
|
|
|
9
9
|
enable :static, :methodoverride
|
|
10
10
|
set :public_folder, Geminabox.public_folder
|
|
11
11
|
set :views, Geminabox.views
|
|
12
|
+
set :host_authorization, { permitted_hosts: [] }
|
|
12
13
|
|
|
13
14
|
if Geminabox.rubygems_proxy
|
|
15
|
+
Geminabox.warn_rubygems_proxy_deprecation
|
|
14
16
|
use Proxy::Hostess
|
|
15
17
|
else
|
|
16
18
|
use Hostess
|
|
@@ -60,7 +62,7 @@ module Geminabox
|
|
|
60
62
|
end
|
|
61
63
|
|
|
62
64
|
def indexer
|
|
63
|
-
Gem::Indexer.new(Geminabox.data
|
|
65
|
+
Gem::Indexer.new(Geminabox.data)
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
def dependency_cache
|
|
@@ -158,8 +160,8 @@ module Geminabox
|
|
|
158
160
|
halt 400 unless request.form_data?
|
|
159
161
|
|
|
160
162
|
serialize_update do
|
|
161
|
-
gems = load_gems.select { |gem|
|
|
162
|
-
|
|
163
|
+
gems = load_gems.select { |gem| params['gem_name'] == gem.name and
|
|
164
|
+
params['version'] == gem.number.version }
|
|
163
165
|
halt 404, 'Gem not found' if gems.size == 0
|
|
164
166
|
gems.each do |gem|
|
|
165
167
|
gem_path = File.expand_path(File.join(Geminabox.data, 'gems',
|
data/lib/geminabox/version.rb
CHANGED
data/lib/geminabox.rb
CHANGED
|
@@ -5,19 +5,7 @@ require 'digest/md5'
|
|
|
5
5
|
require 'builder'
|
|
6
6
|
require 'sinatra/base'
|
|
7
7
|
require 'rubygems/user_interaction'
|
|
8
|
-
|
|
9
|
-
# On Ruby 3.3+, require the rubygems-generate_index gem instead.
|
|
10
|
-
begin
|
|
11
|
-
require 'rubygems/indexer'
|
|
12
|
-
rescue LoadError
|
|
13
|
-
begin
|
|
14
|
-
require 'rubygems-generate_index'
|
|
15
|
-
rescue LoadError
|
|
16
|
-
raise LoadError,
|
|
17
|
-
"Ruby 3.3+ requires the 'rubygems-generate_index' gem. " \
|
|
18
|
-
"Add it to your Gemfile or run: gem install rubygems-generate_index"
|
|
19
|
-
end
|
|
20
|
-
end
|
|
8
|
+
require 'rubygems/indexer'
|
|
21
9
|
require 'rubygems/package'
|
|
22
10
|
require 'tempfile'
|
|
23
11
|
require 'json'
|
|
@@ -25,11 +13,6 @@ require 'tilt/erb'
|
|
|
25
13
|
require 'rack/protection'
|
|
26
14
|
|
|
27
15
|
module Geminabox
|
|
28
|
-
if RUBY_VERSION < '3.0'
|
|
29
|
-
warn "DEPRECATION: geminabox 3.0 will require Ruby >= 3.0. " \
|
|
30
|
-
"You are running Ruby #{RUBY_VERSION}. Please plan your upgrade. " \
|
|
31
|
-
"Pin to gem 'geminabox', '~> 2.2' if you cannot upgrade yet."
|
|
32
|
-
end
|
|
33
16
|
|
|
34
17
|
class Error < StandardError ; end
|
|
35
18
|
|
|
@@ -74,14 +57,6 @@ module Geminabox
|
|
|
74
57
|
:on_gem_received
|
|
75
58
|
)
|
|
76
59
|
|
|
77
|
-
attr_reader :build_legacy
|
|
78
|
-
|
|
79
|
-
def build_legacy=(value)
|
|
80
|
-
warn "Setting `Geminabox.build_legacy` is deprecated and will be removed in the future. Geminbox will always build modern indices"
|
|
81
|
-
|
|
82
|
-
@build_legacy = value
|
|
83
|
-
end
|
|
84
|
-
|
|
85
60
|
def set_defaults(defaults)
|
|
86
61
|
defaults.each do |method, default|
|
|
87
62
|
variable = "@#{method}"
|
|
@@ -93,6 +68,17 @@ module Geminabox
|
|
|
93
68
|
Server.settings
|
|
94
69
|
end
|
|
95
70
|
|
|
71
|
+
# Deprecated: the RubyGems proxy is unmaintained and will be removed in
|
|
72
|
+
# Geminabox 4.0. It depends on the RubyGems.org Dependency API
|
|
73
|
+
# (/api/v1/dependencies), which was sunset on 2023-05-24, so proxy mode no
|
|
74
|
+
# longer functions.
|
|
75
|
+
def warn_rubygems_proxy_deprecation
|
|
76
|
+
warn '[DEPRECATION] Geminabox RubyGems proxy is deprecated and will be ' \
|
|
77
|
+
'removed in Geminabox 4.0. It depends on the RubyGems.org ' \
|
|
78
|
+
'Dependency API (/api/v1/dependencies), which was sunset on ' \
|
|
79
|
+
'2023-05-24, so proxy mode no longer functions.'
|
|
80
|
+
end
|
|
81
|
+
|
|
96
82
|
def call(env)
|
|
97
83
|
Server.call env
|
|
98
84
|
end
|
|
@@ -101,7 +87,6 @@ module Geminabox
|
|
|
101
87
|
set_defaults(
|
|
102
88
|
data: File.join(File.dirname(__FILE__), *%w[.. data]),
|
|
103
89
|
public_folder: File.join(File.dirname(__FILE__), *%w[.. public]),
|
|
104
|
-
build_legacy: false,
|
|
105
90
|
incremental_updates: true,
|
|
106
91
|
views: File.join(File.dirname(__FILE__), *%w[.. views]),
|
|
107
92
|
allow_replace: false,
|
data/lib/geminabox_client.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: geminabox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom Lea
|
|
@@ -19,14 +19,14 @@ dependencies:
|
|
|
19
19
|
requirements:
|
|
20
20
|
- - "~>"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '4.0'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
27
|
- - "~>"
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
29
|
+
version: '4.0'
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
31
|
name: builder
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -103,6 +103,20 @@ dependencies:
|
|
|
103
103
|
- - ">="
|
|
104
104
|
- !ruby/object:Gem::Version
|
|
105
105
|
version: '0'
|
|
106
|
+
- !ruby/object:Gem::Dependency
|
|
107
|
+
name: rubygems-generate_index
|
|
108
|
+
requirement: !ruby/object:Gem::Requirement
|
|
109
|
+
requirements:
|
|
110
|
+
- - "~>"
|
|
111
|
+
- !ruby/object:Gem::Version
|
|
112
|
+
version: '1.1'
|
|
113
|
+
type: :runtime
|
|
114
|
+
prerelease: false
|
|
115
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
116
|
+
requirements:
|
|
117
|
+
- - "~>"
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: '1.1'
|
|
106
120
|
description: A private gem hosting and/or caching app, with client side gem push style
|
|
107
121
|
functionality. Web UI is provided.
|
|
108
122
|
email:
|
|
@@ -153,7 +167,7 @@ files:
|
|
|
153
167
|
- views/upload.erb
|
|
154
168
|
homepage: https://github.com/geminabox/geminabox
|
|
155
169
|
licenses:
|
|
156
|
-
- MIT
|
|
170
|
+
- MIT
|
|
157
171
|
metadata:
|
|
158
172
|
homepage_uri: https://github.com/geminabox/geminabox
|
|
159
173
|
source_code_uri: https://github.com/geminabox/geminabox
|
|
@@ -167,12 +181,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
167
181
|
requirements:
|
|
168
182
|
- - ">="
|
|
169
183
|
- !ruby/object:Gem::Version
|
|
170
|
-
version:
|
|
184
|
+
version: 3.0.0
|
|
171
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
186
|
requirements:
|
|
173
187
|
- - ">="
|
|
174
188
|
- !ruby/object:Gem::Version
|
|
175
|
-
version: 2.
|
|
189
|
+
version: 3.2.3
|
|
176
190
|
requirements: []
|
|
177
191
|
rubygems_version: 4.0.3
|
|
178
192
|
specification_version: 4
|