Class: FunCi::Setup::SetupChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/fun_ci/setup/setup_checker.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_root:, stdout:) ⇒ SetupChecker

Returns a new instance of SetupChecker.



12
13
14
15
# File 'lib/fun_ci/setup/setup_checker.rb', line 12

def initialize(project_root:, stdout:)
  @config = ProjectConfig.new(project_root)
  @stdout = stdout
end

Class Method Details

.run(project_root:, stdout: $stdout, stderr: $stderr) ⇒ Object



8
9
10
# File 'lib/fun_ci/setup/setup_checker.rb', line 8

def self.run(project_root:, stdout: $stdout, stderr: $stderr)
  new(project_root: project_root, stdout: stdout).run
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fun_ci/setup/setup_checker.rb', line 17

def run
  errors = @config.validate

  if errors.empty?
    @stdout.puts "All OK. The project is configured."
    0
  else
    errors.each { |e| @stdout.puts e }
    1
  end
end