public
Description: Life On The Edge With Merb, DataMapper & RSpec
Homepage: http://blog.new-bamboo.co.uk
Clone URL: git://github.com/deimos1986/book_mdar.git
Search Repo:
commit  6fffb7a938c3bcea5ba458b7f69882586a103aae
tree    d8aea756f82fb5de9bafa5bcb0ed5800d229b13f
parent  c6c19fd9837280213b212b48b599a483379ba967
book_mdar / Rakefile
100644 69 lines (53 sloc) 1.319 kb
1
2
3
4
5
6
7
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require 'book_builder/book_builder'
 
 
 
namespace :book do
  desc "compile files from the current directory and publish to all available formats"
  task :publish do
    html()
    plain_text()
    log 'Done!'
  end
  
  desc "Outstanding TODO's"
  task :todo do
    system('grep --exclude=\*.svn\* -hr TODO book/source/')
  end
 
  namespace :publish do
    desc "compile files from the current directory into html"
    task :html do
      log 'Publishing HTML...'
      html
      log 'Done!'
    end
  
    desc "compile files from the current directory into pain text"
    task :text do
      log 'Publishing plain text...'
      plain_text
      log 'Done!'
    end
  end
  
  desc "prepare a structure for publishing to"
  task :prepare do
    log 'Preparing a publsiing structure...'
    book = default_book
    book.prepare!
    log 'Done!'
  end
end
 
# crate an html output
def html
  book = default_book
  log 'Processing HTML format...'
  book.html!
end
 
# crate a plain text output
def plain_text
  book = default_book
  log 'Processing Plain Text format...'
  book.plain_text!
end
 
 
# this is here as a helper so we can send messages somewhere other than stdout at a later date if we want to.
def log(msg='')
  puts msg
end
 
def default_book
  BookBuilder::Book.new('merb_book','./book/', :markdown)
end