Class: GDK::Command::Pristine

Inherits:
BaseCommand show all
Defined in:
lib/gdk/command/pristine.rb

Overview

Handles ‘gdk pristine` command execution

Constant Summary collapse

GO_CLEAN_CACHE_CMD =
'go clean -cache'
BUNDLE_PRISTINE_CMD =
'bundle pristine'
YARN_CLEAN_CMD =
'yarn clean'
GIT_CLEAN_TMP_CMD =
'git clean -fX -- tmp/'
RESET_CONFIGS_CMD =
'make reconfigure'

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#config, #display_help_message, #help, #initialize, #print_help, #print_ready_message, #ready_messages, validate_config?

Constructor Details

This class inherits a constructor from GDK::Command::BaseCommand

Instance Method Details

#bundle_install_cmdObject



39
40
41
# File 'lib/gdk/command/pristine.rb', line 39

def bundle_install_cmd
  "bundle install --jobs #{GDK.config.restrict_cpu_count} --quiet"
end

#run(_args = []) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/gdk/command/pristine.rb', line 15

def run(_args = [])
  %i[
    gdk_stop
    gdk_tmp_clean
    go_clean_cache
    gdk_bundle
    reset_configs
    gitlab_bundle
    gitlab_tmp_clean
    gitlab_yarn_clean
  ].each do |task_name|
    run_task(task_name)
  end

  GDK::Output.success("Successfully ran 'gdk pristine'!")

  true
rescue StandardError => e
  GDK::Output.error("Failed to run 'gdk pristine' - #{e.message}.", e)
  display_help_message

  false
end