gemirro 1.3.0 → 1.4.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: f5ce407f251612fd3198509818414c754d97508355e1fc1a723a08448bfb369f
4
- data.tar.gz: 669d4d88aa1db6241b7e8861934d12893accde19fad6454d829a9e143569622b
3
+ metadata.gz: 56fa41eef2a76a964a6d885f5c78ea8e6193c2442ae9dc7b3db6cae10c934ea9
4
+ data.tar.gz: '08152e167296fd41283619abf268f08279b950ff3d683f500f3cdce5fe49ae5e'
5
5
  SHA512:
6
- metadata.gz: 3c49aa30264c21ca2fb840f5c4b2b6dd6058c5b587e94ff5ae4e94488a00d86f25e0a56de742c9ab8078a6350bb5f15d38119b69decfdd5088e0c8b0ff4dafa6
7
- data.tar.gz: 96e25a3b96ca072f6823b8583626b9dd502048e444423af8d50ffcc9040a139daa5aa36314ce914edef2123c335015a6f8f1f758b18a62339fcfe60d3c006afa
6
+ metadata.gz: 0ab54b560eb64207ce1074ac87c02a71569ecf626069a59ae4aa3bfb8dbc5e504c57712e57e216a9c0d27347fca1c54db3037846fefe90ad1ad70de35423b257
7
+ data.tar.gz: da5e332d738e42ca80ed7946a2bb598b213ce50d54df704f672d3717d010b07bfa5dc3e07d7b3290cc95557f657635a7de46ab9372c6a981b3b19f233c3f2acf
data/MANIFEST CHANGED
@@ -1,6 +1,5 @@
1
1
  .gitignore
2
2
  .rubocop.yml
3
- .travis.yml
4
3
  Gemfile
5
4
  LICENSE
6
5
  MANIFEST
@@ -62,9 +61,8 @@ template/public/dist/fonts/glyphicons-halflings-regular.ttf
62
61
  template/public/dist/fonts/glyphicons-halflings-regular.woff
63
62
  template/public/dist/fonts/glyphicons-halflings-regular.woff2
64
63
  template/public/dist/js/bootstrap.min.js
65
- template/public/dist/js/jquery.min.js
66
64
  template/public/gems/.gitkeep
67
65
  views/gem.erb
68
66
  views/index.erb
69
67
  views/layout.erb
70
- views/not_found.erb
68
+ views/not_found.erb
data/README.md CHANGED
@@ -29,7 +29,7 @@ This is done by running the `gemirro init` command.
29
29
  $ gemirro init /srv/http/mirror.com/
