lib/veewee/environment.rb in veewee-0.4.0 vs lib/veewee/environment.rb in veewee-0.4.1

- old
+ new

@@ -24,14 +24,14 @@ # - :template_path : paths that contains the template definitions that come with the veewee gem, defaults to the path relative to the gemfiles # - :iso_dir : directory to look for iso files, defaults to $environment_dir/iso # - :validation_dir : directory that contains a list of validation tests, that can be run after building a box # - :tmp_dir : directory that will be used for creating temporary files, needs to be rewritable, default to $environment_dir/tmp attr_accessor :template_path - attr_accessor :definition_dir - attr_accessor :iso_dir + attr_writer :definition_dir + attr_writer :iso_dir attr_accessor :validation_dir - attr_accessor :tmp_dir + attr_writer :tmp_dir # The {UI} Object to communicate with the outside world attr_writer :ui # The configuration as loaded @@ -64,15 +64,12 @@ cwd = options[:cwd] || Veewee::Environment.workdir defaults = { :cwd => cwd, :veewee_filename => "Veeweefile", - :definition_dir => File.join(cwd, "definitions"), :template_path => [File.expand_path(File.join(File.dirname(__FILE__), "..", "..", 'templates')), "templates"], - :iso_dir => File.join(cwd, "iso"), :validation_dir => File.join(File.expand_path(File.join(File.dirname(__FILE__), "..", "..")), "validation"), - :tmp_dir => File.join(cwd, "tmp") } options = defaults.merge(options) @config_filepath = File.join(options[:cwd], options[:veewee_filename]) @@ -103,9 +100,19 @@ yamlfile = File.join(File.dirname(__FILE__), "config", "ostypes.yml") logger.info "Reading ostype yamlfile #{yamlfile}" @ostypes = YAML.load_file(yamlfile) return self + end + + def definition_dir + @definition_dir ||= File.join(cwd, "definitions") + end + def iso_dir + @iso_dir ||= File.join(cwd, "iso") + end + def tmp_dir + tmp_dir ||= File.join(cwd, "tmp") end def self.workdir ENV['VEEWEE_DIR'] || Dir.pwd end