add Script class

This commit is contained in:
josh committed 2018-10-12 17:18:04 -04:00
1 parent 2f83f36659
commit a649c7f4cb
2 files changed
+28

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
module Rscons
# The Script class encapsulates the state of a build script. It also provides
# the DSL for the build script to use.
class Script
class << self
# Load a script from the specified file.
#
# @param path [String]
# File name of the rscons script to load.
#
# @return [Script]
# The loaded script state.
def load(path)
script_contents = File.read(path, mode: "rb")
script = Script.new
script.instance_eval(script_contents, path, 1)
script
end
end
end
end