Module: BFormat

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

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.bformatObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/b_format.rb', line 8

def self.bformat
  p Dir.pwd
  @directory_all = []
  Dir.chdir 'app/views' do
      @directory_all << Dir.glob("*")
  end 
  @directory_all.flatten!
  @directory_all.each do |name|
      if name == "layouts"
          Dir.chdir 'app/views/layouts'
          File.open '_header.html.erb', "w" do |file|
              file.write APPLICATION_HTML_BOOT_HEADER
          end 
          File.open '_footer.html.erb', "w" do |file|
              file.write APPLICATION_HTML_BOOT_FOOTER
          end 
          File.open 'application.html.erb', "r" do |file|
              @data = file.read
              @data.gsub!("<%= yield %>", APPLICATION_HTML_BOOT_BODY)  
          end 
          File.open 'application.html.erb', "w" do |file|
              file.write @data 
          end 
      end 
  end 
end