Module: Steep::Project::DSL::LibraryOptions

Included in:
Steep::Project::DSL, TargetDSL
Defined in:
lib/steep/project/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collection_config_pathObject (readonly)

Returns the value of attribute collection_config_path.



7
8
9
# File 'lib/steep/project/dsl.rb', line 7

def collection_config_path
  @collection_config_path
end

#core_rootObject (readonly)

Returns the value of attribute core_root.



6
7
8
# File 'lib/steep/project/dsl.rb', line 6

def core_root
  @core_root
end

#stdlib_rootObject (readonly)

Returns the value of attribute stdlib_root.



5
6
7
# File 'lib/steep/project/dsl.rb', line 5

def stdlib_root
  @stdlib_root
end

Instance Method Details

#collection_config(path) ⇒ Object



19
20
21
22
# File 'lib/steep/project/dsl.rb', line 19

def collection_config(path)
  @library_configured = true
  @collection_config_path = project.absolute_path(path)
end

#disable_collectionObject



24
25
26
27
# File 'lib/steep/project/dsl.rb', line 24

def disable_collection
  @library_configured = true
  @collection_config_path = false
end

#librariesObject



38
39
40
# File 'lib/steep/project/dsl.rb', line 38

def libraries
  @libraries ||= []
end

#library(*args) ⇒ Object



29
30
31
32
# File 'lib/steep/project/dsl.rb', line 29

def library(*args)
  @library_configured = true
  libraries.push(*args)
end

#library_configured?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/steep/project/dsl.rb', line 42

def library_configured?
  @library_configured
end

#repo_path(*paths) ⇒ Object



14
15
16
17
# File 'lib/steep/project/dsl.rb', line 14

def repo_path(*paths)
  @library_configured = true
  repo_paths.push(*paths.map {|s| Pathname(s) })
end

#repo_pathsObject



34
35
36
# File 'lib/steep/project/dsl.rb', line 34

def repo_paths
  @repo_paths ||= []
end

#stdlib_path(core_root:, stdlib_root:) ⇒ Object



9
10
11
12
# File 'lib/steep/project/dsl.rb', line 9

def stdlib_path(core_root:, stdlib_root:)
  @core_root = Pathname(core_root)
  @stdlib_root = Pathname(stdlib_root)
end

#to_library_optionsObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/steep/project/dsl.rb', line 46

def to_library_options
  config_path =
    case collection_config_path
    when Pathname
      collection_config_path
    when nil
      default = project.absolute_path(RBS::Collection::Config::PATH)
      if default.file?
        default
      end
    when false
      nil
    end

  Options.new.tap do |options|
    options.libraries.push(*libraries)
    options.paths = Options::PathOptions.new(
      core_root: core_root,
      stdlib_root: stdlib_root,
      repo_paths: repo_paths
    )
    options.collection_config_path = config_path
  end
end