Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (50 sloc) 1.97 kb
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
1 $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
650c67b @rkh prep for travis
rkh authored
2 require 'open-uri'
3 require 'yaml'
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
4
ea5e8b1 @rkh some rake tasks
rkh authored
5 desc "run specs"
f6be961 @rkh update for travis #2
rkh authored
6 task(:spec) { ruby '-S rspec spec -c' }
ea5e8b1 @rkh some rake tasks
rkh authored
7 task(:test => :spec)
f6be961 @rkh update for travis #2
rkh authored
8 task(:default => :spec)
ea5e8b1 @rkh some rake tasks
rkh authored
9
10 namespace :doc do
11 task :readmes do
12 Dir.glob 'lib/sinatra/*.rb' do |file|
05e2e4c @gnandretta don't build docs for auxiliary modules
gnandretta authored
13 excluded_files = %w[lib/sinatra/contrib.rb lib/sinatra/capture.rb lib/sinatra/engine_tracking.rb]
14 next if excluded_files.include?(file)
acaeeea @gnandretta ignore white lines when extracting docs
gnandretta authored
15 doc = File.read(file)[/^module Sinatra(\n)+( #[^\n]*\n)*/m].scan(/^ *#(?!#) ?(.*)\n/).join("\n")
ea5e8b1 @rkh some rake tasks
rkh authored
16 file = "doc/#{file[4..-4].tr("/_", "-")}.rdoc"
66ab362 @gnandretta fix doc:readmes task
gnandretta authored
17 Dir.mkdir "doc" unless File.directory? "doc"
ea5e8b1 @rkh some rake tasks
rkh authored
18 puts "writing #{file}"
19 File.open(file, "w") { |f| f << doc }
20 end
21 end
22
23 task :all => [:readmes]
24 end
25
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
26 desc "generate documentation"
ea5e8b1 @rkh some rake tasks
rkh authored
27 task :doc => 'doc:all'
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
28
29 desc "generate gemspec"
30 task 'sinatra-contrib.gemspec' do
31 require 'sinatra/contrib/version'
32 content = File.read 'sinatra-contrib.gemspec'
33
34 fields = {
35 :authors => `git shortlog -sn`.scan(/[^\d\s].*/),
36 :email => `git shortlog -sne`.scan(/[^<]+@[^>]+/),
63de40f @rkh dont add hidden and bundler files to gem
rkh authored
37 :files => `git ls-files`.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ }
dd64215 @rkh add task to update gemspec. also update gemspec.
rkh authored
38 }
39
40 fields.each do |field, values|
41 updated = " s.#{field} = ["
42 updated << values.map { |v| "\n %p" % v }.join(',')
43 updated << "\n ]"
44 content.sub!(/ s\.#{field} = \[\n( .*\n)* \]/, updated)
45 end
46
47 content.sub! /(s\.version.*=\s+).*/, "\\1\"#{Sinatra::Contrib::VERSION}\""
48 File.open('sinatra-contrib.gemspec', 'w') { |f| f << content }
49 end
50
66ab362 @gnandretta fix doc:readmes task
gnandretta authored
51 task :gemspec => 'sinatra-contrib.gemspec'
650c67b @rkh prep for travis
rkh authored
52
53 desc 'update travis config to correspond to sinatra'
54 task :travis, [:branch] do |t, a|
55 a.with_defaults :branch => :master
56 data = YAML.load open("https://raw.github.com/sinatra/sinatra/#{a.branch}/.travis.yml")
57 data["notifications"]["recipients"] << "ohhgabriel@gmail.com"
58 File.open('.travis.yml', 'w') { |f| f << data.to_yaml }
59 system 'git add .travis.yml && git diff --cached .travis.yml'
60 end
61
Something went wrong with that request. Please try again.