appmap 0.60.0 → 0.61.0

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: 832f968242440a6bac78181dbb49ca1b34d75c37074810df66c3d1b1d546c0cf
4
- data.tar.gz: 26ffec9cffe15f63dc661563ec7bee9c8b4659a54c0a8888dd797b6253518954
3
+ metadata.gz: ff3bf2ebd7ec8fcc1a5af2e4e6dad9198f03aa002e5d9ec1c481989bae11fb4b
4
+ data.tar.gz: 0b601eb264047a0971ef17d086ea6335b2e657d198dbd8ec8892a8191d0ab373
5
5
  SHA512:
6
- metadata.gz: '09eb7e68782f397a59a960ba617af180ee2d0746316db9b7d2c4cd011755e815205a5b484d0a90cd19224ab7f4be7231a96c664ea87e962c02372e155088cc82'
7
- data.tar.gz: eea1765efb3ab76716d7c8c74f9f7b9d860923d815dab0bd003ecf8f07dc62ac6d3660e43ba0576b615bd6de094156e14e8a5be876dfe3851d4dc2c95cd82368
6
+ metadata.gz: 95d564c8858735cd87fe794657ab301fe38b96281f9947f7bc471d3a0bb9eb296b0eee309c234a2645f248aeec61bb73687378972cb5eb413ca628424787f167
7
+ data.tar.gz: 6adc060b2f2cb22f75ffb320d55f4a78a297e870b9f01b832aef366a5ecb95ff70e02ca6785644b353fbab1480418c18fddaef2242e9037aafd2d2e35b2d0d47
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [0.61.0](https://github.com/applandinc/appmap-ruby/compare/v0.60.0...v0.61.0) (2021-07-14)
2
+
3
+
4
+ ### Features
5
+
6
+ * check if rails is present in `appmap-agent-validate` ([b584c2d](https://github.com/applandinc/appmap-ruby/commit/b584c2d9bb37f166932c0b91eed4db94fbafa8a7))
7
+
1
8
  # [0.60.0](https://github.com/applandinc/appmap-ruby/compare/v0.59.2...v0.60.0) (2021-07-08)
2
9
 
3
10
 
@@ -24,7 +24,7 @@ module AppMap
24
24
  agentVersion: AppMap::VERSION,
25
25
  language: 'ruby',
26
26
  remoteRecordingCapable: Gem.loaded_specs.has_key?('rails'),
27
- integrationTests: Service::IntegrationTestPathFinder.count_paths > 0
27
+ integrationTests: Service::IntegrationTestPathFinder.new.count_paths > 0
28
28
  }
29
29
  }
30
30
  }
@@ -5,39 +5,43 @@ require 'appmap/service/test_framework_detector'
5
5
  module AppMap
6
6
  module Service
7
7
  class IntegrationTestPathFinder
8
- class << self
9
- def find
10
- @paths ||= begin
11
- paths = { rspec: [], minitest: [], cucumber: [] }
12
- paths[:rspec] = find_rspec_paths if TestFrameworkDetector.rspec_present?
13
- paths[:minitest] = find_minitest_paths if TestFrameworkDetector.minitest_present?
14
- paths[:cucumber] = find_cucumber_paths if TestFrameworkDetector.cucumber_present?
15
- paths
16
- end
17
- end
8
+ def initialize(base_path = '')
9
+ @base_path = base_path
10
+ end
18
11
 
19
- def count_paths
20
- find.flatten(2).length - 3
12
+ def find
13
+ @paths ||= begin
14
+ paths = { rspec: [], minitest: [], cucumber: [] }
15
+ paths[:rspec] = find_rspec_paths if TestFrameworkDetector.rspec_present?
16
+ paths[:minitest] = find_minitest_paths if TestFrameworkDetector.minitest_present?
17
+ paths[:cucumber] = find_cucumber_paths if TestFrameworkDetector.cucumber_present?
18
+ paths
21
19
  end
