test-gem-push 2023.03.17.15.11.33 → 2023.05.07.22.42.59
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app.rb +12 -12
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bccefc8f1b3047dcdf8987dc8dcb9282c9be8f23db7babe19d5d1e9bf0668715
|
4
|
+
data.tar.gz: 447f6e4db2f4cababbea144807cb770444d568024874cb0eef9e648ea596d387
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfbd2b3cae271ae5e7118a91c270c218feb51ed8fab004712620f77970b540576c4abadf89628e33d02bdc28cdf1ddb8fbe8b5e0d598d4597597a7675d651ca9
|
7
|
+
data.tar.gz: d1da1f37645c9015d0fcb019ef228a7f069155b080f00bef601976c5bcf196a4b5a8ed95468725cff9f564dacae2708684154d471ba0fe04d54f60f0a5a11b51
|
data/app.rb
CHANGED
@@ -13,14 +13,13 @@ Gem.configuration.rubygems_api_key = ENV.fetch('RUBYGEMS_API_KEY')
|
|
13
13
|
TOKEN = ENV.fetch('TOKEN')
|
14
14
|
|
15
15
|
def get_json(host, path)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
raise "Failed to load JSON from #{host}/#{path}:\n#{json}"
|
16
|
+
resp = Net::HTTP.get_response(host, path, 443)
|
17
|
+
JSON.load(resp.body)
|
18
|
+
rescue => e
|
19
|
+
raise "Failed to load JSON from #{host}#{path}:\n#{e.class}: #{e}\n#{resp.inspect}"
|
21
20
|
end
|
22
21
|
|
23
|
-
def push!(name, version, platform)
|
22
|
+
def push!(name, version, platform, push_host)
|
24
23
|
spec = Gem::Specification.new do |s|
|
25
24
|
s.name = name
|
26
25
|
s.version = version
|
@@ -31,9 +30,10 @@ def push!(name, version, platform)
|
|
31
30
|
s.required_ruby_version = '~> 2.0'
|
32
31
|
s.required_rubygems_version = '~> 2.6'
|
33
32
|
s.add_dependency 'foo', '~> 1.0'
|
33
|
+
s.metadata = { 'allowed_push_host' => push_host }
|
34
34
|
end
|
35
35
|
file = Gem::Package.build(spec)
|
36
|
-
Gem::Commands::PushCommand.new.send_gem(file)
|
36
|
+
Gem::Commands::PushCommand.new.tap { |c| c.options[:host] = push_host }.send_gem(file)
|
37
37
|
ensure
|
38
38
|
File.delete(file)
|
39
39
|
end
|
@@ -54,20 +54,20 @@ post '/' do
|
|
54
54
|
halt 401, 'token does not match' unless TOKEN == params['token']
|
55
55
|
|
56
56
|
version = params.fetch('version') { Time.now.strftime('%Y.%m.%d.%H.%M.%S') }
|
57
|
-
gem_name = ENV.fetch('GEM_NAME')
|
57
|
+
gem_name = params.fetch('name') { ENV.fetch('GEM_NAME') }
|
58
58
|
platform = params.fetch('platform') { 'ruby' }
|
59
59
|
platform_string = platform == 'ruby' ? '' : "-#{platform}"
|
60
60
|
|
61
|
-
dependency_endpoint = get_dependency_api(gem_name)
|
62
|
-
versions = get_versions.lines
|
63
|
-
info = get_info(gem_name).lines
|
61
|
+
# dependency_endpoint = get_dependency_api(gem_name)
|
62
|
+
# versions = get_versions.lines
|
63
|
+
# info = get_info(gem_name).lines
|
64
64
|
|
65
65
|
# if dependency_endpoint.find { |g| g['version'] == version && g['platform'] == platform }
|
66
66
|
# halt 422, "#{gem_name}-#{version}-#{platform} already was pushed"
|
67
67
|
# end
|
68
68
|
|
69
69
|
begin
|
70
|
-
push!(gem_name, version, platform)
|
70
|
+
push!(gem_name, version, platform, params.fetch('push_host') { 'https://staging.rubygems.org' })
|
71
71
|
rescue Gem::SystemExitException
|
72
72
|
halt 500, "Failed to push: #{$ERROR_INFO}"
|
73
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-gem-push
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2023.
|
4
|
+
version: 2023.05.07.22.42.59
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- example@example.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foo
|
@@ -33,7 +33,8 @@ files:
|
|
33
33
|
- app.rb
|
34
34
|
homepage:
|
35
35
|
licenses: []
|
36
|
-
metadata:
|
36
|
+
metadata:
|
37
|
+
allowed_push_host: https://rubygems.org
|
37
38
|
post_install_message:
|
38
39
|
rdoc_options: []
|
39
40
|
require_paths:
|
@@ -49,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
50
|
- !ruby/object:Gem::Version
|
50
51
|
version: '2.6'
|
51
52
|
requirements: []
|
52
|
-
rubygems_version: 3.4.
|
53
|
+
rubygems_version: 3.4.10
|
53
54
|
signing_key:
|
54
55
|
specification_version: 4
|
55
56
|
summary: test
|