30
30
  ```
31
31
 
32
- Once created you can edit the main configuration file called `config.rb`.
32
+ Once created you can edit the main configuration file called [config.rb](https://github.com/PierreRambaud/gemirro/blob/master/template/config.rb).
33
33
  This configuration file specifies what source to mirror, destination directory, server host and port, etc.
34
34
 
35
35
  Once configured and if you add gem in the `define_source`, you can pull them by running the following command:
data/gemirro.gemspec CHANGED
@@ -18,15 +18,16 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.required_ruby_version = '>= 2.5'
20
20
 
21
- s.add_dependency 'addressable', '~>2.5'
21
+ s.add_dependency 'addressable', '~>2.8'
22
22
  s.add_dependency 'builder', '~>3.2'
23
- s.add_dependency 'confstruct', '~>1.0'
23
+ s.add_dependency 'confstruct', '~>1.1'
24
24
  s.add_dependency 'erubis', '~>2.7'
25
25
  s.add_dependency 'httpclient', '~>2.8'
26
- s.add_dependency 'parallel', '~>1.20'
27
- s.add_dependency 'sinatra', '~>2.0.1'
26
+ s.add_dependency 'parallel', '~>1.21'
27
+ s.add_dependency 'sinatra', '>=2.1', '<4.0'
28
+ s.add_dependency 'sinatra-static-assets', '~>1.0'
28
29
  s.add_dependency 'slop', '~>3.6'
29
- s.add_dependency 'thin', '~>1.7'
30
+ s.add_dependency 'thin', '~>1.8'
30
31
 
31
32
  s.add_development_dependency 'fakefs', '~>1'
32
33
  s.add_development_dependency 'rack-test', '~>1.1'
data/lib/gemirro/http.rb CHANGED
@@ -29,7 +29,34 @@ module Gemirro
29
29
  # @return [HTTPClient]
30
30
  #
31
31
  def self.client
32
- @client ||= HTTPClient.new
32
+ client ||= HTTPClient.new
33
+ config = Utils.configuration
34
+ if defined?(config.upstream_user)
35
+ user = config.upstream_user
36
+ password = config.upstream_password
37
+ domain = config.upstream_domain
38
+ client.set_auth(domain, user, password)
39
+ end
40
+
41
+ if defined?(config.proxy)
42
+ proxy = config.proxy
43
+ client.proxy=(proxy)
44
+ end
45
+
46
+ # Use my own ca file for self signed cert
47
+ if defined?(config.rootca)
48
+ abort "The configuration file #{config.rootca} does not exist" unless File.file?(config.rootca)
49
+ client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER
50
+ client.ssl_config.set_trust_ca(config.rootca)
51
+ elsif defined?(config.verify_mode)
52
+ client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE unless config.verify_mode
53
+ end
54
+
55
+ # Enforce base auth
56
+ if defined?(config.basic_auth)
57
+ client.force_basic_auth=(true) if config.basic_auth
58
+ end
59
+ @client = client
33
60
  end
34
61
  end
35
62
  end
@@ -40,8 +40,8 @@ module Gemirro
40
40
 
41
41
  unless defined?(Builder::XChar)
42
42
  raise 'Gem::Indexer requires that the XML Builder ' \
43
- 'library be installed:' \
44
- "\n\tgem install builder"
43
+ 'library be installed:' \
44
+ "\n\tgem install builder"
45
45
  end
46
46
 
47
47
  options = { build_modern: true }.merge options
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'sinatra/base'
4
+ require 'sinatra/static_assets'
4
5
  require 'thin'
5
6
  require 'uri'
6
7
  require 'addressable/uri'
@@ -10,6 +11,8 @@ module Gemirro
10
11
  # Launch Sinatra server to easily download gems.
11
12
  #
12
13
  class Server < Sinatra::Base
14
+ register Sinatra::StaticAssets
15
+
13
16
  # rubocop:disable Layout/LineLength
14
17
  URI_REGEXP = /^(.*)-(\d+(?:\.\d+){1,4}.*?)(?:-(x86-(?:(?:mswin|mingw)(?:32|64)).*?|java))?\.(gem(?:spec\.rz)?)$/.freeze
15
18
  # rubocop:enable Layout/LineLength
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Gemirro Version
4
4
  module Gemirro
5
- VERSION = '1.3.0'
5
+ VERSION = '1.4.0'
6
6
  end
data/template/config.rb CHANGED
@@ -32,6 +32,24 @@ Gemirro.configuration.configure do
32
32
  #
33
33
  # fetch_gem false
34
34
 
35
+ # If upstream repository requires authentication
36
+ # upstream_user 'username'
37
+ # upstream_password 'password'
38
+ # upstream_domain 'https://internal.com'
39
+
40
+ # Enforce the the base_auth
41
+ # basic_auth true
42
+
43
+ # Set the proxy server if behind the firewall
44
+ # proxy 'http://proxy.internal.com:80'
45
+
46
+ # Root CA cert location if additional root ca is added
47
+ # This will overwrite verfiy_mode. use PEER as default
48
+ # rootca '/etc/root_ca.crt'
49
+
50
+ # Not verify certificate in case the proxy has self-signed cert
51
+ # verify_mode false
52
+
35
53
  # You must define a source which where gems will be downloaded.
36
54
  # All gem in the block will be downloaded with the update command.
37
55
  # Other gems will be downloaded with the server.