gemstash 2.8.2 → 2.9.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/lib/gemstash/authorization.rb +0 -2
- data/lib/gemstash/cache.rb +5 -4
- data/lib/gemstash/cli/base.rb +9 -2
- data/lib/gemstash/cli/setup.rb +1 -1
- data/lib/gemstash/cli/start.rb +4 -0
- data/lib/gemstash/configuration.rb +71 -1
- data/lib/gemstash/db/upstream.rb +30 -2
- data/lib/gemstash/dependencies.rb +28 -5
- data/lib/gemstash/env.rb +4 -2
- data/lib/gemstash/gem_fetcher.rb +1 -2
- data/lib/gemstash/gem_pusher.rb +24 -20
- data/lib/gemstash/gem_source/private_source.rb +22 -6
- data/lib/gemstash/gem_source/upstream_source.rb +129 -34
- data/lib/gemstash/http_client.rb +167 -8
- data/lib/gemstash/logging.rb +3 -1
- data/lib/gemstash/man/gemstash-authorize.1 +29 -48
- data/lib/gemstash/man/gemstash-authorize.1.txt +14 -14
- data/lib/gemstash/man/gemstash-configuration.5 +231 -154
- data/lib/gemstash/man/gemstash-configuration.5.txt +208 -93
- data/lib/gemstash/man/gemstash-customize.7 +150 -168
- data/lib/gemstash/man/gemstash-customize.7.txt +80 -86
- data/lib/gemstash/man/gemstash-debugging.7 +20 -33
- data/lib/gemstash/man/gemstash-debugging.7.txt +5 -7
- data/lib/gemstash/man/gemstash-deploy.7 +31 -53
- data/lib/gemstash/man/gemstash-deploy.7.txt +17 -18
- data/lib/gemstash/man/gemstash-mirror.7 +24 -37
- data/lib/gemstash/man/gemstash-mirror.7.txt +14 -9
- data/lib/gemstash/man/gemstash-multiple-sources.7 +105 -110
- data/lib/gemstash/man/gemstash-multiple-sources.7.txt +62 -41
- data/lib/gemstash/man/gemstash-private-gems.7 +87 -136
- data/lib/gemstash/man/gemstash-private-gems.7.txt +30 -30
- data/lib/gemstash/man/gemstash-readme.7 +105 -127
- data/lib/gemstash/man/gemstash-readme.7.txt +43 -49
- data/lib/gemstash/man/gemstash-setup.1 +22 -42
- data/lib/gemstash/man/gemstash-setup.1.txt +12 -12
- data/lib/gemstash/man/gemstash-start.1 +9 -27
- data/lib/gemstash/man/gemstash-start.1.txt +5 -5
- data/lib/gemstash/man/gemstash-status.1 +9 -27
- data/lib/gemstash/man/gemstash-status.1.txt +5 -5
- data/lib/gemstash/man/gemstash-stop.1 +9 -27
- data/lib/gemstash/man/gemstash-stop.1.txt +5 -5
- data/lib/gemstash/man/gemstash-version.1 +8 -28
- data/lib/gemstash/man/gemstash-version.1.txt +2 -2
- data/lib/gemstash/rack_env_rewriter.rb +3 -0
- data/lib/gemstash/upstream.rb +83 -6
- data/lib/gemstash/version.rb +1 -1
- data/lib/gemstash/web.rb +12 -0
- metadata +7 -7
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
.\" Automatically generated by Pandoc 3.
|
|
1
|
+
.\" Automatically generated by Pandoc 3.7.0.2
|
|
2
2
|
.\"
|
|
3
|
-
|
|
4
|
-
.\" that render this, and otherwise B font.
|
|
5
|
-
.ie "\f[CB]x\f[]"x" \{\
|
|
6
|
-
. ftr V B
|
|
7
|
-
. ftr VI BI
|
|
8
|
-
. ftr VB B
|
|
9
|
-
. ftr VBI BI
|
|
10
|
-
.\}
|
|
11
|
-
.el \{\
|
|
12
|
-
. ftr V CR
|
|
13
|
-
. ftr VI CI
|
|
14
|
-
. ftr VB CB
|
|
15
|
-
. ftr VBI CBI
|
|
16
|
-
.\}
|
|
17
|
-
.TH "gemstash-start" "1" "October 9, 2015" "" ""
|
|
18
|
-
.hy
|
|
3
|
+
.TH "gemstash\-start" "1" "October 9, 2015" ""
|
|
19
4
|
.SH Name
|
|
20
|
-
|
|
21
|
-
gemstash-start - Starts the Gemstash server
|
|
5
|
+
gemstash\-start \- Starts the Gemstash server
|
|
22
6
|
.SH Synopsis
|
|
23
|
-
|
|
24
|
-
\f[V]gemstash start [--config-file FILE]\f[R]
|
|
7
|
+
\f[CR]gemstash start [\-\-config\-file FILE]\f[R]
|
|
25
8
|
.SH Description
|
|
26
|
-
.PP
|
|
27
9
|
Starts the Gemstash server.
|
|
28
10
|
.SH Options
|
|
29
|
-
.IP \
|
|
30
|
-
\f[
|
|
31
|
-
If you aren\
|
|
32
|
-
\f[
|
|
33
|
-
\f[
|
|
11
|
+
.IP \(bu 2
|
|
12
|
+
\f[CR]\-\-config\-file FILE\f[R]: Specify the config file to use.
|
|
13
|
+
If you aren\(cqt using the default config file at
|
|
14
|
+
\f[CR]\(ti/.gemstash/config.yml\f[R] or
|
|
15
|
+
\f[CR]\(ti/.gemstash/config.yml.erb\f[R], then you must specify the
|
|
34
16
|
config file via this option.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
4mgemstash-start24m(1)
|
|
1
|
+
4mgemstash-start24m(1) General Commands Manual 4mgemstash-start24m(1)
|
|
2
2
|
|
|
3
3
|
1mName0m
|
|
4
4
|
gemstash-start - Starts the Gemstash server
|
|
5
5
|
|
|
6
6
|
1mSynopsis0m
|
|
7
|
-
|
|
7
|
+
gemstash start [--config-file FILE]
|
|
8
8
|
|
|
9
9
|
1mDescription0m
|
|
10
10
|
Starts the Gemstash server.
|
|
11
11
|
|
|
12
12
|
1mOptions0m
|
|
13
|
-
o
|
|
14
|
-
using the default config file at
|
|
15
|
-
|
|
13
|
+
o --config-file FILE: Specify the config file to use. If you aren't
|
|
14
|
+
using the default config file at ~/.gemstash/config.yml or ~/.gem-
|
|
15
|
+
stash/config.yml.erb, then you must specify the config file via this
|
|
16
16
|
option.
|
|
17
17
|
|
|
18
18
|
October 9, 2015 4mgemstash-start24m(1)
|
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
.\" Automatically generated by Pandoc 3.
|
|
1
|
+
.\" Automatically generated by Pandoc 3.7.0.2
|
|
2
2
|
.\"
|
|
3
|
-
|
|
4
|
-
.\" that render this, and otherwise B font.
|
|
5
|
-
.ie "\f[CB]x\f[]"x" \{\
|
|
6
|
-
. ftr V B
|
|
7
|
-
. ftr VI BI
|
|
8
|
-
. ftr VB B
|
|
9
|
-
. ftr VBI BI
|
|
10
|
-
.\}
|
|
11
|
-
.el \{\
|
|
12
|
-
. ftr V CR
|
|
13
|
-
. ftr VI CI
|
|
14
|
-
. ftr VB CB
|
|
15
|
-
. ftr VBI CBI
|
|
16
|
-
.\}
|
|
17
|
-
.TH "gemstash-status" "1" "October 28, 2015" "" ""
|
|
18
|
-
.hy
|
|
3
|
+
.TH "gemstash\-status" "1" "October 28, 2015" ""
|
|
19
4
|
.SH Name
|
|
20
|
-
|
|
21
|
-
gemstash-status - Checks status of the Gemstash server
|
|
5
|
+
gemstash\-status \- Checks status of the Gemstash server
|
|
22
6
|
.SH Synopsis
|
|
23
|
-
|
|
24
|
-
\f[V]gemstash status [--config-file FILE]\f[R]
|
|
7
|
+
\f[CR]gemstash status [\-\-config\-file FILE]\f[R]
|
|
25
8
|
.SH Description
|
|
26
|
-
.PP
|
|
27
9
|
Checks status of the Gemstash server.
|
|
28
10
|
.SH Options
|
|
29
|
-
.IP \
|
|
30
|
-
\f[
|
|
31
|
-
If you aren\
|
|
32
|
-
\f[
|
|
33
|
-
\f[
|
|
11
|
+
.IP \(bu 2
|
|
12
|
+
\f[CR]\-\-config\-file FILE\f[R]: Specify the config file to use.
|
|
13
|
+
If you aren\(cqt using the default config file at
|
|
14
|
+
\f[CR]\(ti/.gemstash/config.yml\f[R] or
|
|
15
|
+
\f[CR]\(ti/.gemstash/config.yml.erb\f[R], then you must specify the
|
|
34
16
|
config file via this option.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
4mgemstash-status24m(1)
|
|
1
|
+
4mgemstash-status24m(1) General Commands Manual 4mgemstash-status24m(1)
|
|
2
2
|
|
|
3
3
|
1mName0m
|
|
4
4
|
gemstash-status - Checks status of the Gemstash server
|
|
5
5
|
|
|
6
6
|
1mSynopsis0m
|
|
7
|
-
|
|
7
|
+
gemstash status [--config-file FILE]
|
|
8
8
|
|
|
9
9
|
1mDescription0m
|
|
10
10
|
Checks status of the Gemstash server.
|
|
11
11
|
|
|
12
12
|
1mOptions0m
|
|
13
|
-
o
|
|
14
|
-
using the default config file at
|
|
15
|
-
|
|
13
|
+
o --config-file FILE: Specify the config file to use. If you aren't
|
|
14
|
+
using the default config file at ~/.gemstash/config.yml or ~/.gem-
|
|
15
|
+
stash/config.yml.erb, then you must specify the config file via this
|
|
16
16
|
option.
|
|
17
17
|
|
|
18
18
|
October 28, 2015 4mgemstash-status24m(1)
|
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
.\" Automatically generated by Pandoc 3.
|
|
1
|
+
.\" Automatically generated by Pandoc 3.7.0.2
|
|
2
2
|
.\"
|
|
3
|
-
|
|
4
|
-
.\" that render this, and otherwise B font.
|
|
5
|
-
.ie "\f[CB]x\f[]"x" \{\
|
|
6
|
-
. ftr V B
|
|
7
|
-
. ftr VI BI
|
|
8
|
-
. ftr VB B
|
|
9
|
-
. ftr VBI BI
|
|
10
|
-
.\}
|
|
11
|
-
.el \{\
|
|
12
|
-
. ftr V CR
|
|
13
|
-
. ftr VI CI
|
|
14
|
-
. ftr VB CB
|
|
15
|
-
. ftr VBI CBI
|
|
16
|
-
.\}
|
|
17
|
-
.TH "gemstash-stop" "1" "October 9, 2015" "" ""
|
|
18
|
-
.hy
|
|
3
|
+
.TH "gemstash\-stop" "1" "October 9, 2015" ""
|
|
19
4
|
.SH Name
|
|
20
|
-
|
|
21
|
-
gemstash-stop - Stops the Gemstash server
|
|
5
|
+
gemstash\-stop \- Stops the Gemstash server
|
|
22
6
|
.SH Synopsis
|
|
23
|
-
|
|
24
|
-
\f[V]gemstash stop [--config-file FILE]\f[R]
|
|
7
|
+
\f[CR]gemstash stop [\-\-config\-file FILE]\f[R]
|
|
25
8
|
.SH Description
|
|
26
|
-
.PP
|
|
27
9
|
Stops the Gemstash server.
|
|
28
10
|
.SH Options
|
|
29
|
-
.IP \
|
|
30
|
-
\f[
|
|
31
|
-
If you aren\
|
|
32
|
-
\f[
|
|
33
|
-
\f[
|
|
11
|
+
.IP \(bu 2
|
|
12
|
+
\f[CR]\-\-config\-file FILE\f[R]: Specify the config file to use.
|
|
13
|
+
If you aren\(cqt using the default config file at
|
|
14
|
+
\f[CR]\(ti/.gemstash/config.yml\f[R] or
|
|
15
|
+
\f[CR]\(ti/.gemstash/config.yml.erb\f[R], then you must specify the
|
|
34
16
|
config file via this option.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
4mgemstash-stop24m(1)
|
|
1
|
+
4mgemstash-stop24m(1) General Commands Manual 4mgemstash-stop24m(1)
|
|
2
2
|
|
|
3
3
|
1mName0m
|
|
4
4
|
gemstash-stop - Stops the Gemstash server
|
|
5
5
|
|
|
6
6
|
1mSynopsis0m
|
|
7
|
-
|
|
7
|
+
gemstash stop [--config-file FILE]
|
|
8
8
|
|
|
9
9
|
1mDescription0m
|
|
10
10
|
Stops the Gemstash server.
|
|
11
11
|
|
|
12
12
|
1mOptions0m
|
|
13
|
-
o
|
|
14
|
-
using the default config file at
|
|
15
|
-
|
|
13
|
+
o --config-file FILE: Specify the config file to use. If you aren't
|
|
14
|
+
using the default config file at ~/.gemstash/config.yml or ~/.gem-
|
|
15
|
+
stash/config.yml.erb, then you must specify the config file via this
|
|
16
16
|
option.
|
|
17
17
|
|
|
18
18
|
October 9, 2015 4mgemstash-stop24m(1)
|
|
@@ -1,36 +1,16 @@
|
|
|
1
|
-
.\" Automatically generated by Pandoc 3.
|
|
1
|
+
.\" Automatically generated by Pandoc 3.7.0.2
|
|
2
2
|
.\"
|
|
3
|
-
|
|
4
|
-
.\" that render this, and otherwise B font.
|
|
5
|
-
.ie "\f[CB]x\f[]"x" \{\
|
|
6
|
-
. ftr V B
|
|
7
|
-
. ftr VI BI
|
|
8
|
-
. ftr VB B
|
|
9
|
-
. ftr VBI BI
|
|
10
|
-
.\}
|
|
11
|
-
.el \{\
|
|
12
|
-
. ftr V CR
|
|
13
|
-
. ftr VI CI
|
|
14
|
-
. ftr VB CB
|
|
15
|
-
. ftr VBI CBI
|
|
16
|
-
.\}
|
|
17
|
-
.TH "gemstash-version" "1" "December 14, 2015" "" ""
|
|
18
|
-
.hy
|
|
3
|
+
.TH "gemstash\-version" "1" "December 14, 2015" ""
|
|
19
4
|
.SH Name
|
|
20
|
-
|
|
21
|
-
gemstash-version - Show what version of Gemstash you are using
|
|
5
|
+
gemstash\-version \- Show what version of Gemstash you are using
|
|
22
6
|
.SH Synopsis
|
|
23
|
-
|
|
24
|
-
\f[V]gemstash version\f[R]
|
|
7
|
+
\f[CR]gemstash version\f[R]
|
|
25
8
|
.SH Description
|
|
26
|
-
.PP
|
|
27
9
|
Show what version of Gemstash you are using.
|
|
28
10
|
.SS Usage
|
|
29
11
|
.IP
|
|
30
|
-
.
|
|
31
|
-
\f[C]
|
|
12
|
+
.EX
|
|
32
13
|
gemstash version
|
|
33
|
-
gemstash
|
|
34
|
-
gemstash
|
|
35
|
-
|
|
36
|
-
.fi
|
|
14
|
+
gemstash \-\-version
|
|
15
|
+
gemstash \-v
|
|
16
|
+
.EE
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
4mgemstash-version24m(1)
|
|
1
|
+
4mgemstash-version24m(1) General Commands Manual 4mgemstash-version24m(1)
|
|
2
2
|
|
|
3
3
|
1mName0m
|
|
4
4
|
gemstash-version - Show what version of Gemstash you are using
|
|
5
5
|
|
|
6
6
|
1mSynopsis0m
|
|
7
|
-
|
|
7
|
+
gemstash version
|
|
8
8
|
|
|
9
9
|
1mDescription0m
|
|
10
10
|
Show what version of Gemstash you are using.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "gemstash"
|
|
4
4
|
require "forwardable"
|
|
5
|
+
require "cgi"
|
|
5
6
|
|
|
6
7
|
module Gemstash
|
|
7
8
|
# Detects patterns in the Rack env variables related to URI and rewrites
|
|
@@ -35,6 +36,8 @@ module Gemstash
|
|
|
35
36
|
def rewrite
|
|
36
37
|
check_match
|
|
37
38
|
log_start = "Rewriting '#{@rack_env["REQUEST_URI"]}'"
|
|
39
|
+
log_start = log_start.sub(@request_uri_match["upstream_url"], "[REDACTED]") if
|
|
40
|
+
@request_uri_match.names.include?("upstream_url")
|
|
38
41
|
|
|
39
42
|
new_request_uri = @rack_env["REQUEST_URI"].dup
|
|
40
43
|
new_request_uri[@request_uri_match.begin(0)...@request_uri_match.end(0)] = ""
|
data/lib/gemstash/upstream.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "cgi"
|
|
3
4
|
require "digest"
|
|
4
5
|
require "forwardable"
|
|
5
6
|
require "uri"
|
|
@@ -14,9 +15,14 @@ module Gemstash
|
|
|
14
15
|
def_delegators :@uri, :scheme, :host, :to_s
|
|
15
16
|
|
|
16
17
|
def initialize(upstream, user_agent: nil)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
if upstream.is_a?(URI::Generic)
|
|
19
|
+
@uri = upstream.dup
|
|
20
|
+
else
|
|
21
|
+
url = upstream.to_s
|
|
22
|
+
url = CGI.unescape(url) if url.match?(/\Ahttps?%3A%2F%2F/i)
|
|
23
|
+
url = "https://#{url}" unless %r{^https?://}.match?(url)
|
|
24
|
+
@uri = URI(url)
|
|
25
|
+
end
|
|
20
26
|
@user_agent = user_agent
|
|
21
27
|
raise "URL '#{@uri}' is not valid!" unless @uri.to_s.match?(URI::DEFAULT_PARSER.make_regexp)
|
|
22
28
|
end
|
|
@@ -42,12 +48,83 @@ module Gemstash
|
|
|
42
48
|
@host_id ||= "#{host}_#{hash}"
|
|
43
49
|
end
|
|
44
50
|
|
|
51
|
+
# Cache records need a distinct source per credential, but not the credential itself.
|
|
52
|
+
def cache_uri
|
|
53
|
+
return to_s unless @uri.userinfo
|
|
54
|
+
|
|
55
|
+
clean = @uri.dup
|
|
56
|
+
clean.user = clean.password = nil
|
|
57
|
+
clean.fragment = host_id
|
|
58
|
+
identity = clean.to_s
|
|
59
|
+
identity.bytesize <= 191 ? identity : host_id
|
|
60
|
+
end
|
|
61
|
+
|
|
45
62
|
def user
|
|
46
|
-
|
|
63
|
+
return URI::DEFAULT_PARSER.unescape(@uri.user) if @uri.user
|
|
64
|
+
|
|
65
|
+
env_auth_user
|
|
47
66
|
end
|
|
48
67
|
|
|
49
68
|
def password
|
|
50
|
-
|
|
69
|
+
return URI::DEFAULT_PARSER.unescape(@uri.password) if @uri.user && @uri.password
|
|
70
|
+
return nil if @uri.user
|
|
71
|
+
|
|
72
|
+
env_auth_pass
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Whether +other+ is the same gem source: the scheme, host, port and path
|
|
76
|
+
# must match, while credentials and trailing slashes are ignored.
|
|
77
|
+
def same_source?(other)
|
|
78
|
+
source_key == other.source_key
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def allowed?(config)
|
|
82
|
+
allowed = Array(config[:allowed_upstreams])
|
|
83
|
+
allowed.include?("*") || [config[:rubygems_url], *allowed].any? do |url|
|
|
84
|
+
same_source?(Gemstash::Upstream.new(url))
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def self.allowed_redirect?(target, config)
|
|
89
|
+
return false if target.userinfo || !%w[http https].include?(target.scheme) || !target.hostname
|
|
90
|
+
|
|
91
|
+
path = URI::DEFAULT_PARSER.unescape(target.path)
|
|
92
|
+
return false if path.split("/").include?("..")
|
|
93
|
+
|
|
94
|
+
allowed = Array(config[:allowed_upstreams])
|
|
95
|
+
allowed.include?("*") || [config[:rubygems_url], *allowed, *Array(config[:allowed_redirects])].any? do |url|
|
|
96
|
+
source = Gemstash::Upstream.new(url)
|
|
97
|
+
upgrade = source.scheme == "http" && target.scheme == "https"
|
|
98
|
+
(target.scheme == source.scheme || upgrade) && target.hostname.downcase == source.uri.hostname.downcase &&
|
|
99
|
+
(target.port == source.uri.port || (upgrade && target.port == 443)) &&
|
|
100
|
+
path_within?(source.uri.path, target.path)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Whether +target_path+ is +source_path+ or lies below it, comparing whole
|
|
105
|
+
# segments. A source without a path covers its host, so nothing is confined.
|
|
106
|
+
def self.path_within?(source_path, target_path)
|
|
107
|
+
prefix = source_path.sub(%r{/+\z}, "").gsub(/%\h\h/, &:upcase).split("/", -1)
|
|
108
|
+
segments = target_path.gsub(/%\h\h/, &:upcase).split("/", -1)
|
|
109
|
+
return true if prefix.size <= 1
|
|
110
|
+
|
|
111
|
+
segments.first(prefix.size) == prefix && segments.drop(prefix.size).none? {|segment| ambiguous_segment?(segment) }
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# A segment that some servers resolve differently from how it reads: a dot
|
|
115
|
+
# segment (also behind a ";param" suffix), an escaped separator or control
|
|
116
|
+
# character, or a second layer of escaping.
|
|
117
|
+
def self.ambiguous_segment?(segment)
|
|
118
|
+
decoded = URI::DEFAULT_PARSER.unescape(segment)
|
|
119
|
+
decoded.sub(/;.*\z/m, "").match?(/\A\.\.?\z/) || decoded.match?(%r{[/\\\x00-\x1f\x7f]|%\h\h})
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
private_class_method :path_within?, :ambiguous_segment?
|
|
123
|
+
|
|
124
|
+
protected
|
|
125
|
+
|
|
126
|
+
def source_key
|
|
127
|
+
[scheme, host.to_s.downcase, @uri.port, @uri.path.sub(%r{/+\z}, ""), @uri.query]
|
|
51
128
|
end
|
|
52
129
|
|
|
53
130
|
private
|
|
@@ -93,7 +170,7 @@ module Gemstash
|
|
|
93
170
|
end
|
|
94
171
|
|
|
95
172
|
def name
|
|
96
|
-
@name ||= @id.gsub(/\.gem(spec\.rz)
|
|
173
|
+
@name ||= @id.gsub(/\.gem(spec\.rz)?\z/, "")
|
|
97
174
|
end
|
|
98
175
|
end
|
|
99
176
|
end
|
data/lib/gemstash/version.rb
CHANGED
data/lib/gemstash/web.rb
CHANGED
|
@@ -35,6 +35,18 @@ module Gemstash
|
|
|
35
35
|
body JSON.dump("error" => "Version already exists", "code" => 422)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
error Gemstash::WebError do
|
|
39
|
+
error = env["sinatra.error"]
|
|
40
|
+
code = error.code == 404 ? 404 : 502
|
|
41
|
+
Gemstash::Logging.logger.warn("Upstream request failed (HTTP #{error.code})")
|
|
42
|
+
status code
|
|
43
|
+
body JSON.dump("error" => "Upstream request failed", "code" => code)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def dump_errors!(error)
|
|
47
|
+
super unless error.is_a?(Gemstash::WebError)
|
|
48
|
+
end
|
|
49
|
+
|
|
38
50
|
get "/" do
|
|
39
51
|
@gem_source.serve_root
|
|
40
52
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gemstash
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andre Arko
|
|
@@ -38,7 +38,7 @@ dependencies:
|
|
|
38
38
|
version: 3.2.3
|
|
39
39
|
- - "<"
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '
|
|
41
|
+
version: '6'
|
|
42
42
|
type: :runtime
|
|
43
43
|
prerelease: false
|
|
44
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -48,7 +48,7 @@ dependencies:
|
|
|
48
48
|
version: 3.2.3
|
|
49
49
|
- - "<"
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
|
-
version: '
|
|
51
|
+
version: '6'
|
|
52
52
|
- !ruby/object:Gem::Dependency
|
|
53
53
|
name: faraday
|
|
54
54
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -120,7 +120,7 @@ dependencies:
|
|
|
120
120
|
version: '6.1'
|
|
121
121
|
- - "<"
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: '
|
|
123
|
+
version: '9.0'
|
|
124
124
|
type: :runtime
|
|
125
125
|
prerelease: false
|
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -130,7 +130,7 @@ dependencies:
|
|
|
130
130
|
version: '6.1'
|
|
131
131
|
- - "<"
|
|
132
132
|
- !ruby/object:Gem::Version
|
|
133
|
-
version: '
|
|
133
|
+
version: '9.0'
|
|
134
134
|
- !ruby/object:Gem::Dependency
|
|
135
135
|
name: sequel
|
|
136
136
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -332,14 +332,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
332
332
|
requirements:
|
|
333
333
|
- - ">="
|
|
334
334
|
- !ruby/object:Gem::Version
|
|
335
|
-
version: '3.
|
|
335
|
+
version: '3.3'
|
|
336
336
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
337
|
requirements:
|
|
338
338
|
- - ">="
|
|
339
339
|
- !ruby/object:Gem::Version
|
|
340
340
|
version: '0'
|
|
341
341
|
requirements: []
|
|
342
|
-
rubygems_version:
|
|
342
|
+
rubygems_version: 4.0.20
|
|
343
343
|
specification_version: 4
|
|
344
344
|
summary: A place to stash gems you'll need
|
|
345
345
|
test_files: []
|