lib/manifest_handler.rb in inqlude-0.7.0 vs lib/manifest_handler.rb in inqlude-0.7.1

- old
+ new

@@ -24,50 +24,42 @@ @libraries = Array.new @manifests = Array.new end def manifest_path manifest - if manifest["schema_type"] == "release" - return File.join( @settings.manifest_path, manifest["name"], - "#{manifest["name"]}.#{manifest["release_date"]}.manifest" ) - else - return File.join( @settings.manifest_path, manifest["name"], - "#{manifest["name"]}.manifest" ) - end + File.join(@settings.manifest_path, manifest.path) end def libraries maturity = nil if !maturity return @libraries else return @libraries.select do |l| manifest = l.latest_manifest - manifest["maturity"] == maturity.to_s && - manifest["licenses"] != [ "Commercial" ] + manifest.maturity == maturity.to_s && + manifest.licenses != [ "Commercial" ] end end end def unreleased_libraries return @libraries.select do |l| - manifest = l.latest_manifest - manifest["schema_type"] == "generic" && - manifest["licenses"] != [ "Commercial" ] + !l.latest_manifest.is_released? end end def commercial_libraries return @libraries.select do |l| manifest = l.latest_manifest - manifest["licenses"].include? "Commercial" + manifest.licenses.include? "Commercial" end end def group name return @libraries.select do |l| manifest = l.latest_manifest - manifest["group"] == name + manifest.group == name end end def library name @libraries.each do |library| @@ -77,17 +69,16 @@ end nil end def manifest name - read_remote @libraries.each do |library| if library.name == name return library.latest_manifest end end - raise "Unable to find manifest '#{name}'" + raise InqludeError.new("Unable to find manifest '#{name}'") end def read_remote @libraries.clear @manifests.clear @@ -123,6 +114,13 @@ system "git clone git://anongit.kde.org/websites/inqlude-data " + "#{@settings.manifest_path}" end end + def generate_inqlude_all + all = [] + libraries.each do |l| + all.push(l.latest_manifest.to_hash) + end + JSON.pretty_generate(all) + end end