Module: Jdl

Defined in:
lib/jdl.rb,
lib/jdl/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.getfiles(path, fname, output_name) ⇒ Object

Your code goes here… create runtest.rb for rails. e.g. :(the name of this file is createruntest.rb) #>ruby createruntest.rb ./test > runtest.sh #>chmod 777 runtest.sh



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/jdl.rb', line 10

def self.getfiles(path,fname,output_name)
  re = []
  allre = []
  ff = []
  Dir.foreach(path) do |f|
    allre << f
  end
  allre.each do |f|
    fullfilename = path + "/" + f
    
    # p fullfilename
    
    if f == "." or f == ".." 
       
    elsif File.directory?(fullfilename)
      resub = []
      resub = getfiles(fullfilename,fname,output_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)
      # p  ff
      re << f
      ff << fullfilename
    end
  end
  
  # p extname
  return re
  # return ff
end


48
49
50
51
52
# File 'lib/jdl.rb', line 48

def self.print_arr(content,filename='jdl.js')
  f=open(filename,"a") 
  f.puts("<script src='#{content}'></script>") 
  f.close
end