Skip to content

Instantly share code, notes, and snippets.

@daveshah
Last active January 3, 2016 03:18
Show Gist options
  • Save daveshah/8400881 to your computer and use it in GitHub Desktop.
Save daveshah/8400881 to your computer and use it in GitHub Desktop.
Find all the snips!
def all_css_files_in(files_file)
css_files = []
File.readlines(files_file).each { |line|
unless line.start_with?("/Style%20Library","styles","http","/_control")
css_files << line.gsub("/_layouts/ui/css/","").gsub("?ver=20131220130545","").gsub("?ver=20131220130545","").gsub("?ver=20131220130545","")
end
}
css_files
end
def snip_array_from(filename)
snip_files = []
File.readlines(filename.strip).each { |line|
line.gsub(/.... INCLUDE ".+" ..../) { |match|
file = match.gsub(".... INCLUDE \"","").gsub("\" ....","").gsub("../","")
snip_files << file
}
}
snip_files
end
def find_snips_from(filelist)
filelist.each { |filename|
snip_list = snip_array_from(filename)
unless snip_list.empty?
puts "#{filename}"
snip_list.each {|f|
puts " -#{f}"
}
puts "\n\n"
end
unless !snip_list.empty?
find_snips_from(snip_list)
end
}
end
find_snips_from(all_css_files_in("style_list.out"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment