Class: EasyCreds::Onboarding::GemSetup

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_creds/onboarding/gem_setup.rb

Constant Summary collapse

GLOBAL_DIRS =
%w[log templates projects].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prompt:) ⇒ GemSetup

Returns a new instance of GemSetup.



12
13
14
# File 'lib/easy_creds/onboarding/gem_setup.rb', line 12

def initialize(prompt:)
  @prompt = prompt
end

Class Method Details

.run(prompt:) ⇒ Object



8
9
10
# File 'lib/easy_creds/onboarding/gem_setup.rb', line 8

def self.run(prompt:)
  new(prompt: prompt).run
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/easy_creds/onboarding/gem_setup.rb', line 16

def run
  Theme.section('easy_creds — first time setup')

  global_dir = ask_global_dir
  EasyCreds.configure { |c| c.global_dir = global_dir }
  create_dirs(global_dir)
  seed_default_template(global_dir)
  seed_projects_registry(global_dir)
  check_op_cli!
  ensure_signed_in
  vault = pick_vault
  EasyCreds.configure { |c| c.default_vault = vault }
  write_config(global_dir)

  Theme.success("Setup complete. Config written to #{global_dir}/config.yml")
  Theme.notice('Run `easy_creds onboard` inside a project to scaffold credentials.')
  global_dir
end