forked from samaaron/book_mdar
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also extract the BookBuilder::Book creation and output_dir creation into their own tasks.
- Loading branch information
1 parent
76ca033
commit 87e26b4
Showing
6 changed files
with
87 additions
and
65 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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
# Required to do just about anything with the book. | ||
require 'book_builder/book_builder' | ||
|
||
# The book tasks are loaded first, then any | ||
# additional tasks are loaded. This should | ||
# allow you to override the book tasks with | ||
# your own. | ||
Dir["tasks/book/*.rake"].each { |ext| load ext } | ||
Dir["tasks/*.rake"].each { |ext| load ext } | ||
|
||
def log(msg = '') | ||
puts msg | ||
end | ||
|
||
def deploy | ||
`scp -r book/output/* ninja@4ninjas.org:public_html/merb/` | ||
def announce(msg) | ||
log msg | ||
yield | ||
log 'Done!' | ||
end | ||
|
||
def invoke_task(*names) | ||
names.each do |name| | ||
Rake::Task[name].invoke | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
require 'book_builder/book_builder' | ||
|
||
namespace :book do | ||
desc "Outstanding TODO's" | ||
task :todo do | ||
FileList["book/source/**/*.markdown"].egrep(/TODO/) do |fn, count, line| | ||
fn.gsub!(/\D+/, '.').gsub!(/^\.|\.$/,'') | ||
log "#{line.chomp} (Section #{fn}, Line #{count})" | ||
end | ||
end | ||
|
||
desc "prepare a structure for publishing to" | ||
task :prepare => ['book:setup:book'] do | ||
announce('Preparing a publishing structure...') do | ||
@book.prepare! | ||
end | ||
end | ||
end |
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,11 @@ | ||
namespace :book do | ||
namespace :output do | ||
task :html => ['book:setup:output_dir', 'book:setup:book'] do | ||
@book.html! | ||
end | ||
|
||
task :plain => ['book:setup:output_dir', 'book:setup:book'] do | ||
@book.plain_text! | ||
end | ||
end | ||
end |
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,28 @@ | ||
namespace :book do | ||
desc "compile files from the current directory and publish to all available formats" | ||
task :publish => ['publish:html', 'publish:text'] | ||
|
||
desc "deploy the currently built version to the site" | ||
task :deploy => 'publish:deploy' | ||
|
||
namespace :publish do | ||
desc "compile files from the current directory into html" | ||
task :html do | ||
announce('Publishing HTML...') do | ||
invoke_task 'book:output:html' | ||
end | ||
end | ||
|
||
desc "compile files from the current directory into plain text" | ||
task :text do | ||
announce('Publishing Plain Text...') do | ||
invoke_task 'book:output:plain' | ||
end | ||
end | ||
|
||
desc "publish all versions and then deploy" | ||
task :deploy => ['book:output:html', 'book:output:plain'] do | ||
`scp -r book/output/* ninja@4ninjas.org:public_html/merb/` | ||
end | ||
end | ||
end |
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,12 @@ | ||
namespace :book do | ||
namespace :setup do | ||
task :output_dir do | ||
output_folder = './book/output/' | ||
Dir.mkdir(output_folder) unless File.directory?(output_folder) | ||
end | ||
|
||
task :book do | ||
@book = BookBuilder::Book.new('merb_book','./book/', :markdown) | ||
end | ||
end | ||
end |