gemstash 2.2.2 → 2.7.1
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/CHANGELOG.md +61 -17
- data/lib/gemstash/authorization.rb +5 -2
- data/lib/gemstash/cli/authorize.rb +42 -1
- data/lib/gemstash/cli/setup.rb +2 -2
- data/lib/gemstash/cli/start.rb +5 -25
- data/lib/gemstash/cli.rb +6 -2
- data/lib/gemstash/config.ru +0 -2
- data/lib/gemstash/configuration.rb +5 -0
- data/lib/gemstash/db/authorization.rb +3 -3
- data/lib/gemstash/env.rb +0 -11
- data/lib/gemstash/gem_source/upstream_source.rb +15 -0
- data/lib/gemstash/logging.rb +14 -2
- data/lib/gemstash/man/gemstash-authorize.1 +21 -33
- data/lib/gemstash/man/gemstash-authorize.1.txt +20 -16
- data/lib/gemstash/man/gemstash-configuration.5 +61 -119
- data/lib/gemstash/man/gemstash-configuration.5.txt +58 -65
- data/lib/gemstash/man/gemstash-customize.7 +60 -103
- data/lib/gemstash/man/gemstash-customize.7.txt +52 -56
- data/lib/gemstash/man/gemstash-debugging.7 +11 -31
- data/lib/gemstash/man/gemstash-debugging.7.txt +8 -13
- data/lib/gemstash/man/gemstash-deploy.7 +15 -39
- data/lib/gemstash/man/gemstash-deploy.7.txt +18 -22
- data/lib/gemstash/man/gemstash-mirror.7 +10 -31
- data/lib/gemstash/man/gemstash-mirror.7.txt +6 -10
- data/lib/gemstash/man/gemstash-multiple-sources.7 +72 -44
- data/lib/gemstash/man/gemstash-multiple-sources.7.txt +66 -22
- data/lib/gemstash/man/gemstash-private-gems.7 +51 -102
- data/lib/gemstash/man/gemstash-private-gems.7.txt +35 -39
- data/lib/gemstash/man/gemstash-readme.7 +42 -88
- data/lib/gemstash/man/gemstash-readme.7.txt +43 -48
- data/lib/gemstash/man/gemstash-setup.1 +13 -33
- data/lib/gemstash/man/gemstash-setup.1.txt +13 -17
- data/lib/gemstash/man/gemstash-start.1 +5 -29
- data/lib/gemstash/man/gemstash-start.1.txt +6 -14
- data/lib/gemstash/man/gemstash-status.1 +5 -23
- data/lib/gemstash/man/gemstash-status.1.txt +6 -10
- data/lib/gemstash/man/gemstash-stop.1 +5 -23
- data/lib/gemstash/man/gemstash-stop.1.txt +6 -10
- data/lib/gemstash/man/gemstash-version.1 +4 -24
- data/lib/gemstash/man/gemstash-version.1.txt +3 -7
- data/lib/gemstash/migrations/05_authorization_names.rb +10 -0
- data/lib/gemstash/upstream.rb +33 -2
- data/lib/gemstash/version.rb +1 -1
- data/lib/gemstash.rb +1 -0
- metadata +35 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd46773c2778aa8664f4972184d669f2c92a6b8c5a2bef94353e86f86f407a4d
|
4
|
+
data.tar.gz: 4aa4859b8283f044b335e009ad6264538ff980c1b7c1be8279e3fd084d9cf1f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a8754257c4884e036c475621ebd6e2ca80033031494ca4f744ac4683cdabf5fba8c58e9ec9c5221f28d98fa5d4e699d400b7c3a80acb720e4fd939a6ba72671
|
7
|
+
data.tar.gz: 42f293520533a0681bbf558209c10748052938664dd51bb598f28e4bf8f52d49a781a0644b1ac4f65d6b76989fb7a2865f230eb5b5b9d50889ca4579ed02f795
|
data/CHANGELOG.md
CHANGED
@@ -1,29 +1,81 @@
|
|
1
|
+
## 2.7.1 (2023-10-12)
|
2
|
+
|
3
|
+
### Fixes
|
4
|
+
|
5
|
+
- Reinstate NOOP --daemonize and --no-daemonize that warn about them doing nothing. ([#381](https://github.com/rubygems/gemstash/pull/381) [@olleolleolle](https://github.com/olleolleolle))
|
6
|
+
|
7
|
+
## 2.7.0 (2023-10-08)
|
8
|
+
|
9
|
+
### Fixes
|
10
|
+
|
11
|
+
- Fix uninitialized constant error when using Redis cache ([#375](https://github.com/rubygems/gemstash/pull/375), [@chris72205](https://github.com/chris72205))
|
12
|
+
- Remove --daemonize option, no longer supported by Puma. ([#359](https://github.com/rubygems/gemstash/issues/359) [@olleolleolle](https://github.com/olleolleolle))
|
13
|
+
|
14
|
+
## 2.6.0 (2023-09-30)
|
15
|
+
|
16
|
+
### Changes
|
17
|
+
|
18
|
+
- Support `GEMSTASH_CONFIG` environment variable ([#369](https://github.com/rubygems/gemstash/pull/369), [@kyrofa](https://github.com/kyrofa))
|
19
|
+
|
20
|
+
## 2.5.0 (2023-09-28)
|
21
|
+
|
22
|
+
### Changes
|
23
|
+
|
24
|
+
- Add support for upstream auth with ENV variables ([#339](https://github.com/rubygems/gemstash/pull/339), [@CiTroNaK](https://github.com/CiTroNaK))
|
25
|
+
|
26
|
+
## 2.4.0 (2023-09-27)
|
27
|
+
|
28
|
+
### Changes
|
29
|
+
|
30
|
+
- Support naming and listing authorizations ([#365](https://github.com/rubygems/gemstash/pull/365), [@kyrofa](https://github.com/kyrofa))
|
31
|
+
|
32
|
+
## 2.3.2 (2023-09-14)
|
33
|
+
|
34
|
+
### Fixes
|
35
|
+
|
36
|
+
- Require a now-needed file for Puma 6. Thanks, @ktreis! ([#362](https://github.com/rubygems/gemstash/pull/362), [@olleolleolle](https://github.com/olleolleolle))
|
37
|
+
|
38
|
+
## 2.3.1 (2023-09-05)
|
39
|
+
|
40
|
+
### Fixes
|
41
|
+
|
42
|
+
- Reinstate Ruby Central in README. ([#353](https://github.com/rubygems/gemstash/pull/353), [@olleolleolle](https://github.com/olleolleolle))
|
43
|
+
- Implement Puma 5-required logger method `#sync` ([#355](https://github.com/rubygems/gemstash/pull/355), [@ball-hayden](https://github.com/ball-hayden))
|
44
|
+
|
45
|
+
## 2.3.0 (2023-08-30)
|
46
|
+
|
47
|
+
### Changes
|
48
|
+
|
49
|
+
- Support Puma 6. ([#335](https://github.com/rubygems/gemstash/pull/335), [@MSP-Greg](https://github.com/MSP-Greg))
|
50
|
+
- Make UpstreamSource intermediate specs from upstream. ([#337](https://github.com/rubygems/gemstash/pull/337), [@tedgarb](https://github.com/tedgarb))
|
51
|
+
- Mention RubyCentral. ([#338](https://github.com/rubygems/gemstash/pull/338), [@adarsh](https://github.com/adarsh))
|
52
|
+
- Configure Dependabot. ([#341](https://github.com/rubygems/gemstash/pull/341), [@olleolleolle](https://github.com/olleolleolle))
|
53
|
+
|
1
54
|
## 2.2.2 (2023-03-03)
|
2
55
|
|
3
56
|
### Changes
|
4
57
|
|
5
|
-
- Allow newer versions of the `activesupport` dependency ([#332](https://github.com/rubygems/gemstash/pull/332), [@kyrofa]
|
58
|
+
- Allow newer versions of the `activesupport` dependency ([#332](https://github.com/rubygems/gemstash/pull/332), [@kyrofa](https://github.com/kyrofa))
|
6
59
|
|
7
60
|
## 2.2.1 (2023-02-09)
|
8
61
|
|
9
62
|
### Bugfixes
|
10
63
|
|
11
|
-
- Add permitted classes to a `YAML.load` in cache ([#329](https://github.com/rubygems/gemstash/pull/329), [@SocalNick]
|
64
|
+
- Add permitted classes to a `YAML.load` in cache ([#329](https://github.com/rubygems/gemstash/pull/329), [@SocalNick](https://github.com/SocialNick))
|
12
65
|
|
13
66
|
## 2.2.0 (2023-01-27)
|
14
67
|
|
15
68
|
### Bugfixes
|
16
69
|
|
17
|
-
- Respect auth set in upstream host uri ([#317](https://github.com/rubygems/gemstash/pull/317), [@jebentier]
|
18
|
-
- Change the response code for "/versions" from 403 to 404 ([#326](https://github.com/rubygems/gemstash/pull/326), [@hendric-dev]
|
70
|
+
- Respect auth set in upstream host uri ([#317](https://github.com/rubygems/gemstash/pull/317), [@jebentier](https://github.com/jbentier))
|
71
|
+
- Change the response code for "/versions" from 403 to 404 ([#326](https://github.com/rubygems/gemstash/pull/326), [@hendric-dev](https://github.com/hendric-dev))
|
19
72
|
|
20
73
|
### Changes
|
21
74
|
|
22
|
-
- Support Ruby 3 ([#312](https://github.com/rubygems/gemstash/pull/312), [@tonytonyjan]
|
23
|
-
- Drop support for EOL Ruby versions 2.4, 2.5, 2.6 ([#328](https://github.com/rubygems/gemstash/pull/328), [@indirect]
|
24
|
-
- Update `dalli` dependency ([#324](https://github.com/rubygems/gemstash/pull/324), [@indirect]
|
25
|
-
|
26
|
-
Also thanks to: [@indirect][] and [@hsbt][] who fixed CI issues and lint warnings.
|
75
|
+
- Support Ruby 3 ([#312](https://github.com/rubygems/gemstash/pull/312), [@tonytonyjan](https://github.com/tonytonyjan))
|
76
|
+
- Drop support for EOL Ruby versions 2.4, 2.5, 2.6 ([#328](https://github.com/rubygems/gemstash/pull/328), [@indirect](https://github.com/indirect))
|
77
|
+
- Update `dalli` dependency ([#324](https://github.com/rubygems/gemstash/pull/324), [@indirect](https://github.com/indirect))
|
78
|
+
- Also thanks to: [@indirect][] and [@hsbt][] who fixed CI issues and lint warnings.
|
27
79
|
|
28
80
|
## 2.1.0 (2020-02-26)
|
29
81
|
|
@@ -262,11 +314,3 @@ Also thanks to: [@indirect][] and [@hsbt][] who fixed CI issues and lint warning
|
|
262
314
|
- Various fixes 2 ([#47](https://github.com/bundler/gemstash/pull/47), [@smellsblue](https://github.com/smellsblue))
|
263
315
|
- Various fixes 3 ([#49](https://github.com/bundler/gemstash/pull/49), [@smellsblue](https://github.com/smellsblue))
|
264
316
|
- Add Gemtash logo ([#50](https://github.com/bundler/gemstash/pull/50), [@jonathanrieta](https://github.com/jonathanrieta))
|
265
|
-
|
266
|
-
[@SocalNick]: https://github.com/SocalNick
|
267
|
-
[@hendric-dev]: https://github.com/hendric-dev
|
268
|
-
[@hsbt]: https://github.com/hsbt
|
269
|
-
[@indirect]: https://github.com/indirect
|
270
|
-
[@jebentier]: https://github.com/jebentier
|
271
|
-
[@kyrofa]: https://github.com/kyrofa
|
272
|
-
[@tonytonyjan]: https://github.com/tonytonyjan
|
@@ -13,7 +13,9 @@ module Gemstash
|
|
13
13
|
extend Gemstash::Logging
|
14
14
|
VALID_PERMISSIONS = %w[push yank fetch].freeze
|
15
15
|
|
16
|
-
|
16
|
+
attr_reader :name
|
17
|
+
|
18
|
+
def self.authorize(auth_key, permissions, name = nil)
|
17
19
|
raise "Authorization key is required!" if auth_key.to_s.strip.empty?
|
18
20
|
raise "Permissions are required!" if permissions.to_s.empty?
|
19
21
|
|
@@ -25,7 +27,7 @@ module Gemstash
|
|
25
27
|
permissions = permissions.join(",")
|
26
28
|
end
|
27
29
|
|
28
|
-
Gemstash::DB::Authorization.insert_or_update(auth_key, permissions)
|
30
|
+
Gemstash::DB::Authorization.insert_or_update(auth_key, permissions, name)
|
29
31
|
gemstash_env.cache.invalidate_authorization(auth_key)
|
30
32
|
log.info "Authorization '#{auth_key}' updated with access to '#{permissions}'"
|
31
33
|
end
|
@@ -62,6 +64,7 @@ module Gemstash
|
|
62
64
|
|
63
65
|
def initialize(record)
|
64
66
|
@auth_key = record.auth_key
|
67
|
+
@name = record.name
|
65
68
|
@all = record.permissions == "all"
|
66
69
|
@permissions = Set.new(record.permissions.split(","))
|
67
70
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "gemstash"
|
4
4
|
require "securerandom"
|
5
|
+
require "terminal-table"
|
5
6
|
|
6
7
|
module Gemstash
|
7
8
|
class CLI
|
@@ -12,8 +13,13 @@ module Gemstash
|
|
12
13
|
prepare
|
13
14
|
setup_logging
|
14
15
|
|
16
|
+
# Catch invalid option combinations
|
17
|
+
raise Gemstash::CLI::Error.new(@cli, "--remove and --list cannot both be used") if @cli.options[:remove] && @cli.options[:list]
|
18
|
+
|
15
19
|
if @cli.options[:remove]
|
16
20
|
remove_authorization
|
21
|
+
elsif @cli.options[:list]
|
22
|
+
list_authorizations
|
17
23
|
else
|
18
24
|
save_authorization
|
19
25
|
end
|
@@ -26,6 +32,8 @@ module Gemstash
|
|
26
32
|
end
|
27
33
|
|
28
34
|
def remove_authorization
|
35
|
+
raise Gemstash::CLI::Error.new(@cli, "--name cannot be used with --remove") if @cli.options[:remove] && @cli.options[:name]
|
36
|
+
|
29
37
|
unless @args.empty?
|
30
38
|
raise Gemstash::CLI::Error.new(@cli, "To remove individual permissions, you do not need --remove
|
31
39
|
Instead just authorize with the new set of permissions")
|
@@ -43,7 +51,24 @@ Instead just authorize with the new set of permissions")
|
|
43
51
|
end
|
44
52
|
end
|
45
53
|
|
46
|
-
|
54
|
+
begin
|
55
|
+
name = @cli.options[:name]
|
56
|
+
Gemstash::Authorization.authorize(auth_key, permissions, name)
|
57
|
+
rescue Sequel::UniqueConstraintViolation => e
|
58
|
+
raise unless name && e.message.include?("authorizations.name")
|
59
|
+
|
60
|
+
raise Gemstash::CLI::Error.new(@cli, "Authorization with name '#{name}' already exists")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def list_authorizations
|
65
|
+
raise Gemstash::CLI::Error.new(@cli, "--key and --name cannot both be used with --list") if @cli.options[:name] && @cli.options[:key]
|
66
|
+
|
67
|
+
rows = map_authorizations(@cli.options[:key], @cli.options[:name]) do |authorization|
|
68
|
+
[authorization.name, authorization.auth_key, authorization.permissions]
|
69
|
+
end
|
70
|
+
|
71
|
+
@cli.say Terminal::Table.new :headings => %w[Name Key Permissions], :rows => rows
|
47
72
|
end
|
48
73
|
|
49
74
|
def auth_key(allow_generate: true)
|
@@ -66,6 +91,22 @@ Instead just authorize with the new set of permissions")
|
|
66
91
|
@args
|
67
92
|
end
|
68
93
|
end
|
94
|
+
|
95
|
+
def map_authorizations(key = nil, name = nil, &block)
|
96
|
+
return Gemstash::DB::Authorization.map(&block) unless name || key
|
97
|
+
|
98
|
+
authorization = if name
|
99
|
+
Gemstash::DB::Authorization[name: name].tap do |authorization|
|
100
|
+
raise Gemstash::CLI::Error.new(@cli, "No authorization named '#{name}'") unless authorization
|
101
|
+
end
|
102
|
+
else
|
103
|
+
Gemstash::DB::Authorization[auth_key: key].tap do |authorization|
|
104
|
+
raise Gemstash::CLI::Error.new(@cli, "No authorization with key '#{key}'") unless authorization
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
[yield(authorization)]
|
109
|
+
end
|
69
110
|
end
|
70
111
|
end
|
71
112
|
end
|
data/lib/gemstash/cli/setup.rb
CHANGED
@@ -90,8 +90,8 @@ module Gemstash
|
|
90
90
|
|
91
91
|
def ask_redis_details
|
92
92
|
say_current_config(:redis_servers, "Current Redis servers")
|
93
|
-
servers = @cli.ask "What is the comma-separated list of Redis servers? [localhost:6379]"
|
94
|
-
servers = "localhost:6379" if servers.empty?
|
93
|
+
servers = @cli.ask "What is the comma-separated list of Redis servers? [redis://localhost:6379]"
|
94
|
+
servers = "redis://localhost:6379" if servers.empty?
|
95
95
|
@config[:redis_servers] = servers
|
96
96
|
end
|
97
97
|
|
data/lib/gemstash/cli/start.rb
CHANGED
@@ -10,47 +10,27 @@ module Gemstash
|
|
10
10
|
class Start < Gemstash::CLI::Base
|
11
11
|
def run
|
12
12
|
prepare
|
13
|
-
setup_logging
|
14
|
-
store_daemonized
|
15
13
|
@cli.say("Starting gemstash!", :green)
|
14
|
+
case @cli.options[:daemonize]
|
15
|
+
when false then warn "The --no-daemonize option was removed and has no effect."
|
16
|
+
when true then warn "The --daemonize option was removed and has no effect."
|
17
|
+
end
|
16
18
|
Puma::CLI.new(args, Gemstash::Logging::StreamLogger.puma_events).run
|
17
19
|
end
|
18
20
|
|
19
21
|
private
|
20
22
|
|
21
|
-
def setup_logging
|
22
|
-
return unless daemonize?
|
23
|
-
|
24
|
-
Gemstash::Logging.setup_logger(gemstash_env.log_file)
|
25
|
-
end
|
26
|
-
|
27
|
-
def store_daemonized
|
28
|
-
Gemstash::Env.daemonized = daemonize?
|
29
|
-
end
|
30
|
-
|
31
|
-
def daemonize?
|
32
|
-
@cli.options[:daemonize]
|
33
|
-
end
|
34
|
-
|
35
23
|
def puma_config
|
36
24
|
File.expand_path("../puma.rb", __dir__)
|
37
25
|
end
|
38
26
|
|
39
27
|
def args
|
40
|
-
config_args + pidfile_args
|
28
|
+
config_args + pidfile_args
|
41
29
|
end
|
42
30
|
|
43
31
|
def config_args
|
44
32
|
["--config", puma_config]
|
45
33
|
end
|
46
|
-
|
47
|
-
def daemonize_args
|
48
|
-
if daemonize?
|
49
|
-
["--daemon"]
|
50
|
-
else
|
51
|
-
[]
|
52
|
-
end
|
53
|
-
end
|
54
34
|
end
|
55
35
|
end
|
56
36
|
end
|
data/lib/gemstash/cli.rb
CHANGED
@@ -51,10 +51,14 @@ module Gemstash
|
|
51
51
|
desc "authorize [PERMISSIONS...]", "Add authorizations to push/yank private gems"
|
52
52
|
method_option :remove, :type => :boolean, :default => false, :desc =>
|
53
53
|
"Remove an authorization key"
|
54
|
+
method_option :list, :type => :boolean, :default => false, :desc =>
|
55
|
+
"List existing authorization keys"
|
54
56
|
method_option :config_file, :type => :string, :desc =>
|
55
57
|
"Config file to save to"
|
56
58
|
method_option :key, :type => :string, :desc =>
|
57
59
|
"Authorization key to create/update/delete (optional unless deleting)"
|
60
|
+
method_option :name, :type => :string, :desc =>
|
61
|
+
"Name of the key (optional)"
|
58
62
|
def authorize(*args)
|
59
63
|
Gemstash::CLI::Authorize.new(self, *args).run
|
60
64
|
end
|
@@ -71,8 +75,8 @@ module Gemstash
|
|
71
75
|
end
|
72
76
|
|
73
77
|
desc "start", "Starts your gemstash server"
|
74
|
-
method_option :daemonize, :type => :boolean, :default =>
|
75
|
-
|
78
|
+
method_option :daemonize, :type => :boolean, :default => nil, :desc =>
|
79
|
+
"No effect - functionality removed, option kept for compatibility"
|
76
80
|
method_option :config_file, :type => :string, :desc =>
|
77
81
|
"Config file to load when starting"
|
78
82
|
def start
|
data/lib/gemstash/config.ru
CHANGED
@@ -6,8 +6,6 @@ require "puma/commonlogger"
|
|
6
6
|
use Rack::Deflater
|
7
7
|
use Gemstash::Logging::RackMiddleware
|
8
8
|
|
9
|
-
use Puma::CommonLogger, Gemstash::Logging::StreamLogger.for_stdout if Gemstash::Env.daemonized?
|
10
|
-
|
11
9
|
use Gemstash::Env::RackMiddleware, Gemstash::Env.current
|
12
10
|
use Gemstash::GemSource::RackMiddleware
|
13
11
|
use Gemstash::Health::RackMiddleware
|
@@ -75,6 +75,11 @@ module Gemstash
|
|
75
75
|
private
|
76
76
|
|
77
77
|
def default_file
|
78
|
+
# Support the config file being specified via environment variable
|
79
|
+
gemstash_config = ENV["GEMSTASH_CONFIG"]
|
80
|
+
return gemstash_config if gemstash_config
|
81
|
+
|
82
|
+
# If no environment variable is used, fall back to the normal defaults
|
78
83
|
File.exist?("#{DEFAULT_FILE}.erb") ? "#{DEFAULT_FILE}.erb" : DEFAULT_FILE
|
79
84
|
end
|
80
85
|
|
@@ -6,14 +6,14 @@ module Gemstash
|
|
6
6
|
module DB
|
7
7
|
# Sequel model for authorizations table.
|
8
8
|
class Authorization < Sequel::Model
|
9
|
-
def self.insert_or_update(auth_key, permissions)
|
9
|
+
def self.insert_or_update(auth_key, permissions, name = nil)
|
10
10
|
db.transaction do
|
11
11
|
record = self[auth_key: auth_key]
|
12
12
|
|
13
13
|
if record
|
14
|
-
record.update(permissions: permissions)
|
14
|
+
record.update(permissions: permissions, name: name)
|
15
15
|
else
|
16
|
-
create(auth_key: auth_key, permissions: permissions)
|
16
|
+
create(auth_key: auth_key, permissions: permissions, name: name)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/gemstash/env.rb
CHANGED
@@ -59,17 +59,6 @@ module Gemstash
|
|
59
59
|
Thread.current[:gemstash_env] = value
|
60
60
|
end
|
61
61
|
|
62
|
-
def self.daemonized?
|
63
|
-
raise "Daemonized hasn't been set yet!" if @daemonized.nil?
|
64
|
-
|
65
|
-
@daemonized
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.daemonized=(value)
|
69
|
-
value = false if value.nil?
|
70
|
-
@daemonized = value
|
71
|
-
end
|
72
|
-
|
73
62
|
def config
|
74
63
|
@config ||= Gemstash::Configuration.new
|
75
64
|
end
|
@@ -128,6 +128,21 @@ module Gemstash
|
|
128
128
|
serve_cached(id, :gem)
|
129
129
|
end
|
130
130
|
|
131
|
+
def serve_latest_specs
|
132
|
+
http_client = http_client_for(upstream)
|
133
|
+
http_client.get("latest_specs.4.8.gz")
|
134
|
+
end
|
135
|
+
|
136
|
+
def serve_prerelease_specs
|
137
|
+
http_client = http_client_for(upstream)
|
138
|
+
http_client.get("prerelease_specs.4.8.gz")
|
139
|
+
end
|
140
|
+
|
141
|
+
def serve_specs
|
142
|
+
http_client = http_client_for(upstream)
|
143
|
+
http_client.get("specs.4.8.gz")
|
144
|
+
end
|
145
|
+
|
131
146
|
private
|
132
147
|
|
133
148
|
def serve_cached(id, resource_type)
|
data/lib/gemstash/logging.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "logger"
|
4
|
-
|
4
|
+
|
5
|
+
begin
|
6
|
+
require "puma/detect"
|
7
|
+
require "puma/log_writer" # Puma 6
|
8
|
+
rescue LoadError
|
9
|
+
require "puma/events"
|
10
|
+
end
|
5
11
|
|
6
12
|
module Gemstash
|
7
13
|
# :nodoc:
|
@@ -62,7 +68,9 @@ module Gemstash
|
|
62
68
|
# Logger that looks like a stream, for Puma and Rack to log to.
|
63
69
|
class StreamLogger
|
64
70
|
def self.puma_events
|
65
|
-
Puma
|
71
|
+
# Puma 6 removed logging from Events and placed it in LogWriter
|
72
|
+
klass = Puma.const_defined?(:LogWriter) ? Puma::LogWriter : Puma::Events
|
73
|
+
klass.new(for_stdout, for_stderr)
|
66
74
|
end
|
67
75
|
|
68
76
|
def self.for_stdout
|
@@ -81,6 +89,10 @@ module Gemstash
|
|
81
89
|
|
82
90
|
def sync=(_value); end
|
83
91
|
|
92
|
+
def sync
|
93
|
+
false
|
94
|
+
end
|
95
|
+
|
84
96
|
def write(message)
|
85
97
|
Gemstash::Logging.logger.add(@level, message)
|
86
98
|
end
|
@@ -1,66 +1,54 @@
|
|
1
1
|
<!-- Automatically generated by Pandoc -->
|
2
|
-
.\" Automatically generated by Pandoc 3.1
|
2
|
+
.\" Automatically generated by Pandoc 3.1.8
|
3
3
|
.\"
|
4
|
-
.\" Define V font for inline verbatim, using C font in formats
|
5
|
-
.\" that render this, and otherwise B font.
|
6
|
-
.ie "\f[CB]x\f[]"x" \{\
|
7
|
-
. ftr V B
|
8
|
-
. ftr VI BI
|
9
|
-
. ftr VB B
|
10
|
-
. ftr VBI BI
|
11
|
-
.\}
|
12
|
-
.el \{\
|
13
|
-
. ftr V CR
|
14
|
-
. ftr VI CI
|
15
|
-
. ftr VB CB
|
16
|
-
. ftr VBI CBI
|
17
|
-
.\}
|
18
4
|
.TH "gemstash-authorize" "1" "October 9, 2015" "" ""
|
19
|
-
.hy
|
20
5
|
.SH Name
|
21
|
-
.PP
|
22
6
|
gemstash-authorize - Adds or removes authorization to interact with
|
23
7
|
privately stored gems
|
24
8
|
.SH Synopsis
|
25
|
-
|
26
|
-
\f[V]gemstash authorize [permissions] [--remove] [--key SECURE_KEY] [--config-file FILE]\f[R]
|
9
|
+
\f[CR]gemstash authorize [permissions] [--remove] [--list] [--key SECURE_KEY] [--name NAME] [--config-file FILE]\f[R]
|
27
10
|
.SH Description
|
28
|
-
.PP
|
29
11
|
Adds or removes authorization to interact with privately stored gems.
|
30
12
|
.PP
|
31
13
|
Any arguments will be used as specific permissions.
|
32
|
-
Valid permissions include \f[
|
33
|
-
\f[
|
14
|
+
Valid permissions include \f[CR]push\f[R], \f[CR]yank\f[R], and
|
15
|
+
\f[CR]fetch\f[R].
|
34
16
|
If no permissions are provided, then all permissions will be granted
|
35
17
|
(including any that may be added in future versions of Gemstash).
|
36
18
|
.SS Usage
|
37
19
|
.IP
|
38
|
-
.
|
39
|
-
\f[C]
|
20
|
+
.EX
|
40
21
|
gemstash authorize
|
41
22
|
gemstash authorize push yank
|
23
|
+
gemstash authorize push --name my-auth
|
42
24
|
gemstash authorize yank --key <secure-key>
|
43
25
|
gemstash authorize --remove --key <secure-key>
|
44
|
-
|
45
|
-
.
|
26
|
+
gemstash authorize --list
|
27
|
+
.EE
|
46
28
|
.SH Options
|
47
29
|
.IP \[bu] 2
|
48
|
-
\f[
|
30
|
+
\f[CR]--config-file FILE\f[R]: Specify the config file to use.
|
49
31
|
If you aren\[cq]t using the default config file at
|
50
|
-
\f[
|
51
|
-
\f[
|
32
|
+
\f[CR]\[ti]/.gemstash/config.yml\f[R] or
|
33
|
+
\f[CR]\[ti]/.gemstash/config.yml.erb\f[R], then you must specify the
|
52
34
|
config file via this option.
|
53
35
|
.IP \[bu] 2
|
54
|
-
\f[
|
36
|
+
\f[CR]--key SECURE_KEY\f[R]: Specify the API key to affect.
|
55
37
|
This should be the actual key value, not a name.
|
56
|
-
This option is required when using \f[
|
38
|
+
This option is required when using \f[CR]--remove\f[R] but is optional
|
57
39
|
otherwise.
|
58
40
|
If adding an authorization, using this will either create or update the
|
59
41
|
permissions for the specified API key.
|
60
42
|
If missing, a new API key will always be generated.
|
61
43
|
Note that a key can only have a maximum length of 255 chars.
|
62
44
|
.IP \[bu] 2
|
63
|
-
\f[
|
45
|
+
\f[CR]--name\f[R]: Name of the authorization.
|
46
|
+
Purely for ease of identification, not required.
|
47
|
+
.IP \[bu] 2
|
48
|
+
\f[CR]--remove\f[R]: Remove an authorization rather than add or update
|
64
49
|
one.
|
65
50
|
When removing, permission values are not allowed.
|
66
|
-
The \f[
|
51
|
+
The \f[CR]--key <secure-key>\f[R] option is required.
|
52
|
+
.IP \[bu] 2
|
53
|
+
\f[CR]--list\f[R]: List current authorizations.
|
54
|
+
Provide \f[CR]--name\f[R] or \f[CR]--key\f[R] to show only one result.
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
4mgemstash-authorize24m(1) 4mgemstash-authorize24m(1)
|
4
2
|
|
5
3
|
<!-- Automatically generated by Pandoc -->
|
6
4
|
|
@@ -9,40 +7,46 @@ gemstash-authorize(1) gemstash-authorize(1)
|
|
9
7
|
privately stored gems
|
10
8
|
|
11
9
|
1mSynopsis0m
|
12
|
-
|
13
|
-
|
10
|
+
gemstash authorize [permissions] [--remove] [--list] [--key SECURE_KEY]
|
11
|
+
[--name NAME] [--config-file FILE]
|
14
12
|
|
15
13
|
1mDescription0m
|
16
14
|
Adds or removes authorization to interact with privately stored gems.
|
17
15
|
|
18
|
-
Any
|
19
|
-
include
|
16
|
+
Any arguments will be used as specific permissions. Valid permissions
|
17
|
+
include push, yank, and fetch. If no permissions are provided, then
|
20
18
|
all permissions will be granted (including any that may be added in fu-
|
21
19
|
ture versions of Gemstash).
|
22
20
|
|
23
21
|
1mUsage0m
|
24
22
|
gemstash authorize
|
25
23
|
gemstash authorize push yank
|
24
|
+
gemstash authorize push --name my-auth
|
26
25
|
gemstash authorize yank --key <secure-key>
|
27
26
|
gemstash authorize --remove --key <secure-key>
|
27
|
+
gemstash authorize --list
|
28
28
|
|
29
29
|
1mOptions0m
|
30
|
-
o
|
31
|
-
using the default config file at
|
32
|
-
|
30
|
+
o --config-file FILE: Specify the config file to use. If you aren't
|
31
|
+
using the default config file at ~/.gemstash/config.yml or ~/.gem-
|
32
|
+
stash/config.yml.erb, then you must specify the config file via this
|
33
33
|
option.
|
34
34
|
|
35
|
-
o
|
35
|
+
o --key SECURE_KEY: Specify the API key to affect. This should be the
|
36
36
|
actual key value, not a name. This option is required when using
|
37
|
-
|
37
|
+
--remove but is optional otherwise. If adding an authorization, us-
|
38
38
|
ing this will either create or update the permissions for the speci-
|
39
39
|
fied API key. If missing, a new API key will always be generated.
|
40
40
|
Note that a key can only have a maximum length of 255 chars.
|
41
41
|
|
42
|
-
o
|
43
|
-
|
44
|
-
1mkey> 22moption is required.
|
42
|
+
o --name: Name of the authorization. Purely for ease of identifica-
|
43
|
+
tion, not required.
|
45
44
|
|
45
|
+
o --remove: Remove an authorization rather than add or update one.
|
46
|
+
When removing, permission values are not allowed. The --key <secure-
|
47
|
+
key> option is required.
|
46
48
|
|
49
|
+
o --list: List current authorizations. Provide --name or --key to show
|
50
|
+
only one result.
|
47
51
|
|
48
|
-
October 9, 2015
|
52
|
+
October 9, 2015 4mgemstash-authorize24m(1)
|