20
+ end
22
21
 
23
- private
22
+ def count_paths
23
+ find.flatten(2).length - 3
24
+ end
24
25
 
25
- def find_rspec_paths
26
- find_non_empty_paths(%w[spec/controllers spec/requests spec/integration spec/api spec/features spec/system])
27
- end
26
+ private
27
+
28
+ def find_rspec_paths
29
+ find_non_empty_paths(%w[spec/controllers spec/requests spec/integration spec/api spec/features spec/system])
30
+ end
28
31
 
29
32
 
30
- def find_minitest_paths
31
- find_non_empty_paths(%w[test/controllers test/integration])
32
- end
33
+ def find_minitest_paths
34
+ top_level_paths = %w[test/controllers test/integration]
35
+ children_paths = Dir.glob('test/**/{controllers,integration}')
36
+ find_non_empty_paths((top_level_paths + children_paths).uniq).sort
37
+ end
33
38
 
34
- def find_cucumber_paths
35
- find_non_empty_paths(%w[features])
36
- end
39
+ def find_cucumber_paths
40
+ find_non_empty_paths(%w[features])
41
+ end
37
42
 
38
- def find_non_empty_paths(paths)
39
- paths.select { |path| Dir.exist?(path) && !Dir.empty?(path) }
40
- end
43
+ def find_non_empty_paths(paths)
44
+ paths.select { |path| Dir.exist?(@base_path + path) && !Dir.empty?(@base_path + path) }
41
45
  end
42
46
  end
43
47
  end
@@ -69,7 +69,7 @@ module AppMap
69
69
  end
70
70
 
71
71
  def integration_test_paths
72
- @paths ||= Service::IntegrationTestPathFinder.find
72
+ @paths ||= Service::IntegrationTestPathFinder.new.find
73
73
  end
74
74
  end
75
75
  end
@@ -19,6 +19,7 @@ module AppMap
19
19
 
20
20
  def valid?
21
21
  validate_ruby_version
22
+ validate_rails_presence
22
23
  validate_config_presence
23
24
  parse_config
24
25
  validate_config_load
@@ -66,6 +67,14 @@ module AppMap
66
67
  end
67
68
  end
68
69
 
70
+ def validate_rails_presence
71
+ unless Gem.loaded_specs.has_key?('rails')
72
+ @violations << Violation.error(
73
+ message: 'AppMap auto-configuration is currently not available for non Rails projects'
74
+ )
75
+ end
76
+ end
77
+
69
78
  def validate_ruby_version
70
79
  unless RUBY_VERSION =~ AppMap::SUPPORTED_RUBY_VERSIONS_REGEX
