store configuration data more opaquely in Cache
This commit is contained in:
parent
cfec0dcadc
commit
6dd9c835ce
@ -82,6 +82,8 @@ module Rscons
|
||||
#
|
||||
# @return [void]
|
||||
def configure
|
||||
cache = Cache.instance
|
||||
cache.configuration_data = {}
|
||||
if project_name = @script.project_name
|
||||
Ansi.write($stdout, "Configuring ", :cyan, project_name, :reset, "...\n")
|
||||
else
|
||||
@ -96,10 +98,8 @@ module Rscons
|
||||
rv = 1
|
||||
end
|
||||
co.close
|
||||
cache = Cache.instance
|
||||
cache.set_configured(rv == 0)
|
||||
cache.set_default_environment_vars(@default_environment.to_h)
|
||||
cache.write
|
||||
cache.write!
|
||||
rv
|
||||
end
|
||||
|
||||
|
@ -104,27 +104,21 @@ module Rscons
|
||||
@dirty = true
|
||||
end
|
||||
|
||||
# Get the default environment construction variables.
|
||||
#
|
||||
# @return [Hash]
|
||||
# Default environment construction variables.
|
||||
def get_default_environment_vars
|
||||
@cache["default_environment_vars"]
|
||||
# Access configuration data.
|
||||
def configuration_data
|
||||
@cache["configuration_data"]
|
||||
end
|
||||
|
||||
# Set the default environment construction variables.
|
||||
# Set configuration data.
|
||||
#
|
||||
# @param vars [Hash]
|
||||
# Default environment construction variables.
|
||||
#
|
||||
# @return [void]
|
||||
def set_default_environment_vars(vars)
|
||||
validate_json_object(vars)
|
||||
@cache["default_environment_vars"] = vars
|
||||
# @param value [Hash]
|
||||
# Configuration data.
|
||||
def configuration_data=(value)
|
||||
@cache["configuration_data"] = value
|
||||
@dirty = true
|
||||
end
|
||||
|
||||
# Write the cache to disk to be loaded next time.
|
||||
# Write the cache to disk if it is dirty.
|
||||
#
|
||||
# @return [void]
|
||||
def write
|
||||
@ -137,6 +131,14 @@ module Rscons
|
||||
@dirty = false
|
||||
end
|
||||
|
||||
# Force a write of the cache to disk.
|
||||
#
|
||||
# @return [void]
|
||||
def write!
|
||||
@dirty = true
|
||||
write
|
||||
end
|
||||
|
||||
# Check if target(s) are up to date.
|
||||
#
|
||||
# @param targets [Symbol, String, Array<String>]
|
||||
@ -354,6 +356,7 @@ module Rscons
|
||||
@cache["targets"] ||= {}
|
||||
@cache["directories"] ||= {}
|
||||
@cache["default_environment_vars"] ||= {}
|
||||
@cache["configuration_data"] ||= {}
|
||||
@lookup_checksums = {}
|
||||
@dirty = false
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user