Class: Yarn::Audit::Wrap::YarnCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/yarn/audit/wrap/yarn_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts:) ⇒ YarnCommand

Returns a new instance of YarnCommand.



8
9
10
# File 'lib/yarn/audit/wrap/yarn_command.rb', line 8

def initialize opts:
  @opts = opts
end

Instance Method Details

#runObject



12
13
14
15
16
17
# File 'lib/yarn/audit/wrap/yarn_command.rb', line 12

def run
  filepath = @opts[:audit_json].to_s
  FileUtils.mkdir_p File.dirname(filepath)
  outfile = Shellwords.escape(filepath)
  system("yarn audit --json > #{outfile}")
end