Module: AppProfiler::Yarn::Command

Included in:
WithSpeedscope
Defined in:
lib/app_profiler/yarn/command.rb

Defined Under Namespace

Classes: YarnError

Instance Method Summary collapse

Instance Method Details

#setup_yarnObject



26
27
28
29
30
# File 'lib/app_profiler/yarn/command.rb', line 26

def setup_yarn
  ensure_yarn_installed

  yarn("init", "--yes") unless package_json_exists?
end

#yarn(command, *options) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/app_profiler/yarn/command.rb', line 18

def yarn(command, *options)
  setup_yarn unless yarn_setup

  exec("yarn", command, *options) do
    raise YarnError, "Failed to run #{command}."
  end
end