Class: AppMap::Depends::NodeCLI
- Defined in:
- lib/appmap/depends/node_cli.rb
Overview
Command
wraps the Node depends
command.
Constant Summary
Constants inherited from NodeCLI
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
Directory name to prefix to the list of modified files which is provided to
depends
. -
#field ⇒ Object
AppMap field to report.
Attributes inherited from NodeCLI
Instance Method Summary collapse
-
#depends(modified_files = nil) ⇒ Object
Returns the source_location field of every AppMap that is “out of date” with respect to one of the
modified_files
. -
#initialize(verbose:, appmap_dir:) ⇒ NodeCLI
constructor
A new instance of NodeCLI.
Methods inherited from NodeCLI
#command, #detect_nodejs, #index_appmaps
Constructor Details
#initialize(verbose:, appmap_dir:) ⇒ NodeCLI
Returns a new instance of NodeCLI.
15 16 17 18 19 20 |
# File 'lib/appmap/depends/node_cli.rb', line 15 def initialize(verbose:, appmap_dir:) super(verbose: verbose, appmap_dir: appmap_dir) @base_dir = nil @field = 'source_location' end |
Instance Attribute Details
#base_dir ⇒ Object
Directory name to prefix to the list of modified files which is provided to depends
.
11 12 13 |
# File 'lib/appmap/depends/node_cli.rb', line 11 def base_dir @base_dir end |
#field ⇒ Object
AppMap field to report.
13 14 15 |
# File 'lib/appmap/depends/node_cli.rb', line 13 def field @field end |
Instance Method Details
#depends(modified_files = nil) ⇒ Object
Returns the source_location field of every AppMap that is “out of date” with respect to one of the modified_files
.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/appmap/depends/node_cli.rb', line 24 def depends(modified_files = nil) index_appmaps cmd = %w[depends] cmd += [ '--field', field ] if field cmd += [ '--appmap-dir', appmap_dir ] if appmap_dir cmd += [ '--base-dir', base_dir ] if base_dir = {} if modified_files cmd << '--stdin-files' [:stdin_data] = modified_files.map(&:shellescape).join("\n") warn "Checking modified files: #{modified_files.join(' ')}" if verbose end stdout, = command cmd, stdout.split("\n") end |