71
80
  @violations << Violation.error(
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.60.0'
6
+ VERSION = '0.61.0'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.1'
9
9
 
@@ -28,7 +28,7 @@ describe AppMap::Service::ConfigAnalyzer do
28
28
  end
29
29
  end
30
30
 
31
- context 'with valid config' do
31
+ context 'with valid but non rails config' do
32
32
  let(:config_file) { 'spec/fixtures/config/valid_config.yml'}
33
33
 
34
34
  describe '.app_name' do
@@ -39,7 +39,7 @@ describe AppMap::Service::ConfigAnalyzer do
39
39
 
40
40
  describe '.is_valid?' do
41
41
  it 'returns true' do
42
- expect(subject.valid?).to be_truthy
42
+ expect(subject.valid?).to be_falsey
43
43
  end
44
44
  end
45
45
 
@@ -83,7 +83,7 @@ describe AppMap::Service::ConfigAnalyzer do
83
83
 
84
84
  describe '.is_valid?' do
85
85
  it 'guesses paths and returns true ' do
86
- expect(subject.valid?).to be_truthy
86
+ expect(subject.valid?).to be_falsey
87
87
  end
88
88
  end
89
89
 
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'appmap/service/integration_test_path_finder'
5
+
6
+ describe AppMap::Service::IntegrationTestPathFinder do
7
+ subject { described_class.new('./spec/fixtures/rails6_users_app/') }
8
+
9
+ describe '.count' do
10
+ it 'counts existing paths' do
11
+ expect(subject.count_paths).to be(3)
12
+ end
13
+ end
14
+
15
+ describe '.find' do
16
+ it 'finds paths' do
17
+ expect(subject.find).to eq({
18
+ rspec: %w[spec/controllers],
19
+ minitest: %w[test/controllers test/integration],
20
+ cucumber: []
21
+ })
22
+ end
23
+ end
24
+ end
@@ -13,7 +13,7 @@ class AgentSetupInitTest < Minitest::Test
13
13
  config: {
14
14
  app: 'AppMap Rubygem',
15
15
  present: true,
16
- valid: true
16
+ valid: false
17
17
  },
18
18
  project: {
19
19
  agentVersion: AppMap::VERSION,
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'test_helper'
@@ -11,13 +10,23 @@ class AgentSetupValidateTest < Minitest::Test
11
10
  def test_init_when_config_exists
12
11
  output = `./exe/appmap-agent-validate`
13
12
  assert_equal 0, $CHILD_STATUS.exitstatus
14
- assert_equal JSON.pretty_generate([]), output.strip
13
+ expected = JSON.pretty_generate([
14
+ {
15
+ level: :error,
16
+ message: 'AppMap auto-configuration is currently not available for non Rails projects'
17
+ }
18
+ ])
19
+ assert_equal expected, output.strip
15
20
  end
16
21
 
17
22
  def test_init_with_non_existing_config_file
18
23
  output = `./exe/appmap-agent-validate -c #{NON_EXISTING_CONFIG_FILENAME}`
19
24
  assert_equal 0, $CHILD_STATUS.exitstatus
20
25
  expected = JSON.pretty_generate([
26
+ {
27
+ level: :error,
28
+ message: 'AppMap auto-configuration is currently not available for non Rails projects'
29
+ },
21
30
  {
22
31
  level: :error,
23
32
  filename: NON_EXISTING_CONFIG_FILENAME,
@@ -31,6 +40,10 @@ class AgentSetupValidateTest < Minitest::Test
31
40
  output = `./exe/appmap-agent-validate -c #{INVALID_YAML_CONFIG_FILENAME}`
32
41
  assert_equal 0, $CHILD_STATUS.exitstatus
33
42
  expected = JSON.pretty_generate([
43
+ {
44
+ level: :error,
45
+ message: 'AppMap auto-configuration is currently not available for non Rails projects'
46
+ },
34
47
  {
35
48
  level: :error,
36
49
  filename: INVALID_YAML_CONFIG_FILENAME,
@@ -46,6 +59,10 @@ class AgentSetupValidateTest < Minitest::Test
46
59
  output = `./exe/appmap-agent-validate -c #{INVALID_CONFIG_FILENAME}`
47
60
  assert_equal 0, $CHILD_STATUS.exitstatus
48
61
  expected = JSON.pretty_generate([
62
+ {
63
+ level: :error,
64
+ message: 'AppMap auto-configuration is currently not available for non Rails projects'
65
+ },
49
66
  {
50
67
  level: :error,
51
68
  filename: INVALID_CONFIG_FILENAME,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.60.0
4
+ version: 0.61.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-08 00:00:00.000000000 Z
11
+ date: 2021-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -565,6 +565,7 @@ files:
565
565
  - spec/record_sql_rails_pg_spec.rb
566
566
  - spec/remote_recording_spec.rb
567
567
  - spec/service/config_analyzer_spec.rb
568
+ - spec/service/integration_test_path_finder_spec.rb
568
569
  - spec/service/validator/violation_spec.rb
569
570
  - spec/spec_helper.rb
570
571
  - spec/swagger/swagger_spec.rb