Module: Steep::Drivers::Utils::DriverHelper

Included in:
Annotations, Check, Init, Langserver, PrintProject, Validate, Watch
Defined in:
lib/steep/drivers/utils/driver_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#steepfileObject

Returns the value of attribute steepfile.



5
6
7
# File 'lib/steep/drivers/utils/driver_helper.rb', line 5

def steepfile
  @steepfile
end

Instance Method Details

#load_config(path: steepfile || Pathname("Steepfile")) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/steep/drivers/utils/driver_helper.rb', line 7

def load_config(path: steepfile || Pathname("Steepfile"))
  raise "Cannot find a configuration at #{path}: `steep init` to scaffold" unless path.file?

  steep_file_path = path.absolute? ? path : Pathname.pwd + path
  Project.new(base_dir: steep_file_path.parent).tap do |project|
    Project::DSL.parse(project, path.read, filename: path.to_s)
  end
end

#type_check(project) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/steep/drivers/utils/driver_helper.rb', line 16

def type_check(project)
  project.targets.each do |target|
    Steep.logger.tagged "target=#{target.name}" do
      target.type_check
    end
  end
end