lib/kameleon/environment.rb in kameleon-builder-2.1.3 vs lib/kameleon/environment.rb in kameleon-builder-2.2.0
- old
+ new
@@ -5,32 +5,37 @@
class Environment
attr_accessor :workspace
attr_accessor :templates_path
attr_accessor :build_path
- attr_accessor :log_file
+ attr_accessor :cache_path
attr_accessor :debug
+ def script?
+ @script
+ end
def initialize(options = {})
- @logger = Log4r::Logger.new("kameleon::[kameleon]")
# symbolify commandline options
options = options.inject({}) {|result,(key,value)| result.update({key.to_sym => value})}
workspace = File.expand_path(Dir.pwd)
build_path = File.expand_path(options[:build_path] || File.join(workspace, "build"))
+ cache_path = File.expand_path(options[:cache_path] || File.join(build_path, "cache"))
defaults = {
:workspace => Pathname.new(workspace),
:templates_path => Kameleon.templates_path,
:templates_names => Kameleon.templates_names,
:build_path => Pathname.new(build_path),
- :log_file => Pathname.new(File.join(workspace, "kameleon.log"))
+ :cache_path => Pathname.new(cache_path),
+ :script => options[:script],
}
options = defaults.merge(options)
- @logger.debug("Environment initialized (#{self})")
+ Kameleon.ui.debug("Environment initialized (#{self})")
# Injecting all variables of the options and assign the variables
options.each do |key, value|
instance_variable_set("@#{key}".to_sym, options[key])
- @logger.debug(" @#{key} : #{options[key]}")
+ Kameleon.ui.debug(" @#{key} : #{options[key]}")
end
+ @debug = true if ENV['KAMELEON_DEBUG']
end
end
end