Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 38 lines (30 sloc) 1.024 kB
95884e7 @rkh initial commit
rkh authored
1 $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
3 begin
4 require 'bundler'
5 Bundler::GemHelper.install_tasks
6 rescue LoadError => e
7 $stderr.puts e
8 end
9
10 desc "run specs"
11 task(:spec) { ruby '-S rspec spec' }
12
13 desc "generate gemspec"
14 task 'rack-protection.gemspec' do
15 require 'rack/protection/version'
16 content = File.read 'rack-protection.gemspec'
17
18 fields = {
19 :authors => `git shortlog -sn`.scan(/[^\d\s].*/),
20 :email => `git shortlog -sne`.scan(/[^<]+@[^>]+/),
21 :files => `git ls-files`.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ }
22 }
23
24 fields.each do |field, values|
25 updated = " s.#{field} = ["
26 updated << values.map { |v| "\n %p" % v }.join(',')
27 updated << "\n ]"
28 content.sub!(/ s\.#{field} = \[\n( .*\n)* \]/, updated)
29 end
30
31 content.sub! /(s\.version.*=\s+).*/, "\\1\"#{Rack::Protection::VERSION}\""
32 File.open('rack-protection.gemspec', 'w') { |f| f << content }
33 end
34
35 task :gemspec => 'rack-protection.gemspec'
36 task :default => :spec
37 task :test => :spec
Something went wrong with that request. Please try again.