Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 48 lines (38 sloc) 1.399 kb
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
1 $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
ea5e8b1 @rkh some rake tasks
rkh authored
3 desc "run specs"
4 task(:spec) { ruby '-S rspec spec' }
5 task(:test => :spec)
6
7 namespace :doc do
8 task :readmes do
9 Dir.glob 'lib/sinatra/*.rb' do |file|
10 next if file == 'lib/sinatra/contrib.rb'
11 doc = File.read(file)[/^module Sinatra\n( #[^\n]*\n)*/m].scan(/^ *#(?!#) ?(.*)\n/).join("\n")
12 file = "doc/#{file[4..-4].tr("/_", "-")}.rdoc"
66ab362 @gnandretta fix doc:readmes task
gnandretta authored
13 Dir.mkdir "doc" unless File.directory? "doc"
ea5e8b1 @rkh some rake tasks
rkh authored
14 puts "writing #{file}"
15 File.open(file, "w") { |f| f << doc }
16 end
17 end
18
19 task :all => [:readmes]
20 end
21
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
22 desc "generate documentation"
ea5e8b1 @rkh some rake tasks
rkh authored
23 task :doc => 'doc:all'
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
24
25 desc "generate gemspec"
26 task 'sinatra-contrib.gemspec' do
27 require 'sinatra/contrib/version'
28 content = File.read 'sinatra-contrib.gemspec'
29
30 fields = {
31 :authors => `git shortlog -sn`.scan(/[^\d\s].*/),
32 :email => `git shortlog -sne`.scan(/[^<]+@[^>]+/),
63de40f @rkh dont add hidden and bundler files to gem
rkh authored
33 :files => `git ls-files`.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ }
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
34 }
35
36 fields.each do |field, values|
37 updated = " s.#{field} = ["
38 updated << values.map { |v| "\n %p" % v }.join(',')
39 updated << "\n ]"
40 content.sub!(/ s\.#{field} = \[\n( .*\n)* \]/, updated)
41 end
42
43 content.sub! /(s\.version.*=\s+).*/, "\\1\"#{Sinatra::Contrib::VERSION}\""
44 File.open('sinatra-contrib.gemspec', 'w') { |f| f << content }
45 end
46
66ab362 @gnandretta fix doc:readmes task
gnandretta authored
47 task :gemspec => 'sinatra-contrib.gemspec'
Something went wrong with that request. Please try again.