codemonitor 0.6.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f946bb06520000b874d580db3b60204aa8d243f8ca38777168c12e8a54946ec
4
- data.tar.gz: c4ce7a7a962ab314ca4d9c381eb93642902f0c054500585b41bfd2a6c37161be
3
+ metadata.gz: f8376539752d3392f7d8488ba82d5006143456cb0d42293b5c44a8aee5973185
4
+ data.tar.gz: 703466cb760fa112f0d07ccf1e8c0c891002532ee17d616730876594b7f118a1
5
5
  SHA512:
6
- metadata.gz: 9c7029e7553b6ecbe9d707f40f38b8fa657bd78c67efc05572502729923e832020ea6eff0c77fc80d48e5f394463ba961d51303a8d2c2e874300a10aa4eb6b4a
7
- data.tar.gz: 74ea78d12f4252d6a24d8d81c7ba9db88985b93cfc0f78547377edf97b6f4d72f52f7f3ff5d035d96c5f01564013d76668edec27036b4874e3c8bd8e6a9a21dd
6
+ metadata.gz: 7560f2f13f6cd781e24f93640adadb8cba58cca68d66b83e354ac4fac8da7f93b03b7672b905769790fbf2843a36c434c3ec385fc4000a08f79d49fb03e1dbda
7
+ data.tar.gz: b316ad47b929584ee345f37210362c16b720b204ad016c9d561fd7c7b645a5c891e85c8b2e98019e60a4f3e53cc0d827ba498f1adb8ec8c641dcc0dcccb25437
@@ -3,6 +3,10 @@
3
3
  module Engines
4
4
  module Custom
5
5
  class Extractor
6
+ def initialize
7
+ @filenames = ENV.fetch('CODEMONITOR_CUSTOMS', nil)
8
+ end
9
+
6
10
  def call(provider)
7
11
  provider.emit(metrics)
8
12
  end
@@ -14,7 +18,27 @@ module Engines
14
18
  private
15
19
 
16
20
  def custom_files
17
- Dir.glob('./.codemonitor/*.rb')
21
+ return Dir.glob('./.codemonitor/*.rb') if @filenames.nil?
22
+
23
+ raise 'Forbidden access to parent folder' unless @filenames.match(/\.\./).nil?
24
+
25
+ includes = @filenames.split(',').reject do |filename|
26
+ filename.start_with?('-')
27
+ end.map do |filename|
28
+ "./.codemonitor/#{filename}.rb"
29
+ end
30
+
31
+ excludes = @filenames.split(',').filter do |filename|
32
+ filename.start_with?('-')
33
+ end.map do |filename|
34
+ "./.codemonitor/#{filename.gsub(/^-/, '')}.rb"
35
+ end
36
+
37
+ raise 'Mixed included and excluded custom paths is not allowed' if includes.size > 0 && excludes.size > 0
38
+
39
+ return Dir.glob(includes) if includes.size > 0
40
+
41
+ Dir.glob('./.codemonitor/*.rb') - Dir.glob(excludes)
18
42
  end
19
43
 
20
44
  def metrics
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CodeMonitor
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codemonitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferran Basora
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-27 00:00:00.000000000 Z
11
+ date: 2022-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dogapi
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.1.2
172
+ rubygems_version: 3.3.5
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Collect many metrics your code is generating