Module: AppProfiler::Yarn::Command

Includes:
Exec
Included in:
WithFirefoxProfiler, WithSpeedscope
Defined in:
lib/app_profiler/yarn/command.rb

Defined Under Namespace

Classes: YarnError

Instance Method Summary collapse

Instance Method Details

#setup_yarnObject



36
37
38
39
40
# File 'lib/app_profiler/yarn/command.rb', line 36

def setup_yarn
  ensure_yarn_installed

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

#valid_commandsObject



24
25
26
# File 'lib/app_profiler/yarn/command.rb', line 24

def valid_commands
  VALID_COMMANDS
end

#yarn(command, *options) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/app_profiler/yarn/command.rb', line 28

def yarn(command, *options)
  setup_yarn unless yarn_setup

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

#yarn_setupObject



42
43
44
# File 'lib/app_profiler/yarn/command.rb', line 42

def yarn_setup
  @yarn_initialized || false
end

#yarn_setup=(state) ⇒ Object



46
47
48
# File 'lib/app_profiler/yarn/command.rb', line 46

def yarn_setup=(state)
  @yarn_initialized = state
end