Advertisement
Guest User

Untitled

a guest
Mar 5th, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.01 KB | None | 0 0
  1. module Skimmer
  2.  
  3.     def self.locate_html
  4.         html_file_paths = []
  5.         html_include_paths = []
  6.         Find.find(Dir.pwd) do |path|
  7.             if FileTest.directory?(path)
  8.                 if File.basename(path) == "build"
  9.                     Find.prune
  10.                 else
  11.                     next
  12.                 end
  13.             else
  14.                 html_file_paths << path if path =~ /.*\/[^_][^\/]*\.html$/
  15.                 html_include_paths << path if path =~ /.*\/[_][^\/]*\.html$/
  16.             end
  17.         end
  18.         [html_file_paths,html_include_paths]
  19.     end
  20.  
  21.     def self.init_build(html_array)
  22.         if Dir.exists?('build')
  23.             Find.find("#{Dir.pwd}/build/") do |path|
  24.                 File.delete(path) if path =~ /.*\.html$/
  25.             end
  26.         else
  27.             Dir.mkdir 'build'
  28.         end
  29.         puts html_array[0]
  30.         html_array[0].each do |page|
  31.             puts page.inspect
  32.             FileUtils.cp(page,"#{Dir.pwd}/build/")
  33.         end
  34.     end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement