appmap 0.20.0 → 0.21.0

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: e7b445cafb60cb09ec8ac53a47ce2a18983679f4c0b12d57d3296b95ad18e99b
4
- data.tar.gz: 32bd5984db62f59553902802e6d21627470f664b049c7b4501e3522ce7ac3c73
3
+ metadata.gz: 2f6f185625c62dee8266aaca7dc13d15994bf1ebe947569e134da574a0a557a0
4
+ data.tar.gz: 46c6c133477606f5ba908b710fa69fd44063b91b4e966e8d1d36fb5eb8b4aa6b
5
5
  SHA512:
6
- metadata.gz: 0a910eaf05acbcdc0d0c39ce1aacd992efc4ea85f725325557edcfb1b61df32dbcdec4f2ee614296a0c7d97248dca067259adf059b4e6a7390b4b64561247474
7
- data.tar.gz: 6d5d2766f9b1b558349b25926c3dd23b6489e6991c3fa6cde6bd865de7db9d99470c1c1fe606abe1366d77f8995f4cde440626bce417baa2f2d512114dd835d0
6
+ metadata.gz: 82ed069dbe728941c732d1b9c9e5681a6d31544df703a859e4e3a8c75fe0fde906036bfaaabebac5ad2f2cab5df1176e2233f16e975ab39f2eca1bac592fd3f0
7
+ data.tar.gz: 77d93bb43e7efdc5cd81570422af35aac203e84438eea375eb18f07d5ed3e0a76ad7383ba808daa1cc8ac0e7f5a1a224c3857131aef7fbe5a64c323fefacdab7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.21.0
2
+
3
+ * Scenario data includes `recorder` and `client` info, describing how the data was recorded.
4
+
1
5
  # v0.20.0
2
6
 
3
7
  Updated to [AppMap file format](https://github.com/applandinc/appmap) version 1.2.
data/README.md CHANGED
@@ -145,17 +145,19 @@ unless Rails.env.test?
145
145
  end
146
146
  ```
147
147
 
148
- 2. Start your Rails application server. For example:
148
+ 2. Download and unpack the [AppLand browser extension](https://github.com/applandinc/appland-browser-extension). Install into Chrome using `chrome://extensions/`. Turn on "Developer Mode" and then load the extension using the "Load unpacked" button.
149
+
150
+ 3. Start your Rails application server. For example:
149
151
 
150
152
  ```sh-session
151
153
  $ bundle exec rails server
152
154
  ```
153
155
 
154
- 3. Open the AppApp browser extension and push `Start`.
156
+ 4. Open the AppApp browser extension and push `Start`.
155
157
 
156
- 4. Use your app. For example, perform a login flow, or run through a manual UI test.
158
+ 5. Use your app. For example, perform a login flow, or run through a manual UI test.
157
159
 
158
- 5. Open the AppApp browser extension and push `Stop`. The recording will be transferred to the AppLand website and opened in your browser.
160
+ 6. Open the AppApp browser extension and push `Stop`. The recording will be transferred to the AppLand website and opened in your browser.
159
161
 
160
162
  # Uploading AppMaps
161
163
 
data/appmap.gemspec CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
@@ -9,8 +10,8 @@ Gem::Specification.new do |spec|
9
10
  spec.authors = ['Kevin Gilpin']
10
11
  spec.email = ['kgilpin@gmail.com']
11
12
 
12
- spec.summary = %q{Inspect and trace your Ruby code, generating a JSON data file.}
13
- spec.homepage = 'https://github.com/kgilpin/appmap-ruby'
13
+ spec.summary = %q{Record the operation of a Ruby program, using the AppLand 'AppMap' format.}
14
+ spec.homepage = AppMap::URL
14
15
  spec.license = 'MIT'
15
16
 
16
17
  # Specify which files should be added to the gem when it is released.
@@ -11,6 +11,11 @@ module AppMap
11
11
  name: 'ruby',
12
12
  engine: RUBY_ENGINE,
13
13
  version: RUBY_VERSION
14
+ },
15
+ client: {
16
+ name: 'appmap',
17
+ url: AppMap::URL,
18
+ version: AppMap::VERSION
14
19
  }
15
20
  }.tap do |m|
16
21
  if defined?(::Rails)
@@ -69,6 +69,9 @@ module AppMap
69
69
 
