Class: Steep::Drivers::PrintProject

Inherits:
Object
  • Object
show all
Includes:
Utils::DriverHelper
Defined in:
lib/steep/drivers/print_project.rb

Instance Attribute Summary collapse

Attributes included from Utils::DriverHelper

#steepfile

Instance Method Summary collapse

Methods included from Utils::DriverHelper

#load_config, #type_check

Constructor Details

#initialize(stdout:, stderr:) ⇒ PrintProject

Returns a new instance of PrintProject.



9
10
11
12
# File 'lib/steep/drivers/print_project.rb', line 9

def initialize(stdout:, stderr:)
  @stdout = stdout
  @stderr = stderr
end

Instance Attribute Details

#stderrObject (readonly)

Returns the value of attribute stderr.



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

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



4
5
6
# File 'lib/steep/drivers/print_project.rb', line 4

def stdout
  @stdout
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/steep/drivers/print_project.rb', line 14

def run
  project = load_config()

  loader = Project::FileLoader.new(project: project)
  loader.load_sources([])
  loader.load_signatures()

  project.targets.each do |target|
    stdout.puts "Target:"
    stdout.puts "  #{target.name}:"
    stdout.puts "    sources:"
    stdout.puts "      patterns:"
    target.source_patterns.each do |pattern|
      stdout.puts "        - #{pattern}"
    end
    stdout.puts "      ignores:"
    target.ignore_patterns.each do |pattern|
      stdout.puts "        - #{pattern}"
    end
    stdout.puts "      files:"
    target.source_files.each_key do |path|
      stdout.puts "        - #{path}"
    end
    stdout.puts "    signatures:"
    stdout.puts "      patterns:"
    target.signature_patterns.each do |pattern|
      stdout.puts "        - #{pattern}"
    end
    stdout.puts "      files:"
    target.signature_files.each_key do |path|
      stdout.puts "        - #{path}"
    end
    stdout.puts "    libraries:"
    target.options.libraries.each do |lib|
      stdout.puts "      - #{lib}"
    end
  end

  0
end