Class: AppMap::Depends::AppMapJSDepends
- Inherits:
-
Object
- Object
- AppMap::Depends::AppMapJSDepends
- Includes:
- AppMapJS
- Defined in:
- lib/appmap/depends/appmap_js_depends.rb
Overview
Command
wraps the Node depends
command.
Constant Summary
Constants included from AppMapJS
AppMap::Depends::AppMapJS::APPMAP_JS
Instance Attribute Summary collapse
-
#appmap_dir ⇒ Object
Directory to scan for AppMaps.
-
#base_dir ⇒ Object
Directory name to prefix to the list of modified files which is provided to
depends
. -
#field ⇒ Object
AppMap field to report.
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(appmap_dir) ⇒ AppMapJSDepends
constructor
A new instance of AppMapJSDepends.
-
#validate ⇒ Object
Ensures that all dependencies are available.
Methods included from AppMapJS
#appmap_js_command, #detect_appmap_js, #detect_nodejs, #do_fail, #index_appmaps
Constructor Details
#initialize(appmap_dir) ⇒ AppMapJSDepends
Returns a new instance of AppMapJSDepends.
17 18 19 20 21 |
# File 'lib/appmap/depends/appmap_js_depends.rb', line 17 def initialize(appmap_dir) @appmap_dir = appmap_dir @base_dir = false @field = 'source_location' end |
Instance Attribute Details
#appmap_dir ⇒ Object
Directory to scan for AppMaps.
11 12 13 |
# File 'lib/appmap/depends/appmap_js_depends.rb', line 11 def appmap_dir @appmap_dir end |
#base_dir ⇒ Object
Directory name to prefix to the list of modified files which is provided to depends
.
13 14 15 |
# File 'lib/appmap/depends/appmap_js_depends.rb', line 13 def base_dir @base_dir end |
#field ⇒ Object
AppMap field to report.
15 16 17 |
# File 'lib/appmap/depends/appmap_js_depends.rb', line 15 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
.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/appmap/depends/appmap_js_depends.rb', line 31 def depends(modified_files = nil) validate index_appmaps(appmap_dir) 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 Depends.verbose end stdout, = appmap_js_command cmd, stdout.split("\n") end |
#validate ⇒ Object
Ensures that all dependencies are available.
24 25 26 27 |
# File 'lib/appmap/depends/appmap_js_depends.rb', line 24 def validate detect_nodejs detect_appmap_js end |