Class: Rscons::Script
- Inherits:
-
Object
- Object
- Rscons::Script
- Defined in:
- lib/rscons/script.rb
Overview
The Script class encapsulates the state of a build script.
Defined Under Namespace
Classes: ConfigureDsl, GlobalDsl, TopLevelDsl
Instance Attribute Summary collapse
-
#autoconf ⇒ Boolean
Whether to autoconfigure if the user does not explicitly configure before calling a normal task (default: true).
-
#project_name ⇒ String?
Project name.
Instance Method Summary collapse
-
#configure(configure_op) ⇒ Object
Perform configure action.
-
#initialize ⇒ Script
constructor
Construct a Script.
-
#load(path) ⇒ void
Load a script from the specified file.
Constructor Details
#initialize ⇒ Script
Construct a Script.
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/rscons/script.rb', line 429 def initialize @autoconf = true TopLevelDsl.new(self).instance_eval do task("clean", desc: "Remove build artifacts (but not configuration)", autoconf: false) do Rscons.application.clean end task("configure", desc: "Configure the project", autoconf: false, params: [param("prefix", "/usr/local", true, "Set installation prefix (default: /usr/local)")]) task("distclean", desc: "Remove build directory and configuration", autoconf: false) do Rscons.application.distclean end task("install", desc: "Install project to configured installation prefix") task("uninstall", desc: "Uninstall project", autoconf: false) do Rscons.application.uninstall end end end |
Instance Attribute Details
#autoconf ⇒ Boolean
Returns Whether to autoconfigure if the user does not explicitly configure before calling a normal task (default: true).
426 427 428 |
# File 'lib/rscons/script.rb', line 426 def autoconf @autoconf end |
#project_name ⇒ String?
Returns Project name.
421 422 423 |
# File 'lib/rscons/script.rb', line 421 def project_name @project_name end |
Instance Method Details
#configure(configure_op) ⇒ Object
Perform configure action.
469 470 471 472 473 474 475 |
# File 'lib/rscons/script.rb', line 469 def configure(configure_op) cdsl = ConfigureDsl.new(self, configure_op) configure_task = Task["configure"] configure_task.actions.each do |action| cdsl.instance_exec(configure_task, configure_task.param_values, &action) end end |
#load(path) ⇒ void
This method returns an undefined value.
Load a script from the specified file.
462 463 464 465 466 |
# File 'lib/rscons/script.rb', line 462 def load(path) Rscons.application.silent_configure = true script_contents = File.read(path, mode: "rb") TopLevelDsl.new(self).instance_eval(script_contents, path, 1) end |