rails-autoscale-web 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/judoscale/rails/config.rb +16 -0
- data/lib/judoscale/rails/railtie.rb +20 -11
- data/lib/judoscale/rails/version.rb +1 -1
- metadata +5 -5
- data/Gemfile.lock +0 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 061d58d02d101b472357e8be52d5309673464cc29a304eabda228d6d3743d207
|
4
|
+
data.tar.gz: faddfab8ffd2f857919bddb51f95bc1cf51b60c1f1efd800099b107c7b30ee45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a06987790843d9414a1114f343f1ad9a1d63e564187f48e2ffd81db94a0751307eb5da006d2f297562e7b417568cdaa78a2debfb18776430947e47fb0244dfc
|
7
|
+
data.tar.gz: 138d3aadf7cf1e30cbe9c30633d6fe620d143b1adf2f6c90e559edb5de305acffe4c5bc69bbcee301881a7c4415982f05d84fb89bf16d656a1ddfe136f70f985
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "judoscale/config"
|
2
|
+
|
3
|
+
module Judoscale
|
4
|
+
module Rails
|
5
|
+
module Config
|
6
|
+
attr_accessor :start_reporter_after_initialize
|
7
|
+
|
8
|
+
def reset
|
9
|
+
super
|
10
|
+
@start_reporter_after_initialize = true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
::Judoscale::Config.prepend Config
|
15
|
+
end
|
16
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require "rails"
|
4
4
|
require "rails/railtie"
|
5
5
|
require "judoscale/request_middleware"
|
6
|
-
require "judoscale/config"
|
6
|
+
require "judoscale/rails/config"
|
7
7
|
require "judoscale/logger"
|
8
8
|
require "judoscale/reporter"
|
9
9
|
|
@@ -13,27 +13,36 @@ module Judoscale
|
|
13
13
|
include Judoscale::Logger
|
14
14
|
|
15
15
|
def in_rails_console?
|
16
|
-
|
16
|
+
# This is gross, but we can't find a more reliable way to detect if we're in a Rails console.
|
17
|
+
caller.any? { |call| call.include?("console_command.rb") }
|
17
18
|
end
|
18
19
|
|
19
|
-
def in_rake_task?
|
20
|
-
defined?(::Rake) && Rake.respond_to?(:application) && Rake.application.top_level_tasks
|
20
|
+
def in_rake_task?(task_regex)
|
21
|
+
top_level_tasks = defined?(::Rake) && Rake.respond_to?(:application) && Rake.application.top_level_tasks || []
|
22
|
+
top_level_tasks.any? { |task| task_regex.match?(task) }
|
23
|
+
end
|
24
|
+
|
25
|
+
def judoscale_config
|
26
|
+
# Disambiguate from Judoscale::Rails::Config
|
27
|
+
::Judoscale::Config.instance
|
21
28
|
end
|
22
29
|
|
23
30
|
initializer "Judoscale.logger" do |app|
|
24
|
-
|
31
|
+
judoscale_config.logger = ::Rails.logger
|
25
32
|
end
|
26
33
|
|
27
34
|
initializer "Judoscale.request_middleware" do |app|
|
28
|
-
|
29
|
-
logger.debug "Preparing request middleware"
|
30
|
-
app.middleware.insert_before Rack::Runtime, RequestMiddleware
|
31
|
-
end
|
35
|
+
app.middleware.insert_before Rack::Runtime, RequestMiddleware
|
32
36
|
end
|
33
37
|
|
34
38
|
config.after_initialize do
|
35
|
-
|
36
|
-
|
39
|
+
if in_rails_console?
|
40
|
+
logger.debug "No reporting since we're in a Rails console"
|
41
|
+
elsif in_rake_task?(/assets:|db:/)
|
42
|
+
logger.debug "No reporting since we're in a build process"
|
43
|
+
elsif judoscale_config.start_reporter_after_initialize
|
44
|
+
Reporter.start
|
45
|
+
end
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-autoscale-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam McCrea
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-01-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails-autoscale-core
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.5.
|
21
|
+
version: 1.5.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.5.
|
28
|
+
version: 1.5.3
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: railties
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,11 +49,11 @@ extra_rdoc_files: []
|
|
49
49
|
files:
|
50
50
|
- Gemfile
|
51
51
|
- Gemfile-rails-6-1
|
52
|
-
- Gemfile.lock
|
53
52
|
- Rakefile
|
54
53
|
- judoscale-rails.gemspec
|
55
54
|
- lib/judoscale-rails.rb
|
56
55
|
- lib/judoscale/rails.rb
|
56
|
+
- lib/judoscale/rails/config.rb
|
57
57
|
- lib/judoscale/rails/railtie.rb
|
58
58
|
- lib/judoscale/rails/version.rb
|
59
59
|
- lib/rails-autoscale-web.rb
|
data/Gemfile.lock
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../judoscale-ruby
|
3
|
-
specs:
|
4
|
-
judoscale-ruby (1.5.2)
|
5
|
-
|
6
|
-
PATH
|
7
|
-
remote: .
|
8
|
-
specs:
|
9
|
-
judoscale-rails (1.5.2)
|
10
|
-
judoscale-ruby (= 1.5.2)
|
11
|
-
railties
|
12
|
-
|
13
|
-
GEM
|
14
|
-
remote: https://rubygems.org/
|
15
|
-
specs:
|
16
|
-
actionpack (7.0.7)
|
17
|
-
actionview (= 7.0.7)
|
18
|
-
activesupport (= 7.0.7)
|
19
|
-
rack (~> 2.0, >= 2.2.4)
|
20
|
-
rack-test (>= 0.6.3)
|
21
|
-
rails-dom-testing (~> 2.0)
|
22
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
23
|
-
actionview (7.0.7)
|
24
|
-
activesupport (= 7.0.7)
|
25
|
-
builder (~> 3.1)
|
26
|
-
erubi (~> 1.4)
|
27
|
-
rails-dom-testing (~> 2.0)
|
28
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
29
|
-
activesupport (7.0.7)
|
30
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
-
i18n (>= 1.6, < 2)
|
32
|
-
minitest (>= 5.1)
|
33
|
-
tzinfo (~> 2.0)
|
34
|
-
builder (3.2.4)
|
35
|
-
concurrent-ruby (1.2.2)
|
36
|
-
crass (1.0.6)
|
37
|
-
debug (1.7.1)
|
38
|
-
irb (>= 1.5.0)
|
39
|
-
reline (>= 0.3.1)
|
40
|
-
erubi (1.12.0)
|
41
|
-
i18n (1.14.1)
|
42
|
-
concurrent-ruby (~> 1.0)
|
43
|
-
io-console (0.6.0)
|
44
|
-
irb (1.6.2)
|
45
|
-
reline (>= 0.3.0)
|
46
|
-
loofah (2.21.3)
|
47
|
-
crass (~> 1.0.2)
|
48
|
-
nokogiri (>= 1.12.0)
|
49
|
-
method_source (1.0.0)
|
50
|
-
minitest (5.17.0)
|
51
|
-
minitest-stub-const (0.6)
|
52
|
-
nokogiri (1.15.3-arm64-darwin)
|
53
|
-
racc (~> 1.4)
|
54
|
-
nokogiri (1.15.3-x86_64-darwin)
|
55
|
-
racc (~> 1.4)
|
56
|
-
nokogiri (1.15.3-x86_64-linux)
|
57
|
-
racc (~> 1.4)
|
58
|
-
racc (1.7.1)
|
59
|
-
rack (2.2.8)
|
60
|
-
rack-test (2.1.0)
|
61
|
-
rack (>= 1.3)
|
62
|
-
rails-dom-testing (2.2.0)
|
63
|
-
activesupport (>= 5.0.0)
|
64
|
-
minitest
|
65
|
-
nokogiri (>= 1.6)
|
66
|
-
rails-html-sanitizer (1.6.0)
|
67
|
-
loofah (~> 2.21)
|
68
|
-
nokogiri (~> 1.14)
|
69
|
-
railties (7.0.7)
|
70
|
-
actionpack (= 7.0.7)
|
71
|
-
activesupport (= 7.0.7)
|
72
|
-
method_source
|
73
|
-
rake (>= 12.2)
|
74
|
-
thor (~> 1.0)
|
75
|
-
zeitwerk (~> 2.5)
|
76
|
-
rake (13.0.6)
|
77
|
-
reline (0.3.2)
|
78
|
-
io-console (~> 0.5)
|
79
|
-
thor (1.2.2)
|
80
|
-
tzinfo (2.0.6)
|
81
|
-
concurrent-ruby (~> 1.0)
|
82
|
-
zeitwerk (2.6.11)
|
83
|
-
|
84
|
-
PLATFORMS
|
85
|
-
arm64-darwin-20
|
86
|
-
arm64-darwin-21
|
87
|
-
arm64-darwin-22
|
88
|
-
x86_64-darwin-21
|
89
|
-
x86_64-linux
|
90
|
-
|
91
|
-
DEPENDENCIES
|
92
|
-
debug
|
93
|
-
judoscale-rails!
|
94
|
-
judoscale-ruby!
|
95
|
-
minitest
|
96
|
-
minitest-stub-const
|
97
|
-
rake
|
98
|
-
|
99
|
-
BUNDLED WITH
|
100
|
-
2.3.9
|