Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 166 lines (135 sloc) 4.603 kB
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
1 # Rakefile for Rack. -*-ruby-*-
2 require 'rake/rdoctask'
3 require 'rake/testtask'
4
5
6 desc "Run all the tests"
7 task :default => [:test]
8
9 desc "Do predistribution stuff"
253cb49 @chneukirchen Last-minute details
chneukirchen authored
10 task :predist => [:chmod, :changelog, :rdoc]
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
11
12
13 desc "Make an archive as .tar.gz"
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
14 task :dist => [:predist] do
c3d6e4a @chneukirchen Add Rack.release for the version of the release.
chneukirchen authored
15 sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
16 sh "pax -waf #{release}.tar -s ':^:#{release}/:' RDOX SPEC ChangeLog doc"
17 sh "gzip -f -9 #{release}.tar"
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
18 end
19
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
20 desc "Make an official release"
21 task :officialrelease do
22 puts "Official build for #{release}..."
23 sh "rm -rf stage"
24 sh "git clone --shared . stage"
25 sh "cd stage && rake officialrelease_really"
26 sh "mv stage/#{release}.tar.gz stage/#{release}.gem ."
27 end
28
9031881 @chneukirchen Build all files needed
chneukirchen authored
29 task :officialrelease_really => [:fulltest, "RDOX", "SPEC", :dist, :gem] do
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
30 sh "sha1sum #{release}.tar.gz #{release}.gem"
c3d6e4a @chneukirchen Add Rack.release for the version of the release.
chneukirchen authored
31 end
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
32
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
33
34 def version
35 abort "You need to pass VERSION=... to build packages." unless ENV["VERSION"]
36 ENV["VERSION"]
c3d6e4a @chneukirchen Add Rack.release for the version of the release.
chneukirchen authored
37 end
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
38
c3d6e4a @chneukirchen Add Rack.release for the version of the release.
chneukirchen authored
39 def release
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
40 "rack-#{version}"
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
41 end
42
43 def manifest
c3d6e4a @chneukirchen Add Rack.release for the version of the release.
chneukirchen authored
44 `git ls-files`.split("\n")
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
45 end
46
47
48 desc "Make binaries executable"
49 task :chmod do
50 Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
bee7489 @chneukirchen Fix CGI permissions
chneukirchen authored
51 Dir["test/cgi/test*"].each { |binary| File.chmod(0775, binary) }
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
52 end
53
54 desc "Generate a ChangeLog"
55 task :changelog do
c3d6e4a @chneukirchen Add Rack.release for the version of the release.
chneukirchen authored
56 File.open("ChangeLog", "w") { |out|
57 `git log -z`.split("\0").map { |chunk|
58 author = chunk[/Author: (.*)/, 1].strip
59 date = chunk[/Date: (.*)/, 1].strip
60 desc, detail = $'.strip.split("\n", 2)
61 detail ||= ""
62 detail = detail.gsub(/.*darcs-hash:.*/, '')
63 detail.rstrip!
64 out.puts "#{date} #{author}"
65 out.puts " * #{desc.strip}"
66 out.puts detail unless detail.empty?
67 out.puts
68 }
69 }
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
70 end
71
72
73 desc "Generate RDox"
74 task "RDOX" do
e926df4 @manveru replace the 'system' calls in Rakefile with 'sh', making them more tr…
manveru authored
75 sh "specrb -Ilib:test -a --rdox >RDOX"
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
76 end
77
78 desc "Generate Rack Specification"
79 task "SPEC" do
80 File.open("SPEC", "wb") { |file|
81 IO.foreach("lib/rack/lint.rb") { |line|
82 if line =~ /## (.*)/
83 file.puts $1
84 end
85 }
86 }
87 end
88
89 desc "Run all the fast tests"
90 task :test do
6ae0f8c @chneukirchen Don't test OpenID in the default test suite
chneukirchen authored
91 sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS'] || '-t "^(?!Rack::Handler|Rack::Adapter|Rack::Session::Memcache|Rack::Auth::OpenID)"'}"
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
92 end
93
94 desc "Run all the tests"
f586817 @chneukirchen Make fulltest chmod the executables
chneukirchen authored
95 task :fulltest => [:chmod] do
e926df4 @manveru replace the 'system' calls in Rakefile with 'sh', making them more tr…
manveru authored
96 sh "specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS']}"
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
97 end
98
99 begin
100 require 'rubygems'
101 rescue LoadError
102 # Too bad.
103 else
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
104 task "rack.gemspec" do
105 spec = Gem::Specification.new do |s|
106 s.name = "rack"
107 s.version = version
108 s.platform = Gem::Platform::RUBY
109 s.summary = "a modular Ruby webserver interface"
110
111 s.description = <<-EOF
d5b63bc @chneukirchen Extend gemspec
chneukirchen authored
112 Rack provides minimal, modular and adaptable interface for developing
113 web applications in Ruby. By wrapping HTTP requests and responses in
114 the simplest way possible, it unifies and distills the API for web
115 servers, web frameworks, and software in between (the so-called
116 middleware) into a single method call.
117
118 Also see http://rack.rubyforge.org.
119 EOF
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
120
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
121 s.files = manifest + %w(SPEC RDOX rack.gemspec)
122 s.bindir = 'bin'
123 s.executables << 'rackup'
124 s.require_path = 'lib'
125 s.has_rdoc = true
126 s.extra_rdoc_files = ['README', 'SPEC', 'RDOX', 'KNOWN-ISSUES']
127 s.test_files = Dir['test/{test,spec}_*.rb']
128
129 s.author = 'Christian Neukirchen'
130 s.email = 'chneukirchen@gmail.com'
131 s.homepage = 'http://rack.rubyforge.org'
132 s.rubyforge_project = 'rack'
133
134 s.add_development_dependency 'test-spec'
135
136 s.add_development_dependency 'camping'
137 s.add_development_dependency 'fcgi'
138 s.add_development_dependency 'memcache-client'
139 s.add_development_dependency 'mongrel'
140 s.add_development_dependency 'ruby-openid', '~> 2.0.0'
141 s.add_development_dependency 'thin'
142 end
143
144 File.open("rack.gemspec", "w") { |f| f << spec.to_ruby }
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
145 end
146
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
147 task :gem => "rack.gemspec" do
148 sh "gem build rack.gemspec"
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
149 end
150 end
151
152 desc "Generate RDoc documentation"
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
153 task :rdoc do
154 sh(*%w{rdoc --line-numbers --inline-source --main README
35f5aae @chneukirchen Ensure to rebuild rdocs
chneukirchen authored
155 --title 'Rack\ Documentation' --charset utf-8 -U -o doc} +
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
156 %w{README KNOWN-ISSUES SPEC RDOX} +
157 Dir["lib/**/*.rb"])
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
158 end
159
160 task :pushsite => [:rdoc] do
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
161 sh "cd site && git gc"
e926df4 @manveru replace the 'system' calls in Rakefile with 'sh', making them more tr…
manveru authored
162 sh "rsync -avz doc/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/doc/"
163 sh "rsync -avz site/ chneukirchen@rack.rubyforge.org:/var/www/gforge-projects/rack/"
c76306d @chneukirchen Refactor Rakefile
chneukirchen authored
164 sh "cd site && git push"
e88978d @chneukirchen Add and integrate Rakefile
chneukirchen authored
165 end
Something went wrong with that request. Please try again.