Class CacheController
In: app/controllers/cache_controller.rb
Parent: ApplicationController

Methods

Public Instance methods

Methods

[Source]

    # File app/controllers/cache_controller.rb, line 21
21:   def source
22:     self.regenerate_source_archive
23:     send_file "#{RAILS_ROOT}/public/do/code/source.zip",
24:         :filename => 'source.zip'
25:   end

Protected Instance methods

Sub-methods

[Source]

    # File app/controllers/cache_controller.rb, line 31
31:   def regenerate_source_archive
32:     system "rm -f #{RAILS_ROOT}/tmp/source.zip"
33:     Zip::ZipFile.open("#{RAILS_ROOT}/tmp/source.zip",
34:         Zip::ZipFile::CREATE) {|zipfile|
35:       globs = Array.new
36:       files = Array.new
37:       files.push("Rakefile",
38:                  "README")
39:       globs.push(File.join("app","**", "[^.]*"))
40:       globs.push(File.join("components","**", "[^.]*"))
41:       globs.push(File.join("config","**", "*.tmpl"))
42:       files.push("config/boot.rb",
43:                  "config/daemons.yml",
44:                  "config/environment.rb",
45:                  "config/routes.rb")
46:       globs.push(File.join("config/environments","**", "[^.]*"))
47:       globs.push(File.join("config/initializers","**", "[^.]*"))
48:       globs.push(File.join("db/migrate","**", "[^.]*"))
49:       files.push("db/schema.rb")
50:       files.push("doc/CONTRIBUTORS",
51:                  "doc/DEVELOPMENT_GUIDE",
52:                  "doc/FAQ",
53:                  "doc/JOINING",
54:                  "doc/LICENSE",
55:                  "doc/OTHER_LICENSES",
56:                  "doc/README_FOR_APP")
57:       globs.push(File.join("lib","**", "[^.]*"))
58:       files.push("public/404.html",
59:                  "public/500.hml",
60:                  "public/dispatch.cgi",
61:                  "public/dispatch.fcgi",
62:                  "public/dispatch.rb",
63:                  "public/favicon.ico",
64:                  "public/robots.txt")
65:       globs.push(File.join("public/images","**", "[^.]*"))
66:       globs.push(File.join("public/javascripts","**", "[^.]*"))
67:       globs.push(File.join("public/stylesheets","**", "[^.]*"))
68:       globs.push(File.join("script","**", "[^.]*"))
69:       globs.push(File.join("test","**", "[^.]*"))
70:       globs.push(File.join("vendor","**", "[^.]*"))
71:       Dir.chdir(RAILS_ROOT) # For lighttpd
72:       globs.each {|glob|
73:         files.concat(Dir.glob(glob))
74:       }
75:       files.each {|file_name|
76:         if File.exists?(file_name)
77:           zipfile.add(file_name,file_name)
78:         end
79:       }
80:     }
81:     File.makedirs("#{RAILS_ROOT}/public/do/code")
82:     File.rename("#{RAILS_ROOT}/tmp/source.zip","#{RAILS_ROOT}/public/do/code/source.zip")
83:   end

[Validate]