mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
some rake tasks
This commit is contained in:
parent
17a51e9655
commit
b9381b3f55
2 changed files with 21 additions and 0 deletions
1
sinatra-contrib/.gitignore
vendored
Normal file
1
sinatra-contrib/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
doc/
|
20
sinatra-contrib/Rakefile
Normal file
20
sinatra-contrib/Rakefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
desc "run specs"
|
||||
task(:spec) { ruby '-S rspec spec' }
|
||||
task(:test => :spec)
|
||||
|
||||
namespace :doc do
|
||||
task :readmes do
|
||||
Dir.glob 'lib/sinatra/*.rb' do |file|
|
||||
next if file == 'lib/sinatra/contrib.rb'
|
||||
doc = File.read(file)[/^module Sinatra\n( #[^\n]*\n)*/m].scan(/^ *#(?!#) ?(.*)\n/).join("\n")
|
||||
file = "doc/#{file[4..-4].tr("/_", "-")}.rdoc"
|
||||
File.mkdir "doc" unless File.directory? "doc"
|
||||
puts "writing #{file}"
|
||||
File.open(file, "w") { |f| f << doc }
|
||||
end
|
||||
end
|
||||
|
||||
task :all => [:readmes]
|
||||
end
|
||||
|
||||
task :doc => 'doc:all'
|
Loading…
Add table
Reference in a new issue