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.
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/rscons/script.rb', line 488 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).
485 486 487 |
# File 'lib/rscons/script.rb', line 485 def autoconf @autoconf end |
#project_name ⇒ String?
Returns Project name.
480 481 482 |
# File 'lib/rscons/script.rb', line 480 def project_name @project_name end |
Instance Method Details
#configure(configure_op) ⇒ Object
Perform configure action.
528 529 530 531 532 533 534 |
# File 'lib/rscons/script.rb', line 528 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.
521 522 523 524 525 |
# File 'lib/rscons/script.rb', line 521 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 |