Skip to content

Commit

Permalink
Add all README translations to website.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Oct 12, 2010
1 parent 4ca6788 commit 4b2600d
Show file tree
Hide file tree
Showing 11 changed files with 4,019 additions and 29 deletions.
40 changes: 19 additions & 21 deletions Rakefile
@@ -1,16 +1,20 @@
require 'rake/clean' require 'rake/clean'
require 'rdoc/markup/to_html' require 'rdoc/markup/to_html'


def readme(pattern = "%s", &block)
return readme(pattern).each(&block) if block_given?
%w[en de es fr jp].map do |lang|
pattern % "README#{lang == "en" ? "" : ".#{lang}"}"
end
end

task :default => ['_sinatra', :build] task :default => ['_sinatra', :build]


desc "Build outdated static files and API docs" desc "Build outdated static files and API docs"
task :build => ['build:static'] task :build => ['build:static']


desc "Build outdated static files" desc "Build outdated static files"
task 'build:static' => [ task 'build:static' => readme("_includes/%s.html")
'_includes/README.html',
'_includes/README.jp.html'
]


desc "Build anything that's outdated and stage changes for next commit" desc "Build anything that's outdated and stage changes for next commit"
task :regen => [:build] do task :regen => [:build] do
Expand All @@ -36,25 +40,19 @@ end
file('_sinatra') { Rake::Task['pull:sinatra'].invoke } file('_sinatra') { Rake::Task['pull:sinatra'].invoke }
CLOBBER.include '_sinatra' CLOBBER.include '_sinatra'


%w[README.rdoc README.jp.rdoc AUTHORS].each do |fn| readme("_sinatra/%s.rdoc") { |fn| file fn => '_sinatra' }
file "_sinatra/#{fn}" => ['_sinatra'] file 'AUTHORS' => '_sinatra'
end


# Build _includes/README.html from RDoc readme do |fn|
file '_includes/README.html' => ['_sinatra/README.rdoc', 'Rakefile'] do |f| file "_includes/#{fn}.html" => ["_sinatra/#{fn}.rdoc", "Rakefile"] do |f|
html = RDoc::Markup::ToHtml.new.convert(File.read("_sinatra/README.rdoc")). html =
sub("<h1>Sinatra</h1>", "") RDoc::Markup::ToHtml.new.
File.open(f.name, 'wb') { |io| io.write(html) } convert(File.read("_sinatra/#{fn}.rdoc")).
end sub("<h1>Sinatra</h1>", "")
CLEAN.include '_includes/README.html' File.open(f.name, 'wb') { |io| io.write(html) }

end
# Build _includes/README.jp.html from RDoc CLEAN.include "_includes/#{fn}.html"
file '_includes/README.jp.html' => ['_sinatra/README.jp.rdoc', 'Rakefile'] do |f|
html = RDoc::Markup::ToHtml.new.convert(File.read("_sinatra/README.jp.rdoc")).
sub("<h1>Sinatra</h1>", "")
File.open(f.name, 'wb') { |io| io.write(html) }
end end
CLEAN.include '_includes/README.jp.html'


desc 'Rebuild site under _site with Jekyll' desc 'Rebuild site under _site with Jekyll'
task :jekyll do task :jekyll do
Expand Down

0 comments on commit 4b2600d

Please sign in to comment.