forked from pope/ticgit-watchtower
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a Rakefile to build out the app into one sinatra file
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Variables | ||
view_files = Dir.glob('views/*') | ||
|
||
task :default => ['pkg/watchtower.rb'] | ||
|
||
directory 'pkg' | ||
|
||
desc "Builds the single sinatra file for serving everything up" | ||
file 'pkg/watchtower.rb' => ['pkg', 'watchtower.rb'].concat(view_files) do | ||
open('pkg/watchtower.rb', 'w') do |outfile| | ||
open('watchtower.rb') do |watchtower| | ||
while line = watchtower.gets | ||
outfile.puts line | ||
end | ||
outfile.puts "user_in_file_templates!" | ||
outfile.puts "__END__" | ||
end | ||
view_files.each do |view_file| | ||
outfile.puts "##" + File.basename(view_file, File.extname(view_file)) | ||
open(view_file) do |infile| | ||
while line = infile.gets | ||
outfile.puts line | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
desc "Remove the build files" | ||
task :clean do | ||
rm_rf 'pkg' | ||
end |