peak_flow_utils 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb +1 -0
- data/app/controllers/peak_flow_utils/pings/sidekiq_controller.rb +1 -0
- data/app/services/peak_flow_utils/database_initializer_service.rb +3 -3
- data/app/services/peak_flow_utils/handlers_finder_service.rb +2 -2
- data/app/services/peak_flow_utils/translations_parser_service.rb +3 -3
- data/bin/peak_flow_rspec_files +1 -1
- data/lib/peak_flow_utils.rb +2 -2
- data/lib/peak_flow_utils/migrations/{20150907090900_create_handlers.rb → 20150907070908_create_handlers.rb} +0 -0
- data/lib/peak_flow_utils/rspec_helper.rb +29 -15
- data/lib/peak_flow_utils/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b141fd3f60e179e1d4e3f102b99d072a0058c59e86cceb24f64a06e0257606e7
|
4
|
+
data.tar.gz: a7b8374c5efb473cd97a122d03e44cb007f5a01ca49b8da0735c533e988de2f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee4466d32017db9534d5d5f037f077e559442b9cf104b0eef9e814f3e8c0f6579245024f38a026060ead15ba5c1f629e1329e67426e194c93becf0207bfef2c7
|
7
|
+
data.tar.gz: 2623cd9f15885a9585ca2d47b6af5940eb44f210d1d55a3c1a93c62262fd8624e21c6d91e8c894fd107758f06e5aab0be2a2bd11d009e1b0d12314439e64adf6
|
@@ -3,6 +3,7 @@ class PeakFlowUtils::Pings::PostgresConnectionsController < PeakFlowUtils::Appli
|
|
3
3
|
postgres_connections_count = ActiveRecord::Base.connection.execute("SELECT SUM(numbackends) AS connections_count FROM pg_stat_database").to_a.first
|
4
4
|
|
5
5
|
render json: {
|
6
|
+
check_json_status: "OK",
|
6
7
|
postgres_connections_count: postgres_connections_count.fetch("connections_count")
|
7
8
|
}
|
8
9
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class PeakFlowUtils::DatabaseInitializerService < PeakFlowUtils::ApplicationService
|
2
|
-
def
|
3
|
-
path = File.realpath("#{
|
2
|
+
def perform
|
3
|
+
path = File.realpath("#{__dir__}/../../../lib/peak_flow_utils/migrations")
|
4
4
|
create_schema_table unless schema_table_exists?
|
5
5
|
|
6
6
|
Dir["#{path}/[0-9]*_*.rb"].sort.map do |filename|
|
@@ -22,7 +22,7 @@ class PeakFlowUtils::DatabaseInitializerService < PeakFlowUtils::ApplicationServ
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def create_schema_table
|
25
|
-
PeakFlowUtils::ApplicationRecord.connection.execute("CREATE TABLE schema_migrations (version
|
25
|
+
PeakFlowUtils::ApplicationRecord.connection.execute("CREATE TABLE schema_migrations (version VARCHAR)")
|
26
26
|
end
|
27
27
|
|
28
28
|
def register_migration_migrated(version)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class PeakFlowUtils::HandlersFinderService < PeakFlowUtils::ApplicationService
|
2
|
-
def
|
2
|
+
def perform
|
3
3
|
handlers = []
|
4
4
|
|
5
|
-
Dir.foreach("#{
|
5
|
+
Dir.foreach("#{__dir__}/../../handlers/peak_flow_utils") do |file|
|
6
6
|
match = file.match(/\A(.+)_handler\.rb\Z/)
|
7
7
|
next unless match
|
8
8
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class PeakFlowUtils::TranslationsParserService < PeakFlowUtils::ApplicationService
|
2
2
|
attr_reader :db
|
3
3
|
|
4
|
-
def
|
4
|
+
def perform
|
5
5
|
PeakFlowUtils::DatabaseInitializerService.execute!
|
6
6
|
|
7
7
|
cache_translations_in_dir(Rails.root.join("config/locales"))
|
@@ -103,11 +103,11 @@ private
|
|
103
103
|
puts message.to_s if @debug # rubocop:disable Rails/Output
|
104
104
|
end
|
105
105
|
|
106
|
-
def
|
106
|
+
def perform_migrations
|
107
107
|
require "baza_migrations"
|
108
108
|
|
109
109
|
executor = BazaMigrations::MigrationsExecutor.new(db: @db)
|
110
|
-
executor.add_dir "#{
|
110
|
+
executor.add_dir "#{__dir__}/../../db/baza_translations_migrations"
|
111
111
|
executor.execute_migrations
|
112
112
|
end
|
113
113
|
|
data/bin/peak_flow_rspec_files
CHANGED
data/lib/peak_flow_utils.rb
CHANGED
@@ -4,8 +4,8 @@ require "array_enumerator"
|
|
4
4
|
require "service_pattern"
|
5
5
|
|
6
6
|
module PeakFlowUtils
|
7
|
-
path = "#{
|
8
|
-
models_path = "#{
|
7
|
+
path = "#{__dir__}/peak_flow_utils"
|
8
|
+
models_path = "#{__dir__}/peak_flow_utils/models"
|
9
9
|
|
10
10
|
autoload :Notifier, "#{path}/notifier"
|
11
11
|
autoload :NotifierErrorParser, "#{path}/notifier_error_parser"
|
File without changes
|
@@ -135,19 +135,20 @@ class PeakFlowUtils::RspecHelper
|
|
135
135
|
|
136
136
|
private
|
137
137
|
|
138
|
-
def
|
139
|
-
|
138
|
+
def dry_result
|
139
|
+
@dry_result ||= begin
|
140
|
+
require "json"
|
141
|
+
require "rspec/core"
|
140
142
|
|
141
|
-
|
142
|
-
|
143
|
-
end
|
143
|
+
output_capture = StringIO.new
|
144
|
+
RSpec::Core::Runner.run(rspec_options, $stderr, output_capture)
|
144
145
|
|
145
|
-
|
146
|
-
end
|
146
|
+
result = ::JSON.parse(output_capture.string)
|
147
147
|
|
148
|
-
|
149
|
-
|
150
|
-
|
148
|
+
raise "No examples were found" if result.fetch("examples").empty?
|
149
|
+
|
150
|
+
result
|
151
|
+
end
|
151
152
|
end
|
152
153
|
|
153
154
|
def dry_file(path)
|
@@ -178,11 +179,6 @@ private
|
|
178
179
|
only_types && !only_types.include?(type) # rubocop:disable Rails/NegateInclude:, Style/SafeNavigation
|
179
180
|
end
|
180
181
|
|
181
|
-
def type_from_path(file_path)
|
182
|
-
match = file_path.match(/^spec\/(.+?)\//)
|
183
|
-
match[1] if match
|
184
|
-
end
|
185
|
-
|
186
182
|
def points_from_type(type)
|
187
183
|
if type == "feature" || type == "system"
|
188
184
|
10
|
@@ -192,4 +188,22 @@ private
|
|
192
188
|
1
|
193
189
|
end
|
194
190
|
end
|
191
|
+
|
192
|
+
def rspec_options
|
193
|
+
rspec_options = ["--dry-run", "--format", "json"]
|
194
|
+
|
195
|
+
tags&.each do |tag|
|
196
|
+
rspec_options += ["--tag", tag]
|
197
|
+
end
|
198
|
+
|
199
|
+
# Add the folder with all the specs, which is required when running programmatically
|
200
|
+
rspec_options << "spec"
|
201
|
+
|
202
|
+
rspec_options
|
203
|
+
end
|
204
|
+
|
205
|
+
def type_from_path(file_path)
|
206
|
+
match = file_path.match(/^spec\/(.+?)\//)
|
207
|
+
match[1] if match
|
208
|
+
end
|
195
209
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peak_flow_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: redis
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,8 +149,8 @@ files:
|
|
149
149
|
- lib/peak_flow_utils/engine.rb
|
150
150
|
- lib/peak_flow_utils/handler_helper.rb
|
151
151
|
- lib/peak_flow_utils/migrations/20150902155200_create_translation_keys.rb
|
152
|
+
- lib/peak_flow_utils/migrations/20150907070908_create_handlers.rb
|
152
153
|
- lib/peak_flow_utils/migrations/20150907070909_create_groups.rb
|
153
|
-
- lib/peak_flow_utils/migrations/20150907090900_create_handlers.rb
|
154
154
|
- lib/peak_flow_utils/migrations/20150908085500_create_translation_values.rb
|
155
155
|
- lib/peak_flow_utils/migrations/20150908090800_create_handler_texts.rb
|
156
156
|
- lib/peak_flow_utils/migrations/20160411190500_create_scanned_files.rb
|