geminabox 2.1.0 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3afde9bba2ed91992e99d5e95ff71eb6a111d7a4b4362c1857e75a01dfdb671a
4
- data.tar.gz: 360da5ba51676bd8d78ae6139c782b52d9f83f31ca7a5497c06c6d38394fd5b9
3
+ metadata.gz: 4286ff9507b08e7212e2fc72813336bf169e4c86e082802bc600648ecc8a0e99
4
+ data.tar.gz: ffdd59e137b59252c6a9f526652ee5e99c092cd55e6e13ef191a9e004bbeb47d
5
5
  SHA512:
6
- metadata.gz: 2a2dc5c9d5109dd36b987066ec29f620e9d646dacd7a39813447b84ab03ffa6edde2bec1c50b341b1d0604d1317f740900c26f5bd72f40ba076893e00aee9b9e
7
- data.tar.gz: 44befa817d8a56f87be69c1c3ec06f75caed8c74a85e892207a5f06e43cb629da418db51eec3ac95fb081043c7066b7e64ab13edcfe5a7711a1020843f503d15
6
+ metadata.gz: 215aef46c5ecfe77d391368be8a119230f4b2afe11e65a31b468e67a24c3030aa427801fff384080e75bd8942ac2b9006adf917e8dda5c6857bb9888ad6838ba
7
+ data.tar.gz: e29de3a2b4eedc3f603c41af8b449bb90a7f6f6ef2a75184d2febe416a86bc1680d0e2d6525591f585571f5749359b2d7c6c130eed940327f6109d9f397f1493
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
+ [![](https://repository-images.githubusercontent.com/463074/c53c4131-3d92-42db-85b0-52f1e88c219a)](https://github.com/geminabox)
2
+
1
3
  # Gem in a Box – Really simple rubygem hosting
4
+
2
5
  [![Ruby](https://github.com/geminabox/geminabox/actions/workflows/ruby.yml/badge.svg)](https://github.com/geminabox/geminabox/actions/workflows/ruby.yml?query=branch%3Amaster)
3
6
  [![Gem Version](https://badge.fury.io/rb/geminabox.svg)](http://badge.fury.io/rb/geminabox)
4
7
  [![Code Climate](https://codeclimate.com/github/geminabox/geminabox/badges/gpa.svg)](https://codeclimate.com/github/geminabox/geminabox)
@@ -12,10 +15,8 @@ For basic auth, try [Rack::Auth](http://www.rubydoc.info/github/rack/rack/Rack/A
12
15
 
13
16
  ## System Requirements
14
17
 
15
- - Ruby 2.3 through 3.1 (Ruby 2.7, 3.0, or 3.1 is highly recommended)
16
- - RubyGems 2.4 through 3.3 (2.5.2 or higher is highly recommended)
17
-
18
- Use RubyGems the latest version (at least 2.5.2) for as an end-user full features like [`gem yank --host`](https://github.com/rubygems/rubygems/pull/1361).
18
+ - Ruby 3.0 or later (Ruby 3.2+ recommended)
19
+ - RubyGems 3.2.3 or later (latest version recommended)
19
20
 
20
21
  ## Server Setup
21
22
 
@@ -193,6 +194,17 @@ docker run -d -p 9292:9292 geminabox:latest
193
194
 
194
195
  Your server should now be running!
195
196
 
197
+
198
+ ## Running the tests
199
+
200
+ Running `rake` will run the complete test suite.
201
+
202
+ The test suite uses
203
+ [minitest-reporters](https://github.com/minitest-reporters/minitest-reporters)
204
+ with the default reporter. To get more detailed test output, use `rake
205
+ MINITEST_REPORTER=SpecReporter`. With this setting, output of the Geminabox
206
+ server that is started for integration tests is sent to `stdout` as well.
207
+
196
208
  ## Licence
197
209
 
198
210
  [MIT_LICENSE](./MIT-LICENSE)
@@ -46,26 +46,22 @@ module Geminabox
46
46
 
47
47
  def read(key_hash)
48
48
  read_int(key_hash) do |path|
49
- begin
50
- File.read(path)
51
- rescue Errno::ENOENT
52
- # There is a possibility that the file is removed by another process
53
- # after checking File.exist?. Return nil if the file does not exist.
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
- begin
62
- File.open(path) {|fp| Marshal.load(fp) }
63
- rescue Errno::ENOENT, EOFError
64
- # There is a possibility that the file is removed by another process.
65
- # Marshal.load raises EOFError if the file is removed after File.open(path) succeeds.
66
- # Return nil if the file does not exist.
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
 
@@ -15,7 +15,7 @@ module Geminabox
15
15
  when :combine_local_and_remote_gem_versions
16
16
  CombineLocalAndRemoteGemVersions
17
17
  else
18
- raise ArgumentError, "Merge strategy must be :local_gems_take_precedence_over_remote_gems (default) or :merge_local_and_remote_gem_versions"
18
+ raise ArgumentError, "Merge strategy must be :local_gems_take_precedence_over_remote_gems (default) or :combine_local_and_remote_gem_versions"
19
19
  end
20
20
  end
21
21
 
@@ -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
- %w[/quick/Marshal.4.8/*.gemspec.rz
24
- /yaml.Z
25
- /Marshal.4.8.Z
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[/yaml
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 |old_index|
39
- get old_index do
33
+ ].each do |index|
34
+ get index do
40
35
  serve
41
36
  end
42
37
  end
@@ -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
- %w[quick/Marshal.4.8/*.gemspec.rz
31
- yaml.Z
32
- Marshal.4.8.Z
33
- ].each do |deflated_index|
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[yaml
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 |old_index|
47
- get "/#{old_index}" do
48
- splice_file old_index
41
+ ].each do |index|
42
+ get "/#{index}" do
43
+ splice_file index
49
44
  serve
50
45
  end
51
46
  end
@@ -9,6 +9,7 @@ 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
14
15
  use Proxy::Hostess
@@ -60,7 +61,7 @@ module Geminabox
60
61
  end
61
62
 
62
63
  def indexer
63
- Gem::Indexer.new(Geminabox.data, :build_legacy => Geminabox.build_legacy)
64
+ Gem::Indexer.new(Geminabox.data)
64
65
  end
65
66
 
66
67
  def dependency_cache
@@ -158,13 +159,13 @@ module Geminabox
158
159
  halt 400 unless request.form_data?
159
160
 
160
161
  serialize_update do
161
- gems = load_gems.select { |gem| request['gem_name'] == gem.name and
162
- request['version'] == gem.number.version }
162
+ gems = load_gems.select { |gem| params['gem_name'] == gem.name and
163
+ params['version'] == gem.number.version }
163
164
  halt 404, 'Gem not found' if gems.size == 0
164
165
  gems.each do |gem|
165
166
  gem_path = File.expand_path(File.join(Geminabox.data, 'gems',
166
167
  "#{gem.gemfile_name}.gem"))
167
- File.delete gem_path if File.exists? gem_path
168
+ File.delete gem_path if File.exist? gem_path
168
169
  end
169
170
  self.class.reindex(:force_rebuild)
170
171
  return 200, 'Yanked gem and reindexed'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geminabox
4
- VERSION = '2.1.0' unless defined? VERSION
4
+ VERSION = '3.0.0' unless defined? VERSION
5
5
  end
data/lib/geminabox.rb CHANGED
@@ -57,14 +57,6 @@ module Geminabox
57
57
  :on_gem_received
58
58
  )
59
59
 
60
- attr_reader :build_legacy
61
-
62
- def build_legacy=(value)
63
- warn "Setting `Geminabox.build_legacy` is deprecated and will be removed in the future. Geminbox will always build modern indices"
64
-
65
- @build_legacy = value
66
- end
67
-
68
60
  def set_defaults(defaults)
69
61
  defaults.each do |method, default|
70
62
  variable = "@#{method}"
@@ -84,7 +76,6 @@ module Geminabox
84
76
  set_defaults(
85
77
  data: File.join(File.dirname(__FILE__), *%w[.. data]),
86
78
  public_folder: File.join(File.dirname(__FILE__), *%w[.. public]),
87
- build_legacy: false,
88
79
  incremental_updates: true,
89
80
  views: File.join(File.dirname(__FILE__), *%w[.. views]),
90
81
  allow_replace: false,
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'uri'
4
- require 'cgi'
4
+ require 'cgi/escape'
5
5
  require 'geminabox'
6
6
 
7
7
  class GeminaboxClient
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: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Lea
@@ -9,10 +9,9 @@ authors:
9
9
  - Rob Nichols
10
10
  - Naotoshi Seo
11
11
  - Takuya Noguchi
12
- autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2022-06-28 00:00:00.000000000 Z
14
+ date: 1980-01-02 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: sinatra
@@ -20,14 +19,14 @@ dependencies:
20
19
  requirements:
21
20
  - - "~>"
22
21
  - !ruby/object:Gem::Version
23
- version: '2.0'
22
+ version: '4.0'
24
23
  type: :runtime
25
24
  prerelease: false
26
25
  version_requirements: !ruby/object:Gem::Requirement
27
26
  requirements:
28
27
  - - "~>"
29
28
  - !ruby/object:Gem::Version
30
- version: '2.0'
29
+ version: '4.0'
31
30
  - !ruby/object:Gem::Dependency
32
31
  name: builder
33
32
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +103,20 @@ dependencies:
104
103
  - - ">="
105
104
  - !ruby/object:Gem::Version
106
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'
107
120
  description: A private gem hosting and/or caching app, with client side gem push style
108
121
  functionality. Web UI is provided.
109
122
  email:
@@ -154,12 +167,11 @@ files:
154
167
  - views/upload.erb
155
168
  homepage: https://github.com/geminabox/geminabox
156
169
  licenses:
157
- - MIT-LICENSE
170
+ - MIT
158
171
  metadata:
159
172
  homepage_uri: https://github.com/geminabox/geminabox
160
173
  source_code_uri: https://github.com/geminabox/geminabox
161
174
  changelog_uri: https://github.com/geminabox/geminabox/releases
162
- post_install_message:
163
175
  rdoc_options:
164
176
  - "--main"
165
177
  - README.md
@@ -169,15 +181,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
181
  requirements:
170
182
  - - ">="
171
183
  - !ruby/object:Gem::Version
172
- version: 2.3.0
184
+ version: 3.0.0
173
185
  required_rubygems_version: !ruby/object:Gem::Requirement
174
186
  requirements:
175
187
  - - ">="
176
188
  - !ruby/object:Gem::Version
177
- version: 2.4.0
189
+ version: 3.2.3
178
190
  requirements: []
179
- rubygems_version: 3.3.16
180
- signing_key:
191
+ rubygems_version: 4.0.3
181
192
  specification_version: 4
182
193
  summary: Really simple private RubyGems hosting
183
194
  test_files: []