70
70
  require 'appmap/command/record'
71
71
  metadata = AppMap::Command::Record.detect_metadata
72
+ metadata[:recorder] = {
73
+ name: 'remote_recording'
74
+ }
72
75
 
73
76
  response = JSON.generate(version: AppMap::APPMAP_FORMAT_VERSION, classMap: @features, metadata: metadata, events: @events)
74
77
 
data/lib/appmap/rspec.rb CHANGED
@@ -42,6 +42,9 @@ module AppMap
42
42
  name: 'rspec',
43
43
  version: Gem.loaded_specs['rspec-core']&.version&.to_s
44
44
  }
45
+ m[:recorder] = {
46
+ name: 'rspec'
47
+ }
45
48
  end
46
49
 
47
50
  appmap = {
@@ -272,14 +275,17 @@ module AppMap
272
275
  description = []
273
276
  leaf = scope = ScopeExample.new(example)
274
277
  feature_group = feature = nil
275
- labels = scope.labels.map(&:to_s).map(&:strip).reject(&:blank?).map(&:downcase).uniq
276
278
 
279
+ labels = []
277
280
  while scope
281
+ labels += scope.labels
278
282
  description << scope.description
279
283
  feature ||= scope.feature
280
284
  feature_group ||= scope.feature_group
281
285
  scope = scope.parent
282
286
  end
287
+
288
+ labels = labels.map(&:to_s).map(&:strip).reject(&:blank?).map(&:downcase).uniq
283
289
  description.reject!(&:nil?).reject(&:blank?)
284
290
  default_description = description.last
285
291
  description.reverse!
@@ -135,7 +135,7 @@ module AppMap
135
135
  end
136
136
 
137
137
  def collect_parameters(tp)
138
- tp.self.method(tp.method_id).parameters.collect do |pinfo|
138
+ -> { tp.self.method(tp.method_id).parameters rescue [] }.call.collect do |pinfo|
139
139
  kind, key = pinfo
140
140
  value = value_in_binding(tp, key)
141
141
  {
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppMap
4
- VERSION = '0.20.0'
4
+ URL = 'https://github.com/applandinc/appmap-ruby'
5
+
6
+ VERSION = '0.21.0'
5
7
 
6
8
  APPMAP_FORMAT_VERSION = '1.2'
7
9
  end
@@ -0,0 +1,9 @@
1
+ require 'rspec'
2
+ require 'appmap/rspec'
3
+ require 'hello'
4
+
5
+ describe Hello, feature_group: 'Saying hello' do
6
+ it 'says hello', feature: 'Speak hello', appmap: true do
7
+ expect(Hello.new.say_hello).to eq('Hello!')
8
+ end
9
+ end
@@ -2,8 +2,8 @@ require 'rspec'
2
2
  require 'appmap/rspec'
3
3
  require 'hello'
4
4
 
5
- describe Hello, feature_group: 'Hello' do
6
- it 'says hello', feature: 'Say hello', appmap: true do
5
+ describe Hello, appmap: 'hello' do
6
+ it 'says hello', appmap: 'speak' do
7
7
  expect(Hello.new.say_hello).to eq('Hello!')
8
8
  end
9
9
  end
@@ -0,0 +1,9 @@
1
+ require 'rspec'
2
+ require 'appmap/rspec'
3
+ require 'hello'
4
+
5
+ describe Hello, appmap: true do
6
+ it 'says hello' do
7
+ expect(Hello.new.say_hello).to eq('Hello!')
8
+ end
9
+ end
data/test/rspec_test.rb CHANGED
@@ -5,18 +5,58 @@ require 'test_helper'
5
5
  require 'English'
6
6
 
7
7
  class RSpecTest < Minitest::Test
8
- def test_record_rspec
8
+ def perform_test(test_name)
9
9
  Bundler.with_clean_env do
10
10
  Dir.chdir 'test/fixtures/rspec_recorder' do
11
- appmap_file = 'tmp/appmap/rspec/Hello_says_hello.json'
12
11
  FileUtils.rm_rf 'tmp'
13
12
  system 'bundle'
14
- system({ 'APPMAP' => 'true' }, 'bundle exec rspec')
15
- assert File.file?(appmap_file), 'appmap output file does not exist'
16
- assert_includes File.read(appmap_file), %("class":"String","value":"Hello!")
17
- assert_includes File.read(appmap_file), %("feature":"Say hello")
18
- assert_includes File.read(appmap_file), %("feature_group":"Hello")
13
+ system({ 'APPMAP' => 'true' }, %(bundle exec rspec spec/#{test_name}.rb))
14
+
15
+ yield
19
16
  end
20
17
  end
21
18
  end
19
+
20
+ def test_record_decorated_rspec
21
+ perform_test 'decorated_hello_spec' do
22
+ appmap_file = 'tmp/appmap/rspec/Hello_says_hello.appmap.json'
23
+
24
+ assert File.file?(appmap_file), 'appmap output file does not exist'
25
+ appmap = JSON.parse(File.read(appmap_file))
26
+ assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
27
+ assert_includes appmap.keys, 'metadata'
28
+ metadata = appmap['metadata']
29
+ assert_equal 'Saying hello', metadata['feature_group']
30
+ assert_equal 'Speak hello', metadata['feature']
31
+ assert_equal 'Hello says hello', metadata['name']
32
+ assert_includes metadata.keys, 'client'
33
+ assert_equal({ name: 'appmap', url: AppMap::URL, version: AppMap::VERSION }.stringify_keys, metadata['client'])
34
+ assert_includes metadata.keys, 'recorder'
35
+ assert_equal({ name: 'rspec' }.stringify_keys, metadata['recorder'])
36
+ end
37
+ end
38
+
39
+ def test_record_plain_rspec
40
+ perform_test 'plain_hello_spec' do
41
+ appmap_file = 'tmp/appmap/rspec/Hello_says_hello.appmap.json'
42
+ assert File.file?(appmap_file), 'appmap output file does not exist'
43
+ appmap = JSON.parse(File.read(appmap_file))
44
+ assert_includes appmap.keys, 'metadata'
45
+ metadata = appmap['metadata']
46
+ assert_equal 'Hello', metadata['feature_group']
47
+ assert_equal 'Hello', metadata['feature']
48
+ assert_equal 'Hello says hello', metadata['name']
49
+ end
50
+ end
51
+
52
+ def test_record_labeled_rspec
53
+ perform_test 'labeled_hello_spec' do
54
+ appmap_file = 'tmp/appmap/rspec/Hello_says_hello.appmap.json'
55
+ assert File.file?(appmap_file), 'appmap output file does not exist'
56
+ appmap = JSON.parse(File.read(appmap_file))
57
+ assert_includes appmap.keys, 'metadata'
58
+ metadata = appmap['metadata']
59
+ assert_equal %w[hello speak], metadata['labels'].sort
60
+ end
61
+ end
22
62
  end
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.20.0
4
+ version: 0.21.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: 2019-12-06 00:00:00.000000000 Z
11
+ date: 2019-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -467,7 +467,9 @@ files:
467
467
  - test/fixtures/rspec_recorder/Gemfile
468
468
  - test/fixtures/rspec_recorder/appmap.yml
469
469
  - test/fixtures/rspec_recorder/lib/hello.rb
470
- - test/fixtures/rspec_recorder/spec/hello_spec.rb
470
+ - test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb
471
+ - test/fixtures/rspec_recorder/spec/labeled_hello_spec.rb
472
+ - test/fixtures/rspec_recorder/spec/plain_hello_spec.rb
471
473
  - test/fixtures/trace_test/trace_program_1.rb
472
474
  - test/implicit_inspect_test.rb
473
475
  - test/include_exclude_test.rb
@@ -475,7 +477,7 @@ files:
475
477
  - test/rspec_test.rb
476
478
  - test/test_helper.rb
477
479
  - test/trace_test.rb
478
- homepage: https://github.com/kgilpin/appmap-ruby
480
+ homepage: https://github.com/applandinc/appmap-ruby
479
481
  licenses:
480
482
  - MIT
481
483
  metadata: {}
@@ -497,5 +499,5 @@ requirements: []
497
499
  rubygems_version: 3.0.3
498
500
  signing_key:
499
501
  specification_version: 4
500
- summary: Inspect and trace your Ruby code, generating a JSON data file.
502
+ summary: Record the operation of a Ruby program, using the AppLand 'AppMap' format.
501
503
  test_files: []