lib/arli/arli_file.rb in arli-0.9.0 vs lib/arli/arli_file.rb in arli-1.0.0

- old
+ new

@@ -16,30 +16,23 @@ def_delegators :@dependencies, *(Array.new.methods - Object.methods) include ::Arli::Library attr_accessor :dependencies, - :parsed_data, + :arlifile_hash, :arlifile_path, - :config + :config, + :device def initialize(config: Arli.config, libraries: []) self.config = config self.arlifile_path = "#{config.arlifile.path}/#{config.arlifile.name}" self.dependencies = read_dependencies(libraries) self.config.libraries.temp_dir ||= Dir.mktmpdir - if parsed_data - if parsed_data.libraries_path - self.config.libraries.path = parsed_data.libraries_path - end - - if parsed_data.lock_format - Arli.config.arlifile.lock_format = parsed_data.lock_format - end - end + configure_via_arlifile!(arlifile_hash) end alias libraries dependencies def install @@ -48,10 +41,18 @@ end end private + def configure_via_arlifile!(mash) + if mash + config.libraries.path = mash.libraries_path if mash.libraries_path + config.arlifile.lock_format = mash.lock_format if mash.lock_format + self.device = mash.device if mash.device + end + end + def within_temp_path(&block) within_path(Arli.config.libraries.temp_dir, &block) end def each_in_temp_path(&block) @@ -78,17 +79,19 @@ parse_yaml_file end end def parse_yaml_file - self.parsed_data = Hashie::Mash.new( + self.arlifile_hash = Hashie::Mash.new( Hashie::Extensions::SymbolizeKeys.symbolize_keys( ::YAML.load( - ::File.read( - self.arlifile_path) + ::File.read(self.arlifile_path) ) ) ) - parsed_data.dependencies.map {|lib| make_lib(lib)} + + config.arlifile.hash = arlifile_hash + + arlifile_hash.dependencies.map {|lib| make_lib(lib)} end end end