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.
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'lib/rscons/script.rb', line 480 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).
477 478 479 |
# File 'lib/rscons/script.rb', line 477 def autoconf @autoconf end |
#project_name ⇒ String?
Returns Project name.
472 473 474 |
# File 'lib/rscons/script.rb', line 472 def project_name @project_name end |
Instance Method Details
#configure(configure_op) ⇒ Object
Perform configure action.
520 521 522 523 524 525 526 |
# File 'lib/rscons/script.rb', line 520 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.
513 514 515 516 517 |
# File 'lib/rscons/script.rb', line 513 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 |