Class: Rscons::Script::Dsl
Overview
Top-level DSL available to the Rsconscript.
Instance Method Summary collapse
-
#autoconf(autoconf) ⇒ Object
Whether to automatically configure (default true).
-
#build(&block) ⇒ Object
Enter build block.
-
#configure(&block) ⇒ Object
Enter configuration block.
-
#glob(*patterns) ⇒ Array<String>
Return a list of paths matching the specified pattern(s).
-
#initialize(script) ⇒ Dsl
constructor
Create a Dsl.
-
#project_name(project_name) ⇒ Object
Set the project name.
Methods inherited from GlobalDsl
#path_append, #path_components, #path_prepend, #path_set, #rscons
Constructor Details
#initialize(script) ⇒ Dsl
Create a Dsl.
88 89 90 |
# File 'lib/rscons/script.rb', line 88 def initialize(script) @script = script end |
Instance Method Details
#autoconf(autoconf) ⇒ Object
Whether to automatically configure (default true).
98 99 100 |
# File 'lib/rscons/script.rb', line 98 def autoconf(autoconf) @script.autoconf = autoconf end |
#build(&block) ⇒ Object
Enter build block.
103 104 105 |
# File 'lib/rscons/script.rb', line 103 def build(&block) @script.operations["build"] = block end |
#configure(&block) ⇒ Object
Enter configuration block.
108 109 110 |
# File 'lib/rscons/script.rb', line 108 def configure(&block) @script.operations["configure"] = block end |
#glob(*patterns) ⇒ Array<String>
Return a list of paths matching the specified pattern(s).
A pattern can contain a “/**” component to recurse through directories. If the pattern ends with “/**” then only the recursive list of directories will be returned.
Examples:
-
“src/**”: return all directories under “src”, recursively (including “src” itself).
-
“src/*/”: return all files and directories recursively under the src directory.
-
“src/*/.c”: return all .c files recursively under the src directory.
-
“dir/*/”: return all directories in dir, but no files.
127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/rscons/script.rb', line 127 def glob(*patterns) require "pathname" patterns.reduce([]) do |result, pattern| if pattern.end_with?("/**") pattern += "/" end result += Dir.glob(pattern).map do |path| Pathname.new(path.gsub("\\", "/")).cleanpath.to_s end end.sort end |
#project_name(project_name) ⇒ Object
Set the project name.
93 94 95 |
# File 'lib/rscons/script.rb', line 93 def project_name(project_name) @script.project_name = project_name end |