module Jdl

Constants

VERSION

Public Class Methods

getfiles(path,fname,output_name,template_name) click to toggle source
# File lib/jdl.rb, line 21
def self.getfiles(path,fname,output_name,template_name)
  re = []
  allre = []
  Dir.foreach(path) do |f|
      allre << f
  end
  allre.each do |f|
      fullfilename = path + "/" + f
      if f == "." or f == ".." 
       
    elsif File.directory?(fullfilename)
      resub = []
              resub = getfiles(fullfilename,fname,output_name,template_name)

              if resub.length > 0
                      ref = {}
                      ref[f] = resub
                      re << ref
              end
    
    elsif File.exist?(fullfilename) and (f =~ /\.#{fname}$/) # only rb file
      self.print_arr(fullfilename,output_name,template_name)
      # p  ff
      re << f
      # p fullfilename
    end
  end
  
  return re
end
parse(options) click to toggle source
# File lib/jdl.rb, line 5
def self.parse(options)
  path = options[:path]
  file_ex = options[:file_ex]
  output_name = options[:output_name]
  template_name = options[:template_name]

  p "path = #{path}"                if(options[:debug])
  p "file_ex = #{file_ex}"          if(options[:debug])
  p "output_name = #{output_name}"  if(options[:debug])
  
  File.delete(options[:output_name]) if File.exist?(options[:output_name])
  
  self.getfiles(path,file_ex,output_name,template_name);

end
print_arr(content,filename='jdl.js',template_name) click to toggle source