Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 77 lines (61 sloc) 1.996 kb
e31941d @rtomayko add .gemspec; remove echoe
rtomayko authored
1 require 'rake/clean'
5aa20ae Rakefile
Blake Mizerany authored
2
3 task :default => :test
4
e31941d @rtomayko add .gemspec; remove echoe
rtomayko authored
5 # SPECS ===============================================================
6
7 desc 'Run specs with story style output'
8 task :spec do
9 sh 'specrb --specdox -Ilib:test test/*_test.rb'
10 end
11
12 desc 'Run specs with unit test style output'
13 task :test => FileList['test/*_test.rb'] do |t|
14 suite = t.prerequisites.map{|f| "-r#{f.chomp('.rb')}"}.join(' ')
15 sh "ruby -Ilib:test #{suite} -e ''", :verbose => false
16 end
17
18 # PACKAGING ============================================================
19
0663451 @rtomayko read gemspec in simulated github environment
rtomayko authored
20 # Load the gemspec using the same limitations as github
e31941d @rtomayko add .gemspec; remove echoe
rtomayko authored
21 def spec
22 @spec ||=
0663451 @rtomayko read gemspec in simulated github environment
rtomayko authored
23 begin
24 require 'rubygems/specification'
25 data = File.read('sinatra.gemspec')
26 spec = nil
27 Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
28 spec
29 end
e31941d @rtomayko add .gemspec; remove echoe
rtomayko authored
30 end
31
32 def package(ext='')
33 "dist/sinatra-#{spec.version}" + ext
34 end
35
36 desc 'Build packages'
37 task :package => %w[.gem .tar.gz].map {|e| package(e)}
38
39 desc 'Build and install as local gem'
40 task :install => package('.gem') do
41 sh "gem install #{package('.gem')}"
42 end
43
44 directory 'dist/'
45
46 file package('.gem') => %w[dist/ sinatra.gemspec] + spec.files do |f|
47 sh "gem build sinatra.gemspec"
48 mv File.basename(f.name), f.name
49 end
50
51 file package('.tar.gz') => %w[dist/] + spec.files do |f|
52 sh "git archive --format=tar HEAD | gzip > #{f.name}"
ca9ac7b Sinatra 0.2.0 released
Blake Mizerany authored
53 end
0e367a5 @rtomayko rake task for generating rdoc with hanna template
rtomayko authored
54
55 # Hanna RDoc =========================================================
56 #
57 # Building docs requires the hanna gem:
58 # gem install mislav-hanna --source=http://gems.github.com
59
60 desc 'Generate Hanna RDoc under doc/api'
61 task :doc => ['doc/api/index.html']
62
63 file 'doc/api/index.html' => FileList['lib/**/*.rb','README.rdoc'] do |f|
64 rb_files = f.prerequisites
65 sh((<<-end).gsub(/\s+/, ' '))
66 hanna --charset utf8 \
67 --fmt html \
68 --inline-source \
69 --line-numbers \
70 --main README.rdoc \
71 --op doc/api \
72 --title 'Sinatra API Documentation' \
73 #{rb_files.join(' ')}
74 end
75 end
76 CLEAN.include 'doc/api'
Something went wrong with that request. Please try again.