Module: Sinatra::Videoman::Tasks

Defined in:
lib/sinatra/videoman/rake.rb

Class Method Summary collapse

Class Method Details

.install_views_task(views_dir) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sinatra/videoman/rake.rb', line 6

def self.install_views_task views_dir
  current_path = File.expand_path(File.dirname(__FILE__))
  Dir.foreach(current_path + '/views') do |item|
    next if item == '.' or item == '..'
    File.open(File.join(current_path, 'views', item), 'r') do |file|
      if !File.exists?(File.join(views_dir, item))
        File.open(File.join(views_dir, item), 'w') do |view|
          while line = file.gets
            view.write line
          end
        end
      end
    end
  end
end