class Textigniter::Parsers::ManifestParser
Public Class Methods
new()
click to toggle source
# File lib/textigniter/parsers/manifest_parser.rb, line 3 def initialize end
Public Instance Methods
get_manifest(filename)
click to toggle source
get the manifest
# File lib/textigniter/parsers/manifest_parser.rb, line 26 def get_manifest(filename) # manifiest file path file = "#{$twd}/manifests/#{filename}.yml" # check to see if manifest exists if File.file?(file) # get the contents the_manifest = YAML::load(File.open(file)) else # fake contents the_manifest = Array.new end # return the manifiest return the_manifest end
write_manifest(format)
click to toggle source
# File lib/textigniter/parsers/manifest_parser.rb, line 7 def write_manifest(format) # get the items items = Dir.glob("#{$twd}/#{format}/**/*") # create an array to store the new build list in manifest = Array.new # Clean up the build list items.each do |l| # if not a directory keep the file unless File.directory?(l) manifest.push({ filename: l, modified_at: File.mtime(l) }) end end # write the manifest to file File.open("#{$twd}/manifests/#{format}.yml", 'w') do |file| file.write manifest.to_yaml end end