-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
88 lines (71 loc) · 2.3 KB
/
Rakefile
File metadata and controls
88 lines (71 loc) · 2.3 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
require 'rubygems'
#require 'bundler'
#begin
# Bundler.setup(:default, :development)
#rescue Bundler::BundlerError => e
# $stderr.puts e.message
# $stderr.puts "Run `bundle install` to install missing gems"
# exit e.status_code
#end
require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "vocco"
gem.homepage = "http://github.com/jbe/vocco"
gem.license = "MIT"
gem.summary = %Q{vocco is an extra super quick-and-dirty documentation generator based on Vim, written in Ruby.}
gem.description = %Q{vocco is an extra super quick-and-dirty documentation generator based on Vim, written in Ruby.}
gem.email = "post@jostein.be"
gem.authors = ["jbe"]
gem.add_runtime_dependency 'trollop'
gem.add_runtime_dependency 'why-hpricot'
gem.add_runtime_dependency 'tilt'
gem.add_runtime_dependency 'rdiscount'
gem.add_development_dependency 'shoulda'
gem.add_development_dependency 'jeweler'
gem.add_development_dependency 'tilt'
gem.add_development_dependency 'slim'
gem.add_development_dependency 'haml'
#gem.add_development_dependency 'i18n'
gem.add_development_dependency 'activesupport'
gem.add_development_dependency 'vocco'
end
Jeweler::RubygemsDotOrgTasks.new
def precompile(const_name, template)
require 'active_support/inflector'
String.send :include, ActiveSupport::Inflector
path = File.join('lib', const_name.underscore + '.rb')
generated = case template
when Tilt::SassTemplate then template.render
when Slim::Template then template.send(:precompiled_template, {})
else raise 'unsupported template'
end
heredoc_str = '__YOU_ARE_SPECIAL__'
opener = "#{const_name} = <<-'#{heredoc_str}'\n"
closer = "\n#{heredoc_str}\n"
File.open(path, 'w') do |file|
file.write opener + generated + closer
end
end
task :docs do
require 'vocco'
Vocco.run(
:out => 'website',
:files => %w{README LICENSE lib/**/*.rb}
)
end
namespace :build do
task :templates do
require 'tilt'
require 'slim'
precompile(
'Vocco::Generator::CSS',
Tilt.new('template/css.sass')
)
precompile(
'Vocco::Generator::SourceFile::HTML_TEMPLATE',
Tilt.new('template/html.slim', :auto_escape => false)
)
end
end