founders_toolkit 0.2.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +4 -4
- data/lib/founders_toolkit/auth/securable/model.rb +0 -1
- data/lib/founders_toolkit/auth/securable/validations/protected_validator.rb +4 -1
- data/lib/founders_toolkit/jobs/tracked_job.rb +28 -0
- data/lib/founders_toolkit/util/rate_limitable.rb +9 -8
- data/lib/founders_toolkit/version.rb +1 -1
- data/lib/install/current.rb +6 -0
- data/lib/install/gems.rb +12 -0
- data/lib/install/linters.rb +10 -0
- data/lib/install/templates/.rubocop.yml +2 -0
- data/lib/install/templates/current.rb +5 -0
- data/lib/tasks/install.rake +16 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5f9177014a99ce6c0ac2751cbc8dd34589a510e6412533c4c33a783a83cb5f5
|
4
|
+
data.tar.gz: 7143a519fdc2f6cd00f441331c24c601c1d2c70eaaa58f95cf1d9a6f2b1fdbe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3173aede632715cf33a530fc8d161baa667be9a887a8f0632c8bd7fa929ad972857b95d830720999d753e909202d7dc688deb7eca806a80e135d6ef22c1fe253
|
7
|
+
data.tar.gz: fc1bcda91214a46918cb7ca7f64e376a82517d01c15f10590df1d48074e26e7524fa83a8e3cb2933557f6810d4fe31043993535536d079f83e7d6794be481207
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.6.0] - 2021-03-29
|
10
|
+
- Fix for rate limiter
|
11
|
+
|
12
|
+
## [0.5.0] - 2021-03-29
|
13
|
+
|
14
|
+
- Added install rake task.
|
15
|
+
- Remove email as a protected attribute by default.
|
16
|
+
|
17
|
+
## [0.4.0] - 2021-03-29
|
18
|
+
- Add tracking to limitable
|
19
|
+
|
20
|
+
## [0.3.0] - 2021-03-29
|
21
|
+
- Added TrackedJob for simple statsd active job monitoring
|
22
|
+
|
23
|
+
## [0.2.1] - 2021-03-25
|
24
|
+
### Fixed
|
25
|
+
- Fixed the protected attributes validator when updating the password.
|
26
|
+
|
9
27
|
## [0.1.0] - 2021-03-25
|
10
28
|
- No real change, just CI
|
11
29
|
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
founders_toolkit (0.
|
4
|
+
founders_toolkit (0.6.0)
|
5
5
|
activemodel (~> 6.1)
|
6
6
|
activesupport (~> 6.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (6.1.3)
|
12
|
-
activesupport (= 6.1.3)
|
13
|
-
activesupport (6.1.3)
|
11
|
+
activemodel (6.1.3.1)
|
12
|
+
activesupport (= 6.1.3.1)
|
13
|
+
activesupport (6.1.3.1)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
@@ -7,7 +7,6 @@ module FoundersToolkit::Auth::Securable::Model
|
|
7
7
|
include FoundersToolkit::Auth::Emailable::Model
|
8
8
|
extend FoundersToolkit::Auth::Securable::Validations::ProtectedValidator::HelperMethods
|
9
9
|
|
10
|
-
validates_protected_attributes :email
|
11
10
|
validates_protected_attributes :password, secure: true
|
12
11
|
|
13
12
|
has_secure_password
|
@@ -31,7 +31,10 @@ module FoundersToolkit::Auth::Securable::Validations
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def authenticate?(record)
|
34
|
-
record.try(:reset_password_token?)
|
34
|
+
return true if record.try(:reset_password_token?)
|
35
|
+
|
36
|
+
fresh_record = record.class.find(record.id)
|
37
|
+
fresh_record.authenticate(record.current_password)
|
35
38
|
end
|
36
39
|
|
37
40
|
module HelperMethods
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FoundersToolkit::Jobs
|
4
|
+
module TrackedJob
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
include FoundersToolkit::Monitoring::Statsdable
|
9
|
+
|
10
|
+
around_perform :update_stats
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def update_stats(&block)
|
16
|
+
statsd.increment("active_job.#{self.class.queue_name}.#{self.class.name}.started")
|
17
|
+
statsd.time("active_job.#{self.class.queue_name}.#{self.class.name}", &block)
|
18
|
+
statsd.increment("active_job.#{self.class.queue_name}.#{self.class.name}.finished")
|
19
|
+
update_queue_size_stats
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_queue_size_stats
|
23
|
+
Resque.queues.each do |name|
|
24
|
+
statsd.gauge("active_job.queue_size.#{name}", Resque.size(name))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -14,8 +14,6 @@ rescue LoadError
|
|
14
14
|
raise
|
15
15
|
end
|
16
16
|
|
17
|
-
require_relative '../monitoring/statsdable'
|
18
|
-
|
19
17
|
module FoundersToolkit::Util
|
20
18
|
module RateLimitable
|
21
19
|
extend ActiveSupport::Concern
|
@@ -31,13 +29,16 @@ module FoundersToolkit::Util
|
|
31
29
|
limiter = instance_variable_get("@#{limiter_name}".to_sym)
|
32
30
|
limiter ||= instance_variable_set("@#{limiter_name}".to_sym, Ratelimit.new(name))
|
33
31
|
|
34
|
-
limiter.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
while limiter.exceeded?(__send__(key), threshold: threshold, interval: interval)
|
33
|
+
statsd.increment ['thottled', limiter_name].join('.')
|
34
|
+
sleep 5
|
35
|
+
end
|
36
|
+
|
37
|
+
result = statsd.time(['retryable', limiter_name].join('.')) do
|
38
|
+
Retryable.retryable(tries: 3, on: retry_from) { block.call }
|
40
39
|
end
|
40
|
+
limiter.add __send__(key)
|
41
|
+
result
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
data/lib/install/gems.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def run_install_template(path)
|
4
|
+
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path(
|
5
|
+
"../install/#{path}.rb", __dir__
|
6
|
+
)}"
|
7
|
+
end
|
8
|
+
|
9
|
+
namespace :founders_toolkit do
|
10
|
+
desc 'Install Founders Toolkit'
|
11
|
+
task :install do
|
12
|
+
run_install_template 'gems'
|
13
|
+
run_install_template 'current'
|
14
|
+
run_install_template 'linters'
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: founders_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trae Robrock
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-03-
|
12
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -76,12 +76,19 @@ files:
|
|
76
76
|
- lib/founders_toolkit/auth/securable/validations/protected_validator.rb
|
77
77
|
- lib/founders_toolkit/engine.rb
|
78
78
|
- lib/founders_toolkit/jobs/locked_job.rb
|
79
|
+
- lib/founders_toolkit/jobs/tracked_job.rb
|
79
80
|
- lib/founders_toolkit/monitoring/statsdable.rb
|
80
81
|
- lib/founders_toolkit/util.rb
|
81
82
|
- lib/founders_toolkit/util/cacheable.rb
|
82
83
|
- lib/founders_toolkit/util/lockable.rb
|
83
84
|
- lib/founders_toolkit/util/rate_limitable.rb
|
84
85
|
- lib/founders_toolkit/version.rb
|
86
|
+
- lib/install/current.rb
|
87
|
+
- lib/install/gems.rb
|
88
|
+
- lib/install/linters.rb
|
89
|
+
- lib/install/templates/.rubocop.yml
|
90
|
+
- lib/install/templates/current.rb
|
91
|
+
- lib/tasks/install.rake
|
85
92
|
homepage: https://github.com/trobrock/founders-toolkit
|
86
93
|
licenses:
|
87
94
|
- MIT
|