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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27b80fe472694a76875b46c4bc5e393e6bf02acb13e4ff2b194e5ce4b61698b7
4
- data.tar.gz: 4e4bd827165ad878970df19990af1d80ab229188f7d590464faadb772945b324
3
+ metadata.gz: b141fd3f60e179e1d4e3f102b99d072a0058c59e86cceb24f64a06e0257606e7
4
+ data.tar.gz: a7b8374c5efb473cd97a122d03e44cb007f5a01ca49b8da0735c533e988de2f4
5
5
  SHA512:
6
- metadata.gz: 11cc3ae6a4bed2cec6209846fbe5463e2133c4a5ff3873a63ef93bec83fbf1a58c90282aa279307dc090e3d1ac30d27bcb93193dc7489914b500939d8a389bb1
7
- data.tar.gz: 2b20aedf4ba6b0ae8ad2a6882e8f8664c9212310ce4cd2f555ac6c6436cb5943b6096d23e64502deaf6ea3c02f105e7c941614e1b549e767878a08fe9a4d0080
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
@@ -5,6 +5,7 @@ class PeakFlowUtils::Pings::SidekiqController < PeakFlowUtils::ApplicationContro
5
5
  sidekiq_queue = Sidekiq::Queue.new
6
6
 
7
7
  render json: {
8
+ check_json_status: "OK",
8
9
  latency: sidekiq_queue.latency,
9
10
  queue_size: sidekiq_queue.size
10
11
  }
@@ -1,6 +1,6 @@
1
1
  class PeakFlowUtils::DatabaseInitializerService < PeakFlowUtils::ApplicationService
2
- def execute
3
- path = File.realpath("#{File.dirname(__FILE__)}/../../../lib/peak_flow_utils/migrations")
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 VARCHAT)")
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 execute
2
+ def perform
3
3
  handlers = []
4
4
 
5
- Dir.foreach("#{File.dirname(__FILE__)}/../../handlers/peak_flow_utils") do |file|
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 execute
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 execute_migrations
106
+ def perform_migrations
107
107
  require "baza_migrations"
108
108
 
109
109
  executor = BazaMigrations::MigrationsExecutor.new(db: @db)
110
- executor.add_dir "#{File.dirname(__FILE__)}/../../db/baza_translations_migrations"
110
+ executor.add_dir "#{__dir__}/../../db/baza_translations_migrations"
111
111
  executor.execute_migrations
112
112
  end
113
113
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # This task detects and prints out the RSpec files for the current build group
4
4
 
5
- require "#{File.dirname(__FILE__)}/../lib/peak_flow_utils"
5
+ require "#{__dir__}/../lib/peak_flow_utils"
6
6
 
7
7
  args = {}
8
8
  ARGV.each do |arg|
@@ -4,8 +4,8 @@ require "array_enumerator"
4
4
  require "service_pattern"
5
5
 
6
6
  module PeakFlowUtils
7
- path = "#{File.dirname(__FILE__)}/peak_flow_utils"
8
- models_path = "#{File.dirname(__FILE__)}/peak_flow_utils/models"
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"
@@ -135,19 +135,20 @@ class PeakFlowUtils::RspecHelper
135
135
 
136
136
  private
137
137
 
138
- def dry_result_command
139
- command = "bundle exec rspec --dry-run --format json"
138
+ def dry_result
139
+ @dry_result ||= begin
140
+ require "json"
141
+ require "rspec/core"
140
142
 
141
- tags&.each do |tag|
142
- command << " --tag #{tag}"
143
- end
143
+ output_capture = StringIO.new
144
+ RSpec::Core::Runner.run(rspec_options, $stderr, output_capture)
144
145
 
145
- command
146
- end
146
+ result = ::JSON.parse(output_capture.string)
147
147
 
148
- def dry_result
149
- require "json"
150
- @dry_result ||= ::JSON.parse(`#{dry_result_command}`)
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
@@ -1,3 +1,3 @@
1
1
  module PeakFlowUtils
2
- VERSION = "0.1.12".freeze
2
+ VERSION = "0.1.13".freeze
3
3
  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.12
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: 2020-12-06 00:00:00.000000000 Z
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: '0'
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: '0'
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