Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 159 lines (124 sloc) 4.039 kb
a4a3468 @luislavena Initial cleanup of Rakefile
luislavena authored
1 require "hoe"
2 require "rake/extensiontask"
9cb0d94 @luislavena Compile extensions
luislavena authored
3 require "rake/javaextensiontask"
a4a3468 @luislavena Initial cleanup of Rakefile
luislavena authored
4
474ba70 @luislavena Build extensions
luislavena authored
5 IS_JRUBY = defined?(RUBY_ENGINE) ? RUBY_ENGINE == "jruby" : false
6
2f794b9 @evanphx Use the Hoe git plugin
evanphx authored
7 Hoe.plugin :git
523e5bf @evanphx Add manifest checking to release process
evanphx authored
8 Hoe.plugin :ignore
2f794b9 @evanphx Use the Hoe git plugin
evanphx authored
9
a4a3468 @luislavena Initial cleanup of Rakefile
luislavena authored
10 HOE = Hoe.spec "puma" do
11 self.readme_file = "README.md"
6767859 @jc00ke Fix homepage url in gemspec
jc00ke authored
12 self.urls = %w!http://puma.io https://github.com/puma/puma!
a4a3468 @luislavena Initial cleanup of Rakefile
luislavena authored
13
9383242 @chulkilee BSD-3-Clause over BSD to avoid confusion
chulkilee authored
14 license "BSD-3-Clause"
a4a3468 @luislavena Initial cleanup of Rakefile
luislavena authored
15 developer 'Evan Phoenix', 'evan@phx.io'
16
17 spec_extras[:extensions] = ["ext/puma_http11/extconf.rb"]
18 spec_extras[:executables] = ['puma', 'pumactl']
6767859 @jc00ke Fix homepage url in gemspec
jc00ke authored
19 spec_extras[:homepage] = self.urls.first
a4a3468 @luislavena Initial cleanup of Rakefile
luislavena authored
20
0fee5c8 @luislavena Change YAML.load trick to use File.read instead
luislavena authored
21 require_ruby_version ">= 1.8.7"
22
f336e8f @evanphx Bump to 2.0.0.b5
evanphx authored
23 dependency "rack", [">= 1.1", "< 2.0"]
a4a3468 @luislavena Initial cleanup of Rakefile
luislavena authored
24
55b9ce0 @evanphx Bump to 2.9.0
evanphx authored
25 extra_dev_deps << ["rake-compiler", "~> 0.8"]
a4a3468 @luislavena Initial cleanup of Rakefile
luislavena authored
26 end
27
523e5bf @evanphx Add manifest checking to release process
evanphx authored
28 task :prerelease => [:clobber, :check_manifest, :test]
29
474ba70 @luislavena Build extensions
luislavena authored
30 # hoe/test and rake-compiler don't seem to play well together, so disable
31 # hoe/test's .gemtest touch file thingy for now
32 HOE.spec.files -= [".gemtest"]
33
c50d8ea @evanphx Add custom version of git:changelog
evanphx authored
34 include Hoe::Git
35
36 desc "Print the current changelog."
37 task "changelog" do
38 tag = ENV["FROM"] || git_tags.last
39 range = [tag, "HEAD"].compact.join ".."
40 cmd = "git log #{range} '--format=tformat:%B|||%aN|||%aE|||'"
41 now = Time.new.strftime "%Y-%m-%d"
42
43 changes = `#{cmd}`.split(/\|\|\|/).each_slice(3).map { |msg, author, email|
44 msg.split(/\n/).reject { |s| s.empty? }.first
45 }.flatten.compact
46
47 $changes = Hash.new { |h,k| h[k] = [] }
48
49 codes = {
50 "!" => :major,
51 "+" => :minor,
52 "*" => :minor,
53 "-" => :bug,
54 "?" => :unknown,
55 }
56
57 codes_re = Regexp.escape codes.keys.join
58
59 changes.each do |change|
60 if change =~ /^\s*([#{codes_re}])\s*(.*)/ then
61 code, line = codes[$1], $2
62 else
63 code, line = codes["?"], change.chomp
64 end
65
66 $changes[code] << line
67 end
68
69 puts "=== #{ENV['VERSION'] || 'NEXT'} / #{now}"
70 puts
71 changelog_section :major
72 changelog_section :minor
73 changelog_section :bug
74 changelog_section :unknown
75 puts
76 end
77
3e98339 @luislavena Make 'ragel' task actually work
luislavena authored
78 # generate extension code using Ragel (C and Java)
79 desc "Generate extension code (C and Java) using Ragel"
80 task :ragel
81
82 file 'ext/puma_http11/http11_parser.c' => ['ext/puma_http11/http11_parser.rl'] do |t|
83 begin
84 sh "ragel #{t.prerequisites.last} -C -G2 -I ext/puma_http11 -o #{t.name}"
85 rescue
86 fail "Could not build wrapper using Ragel (it failed or not installed?)"
87 end
88 end
89 task :ragel => ['ext/puma_http11/http11_parser.c']
90
91 file 'ext/puma_http11/org/jruby/puma/Http11Parser.java' => ['ext/puma_http11/http11_parser.java.rl'] do |t|
92 begin
93 sh "ragel #{t.prerequisites.last} -J -G2 -I ext/puma_http11 -o #{t.name}"
94 rescue
95 fail "Could not build wrapper using Ragel (it failed or not installed?)"
96 end
97 end
98 task :ragel => ['ext/puma_http11/org/jruby/puma/Http11Parser.java']
99
e191003 @evanphx Start java version of MiniSSL
evanphx authored
100 if !IS_JRUBY
101
9cb0d94 @luislavena Compile extensions
luislavena authored
102 # compile extensions using rake-compiler
103 # C (MRI, Rubinius)
104 Rake::ExtensionTask.new("puma_http11", HOE.spec) do |ext|
474ba70 @luislavena Build extensions
luislavena authored
105 # place extension inside namespace
106 ext.lib_dir = "lib/puma"
942c1ad @luislavena Enable cross-compilation of C extension
luislavena authored
107
a47cc0e @evanphx Remove cross reporting workarounds since rack-compiler 0.8.0 fixes them
evanphx authored
108 ext.cross_compile = true
942c1ad @luislavena Enable cross-compilation of C extension
luislavena authored
109 ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32']
21327ca @luislavena Add fat-binary stub when cross compiling
luislavena authored
110 ext.cross_compiling do |spec|
111 # add fat-binary stub only when cross compiling
112 spec.files << "lib/puma/puma_http11.rb"
113 end
942c1ad @luislavena Enable cross-compilation of C extension
luislavena authored
114
115 CLEAN.include "lib/puma/{1.8,1.9}"
21327ca @luislavena Add fat-binary stub when cross compiling
luislavena authored
116 CLEAN.include "lib/puma/puma_http11.rb"
9cb0d94 @luislavena Compile extensions
luislavena authored
117 end
118
e191003 @evanphx Start java version of MiniSSL
evanphx authored
119 else
120
9cb0d94 @luislavena Compile extensions
luislavena authored
121 # Java (JRuby)
a47cc0e @evanphx Remove cross reporting workarounds since rack-compiler 0.8.0 fixes them
evanphx authored
122 Rake::JavaExtensionTask.new("puma_http11", HOE.spec) do |ext|
123 ext.lib_dir = "lib/puma"
9cb0d94 @luislavena Compile extensions
luislavena authored
124 end
125
e191003 @evanphx Start java version of MiniSSL
evanphx authored
126 end
127
21327ca @luislavena Add fat-binary stub when cross compiling
luislavena authored
128 # the following is a fat-binary stub that will be used when
129 # require 'puma/puma_http11' and will use either 1.8 or 1.9 version depending
130 # on RUBY_VERSION
131 file "lib/puma/puma_http11.rb" do |t|
132 File.open(t.name, "w") do |f|
133 f.puts "RUBY_VERSION =~ /(\d+.\d+)/"
134 f.puts 'require "puma/#{$1}/puma_http11"'
135 end
136 end
137
474ba70 @luislavena Build extensions
luislavena authored
138 # tests require extension be compiled, but depend on the platform
139 if IS_JRUBY
140 task :test => [:java]
141 else
142 task :test => [:compile]
143 end
960d032 @evanphx Move where IO redirect is performed
evanphx authored
144
145 namespace :test do
146 desc "Run the integration tests"
147 task :integration do
148 sh "cd test/shell; sh run.sh"
149 end
150
151 desc "Run all tests"
8fdc274 @evanphx Exclude shell tests on jruby
evanphx authored
152 if defined?(JRUBY_VERSION) and ENV['TRAVIS']
153 task :all => :test
154 else
155 task :all => [:test, "test:integration"]
156 end
960d032 @evanphx Move where IO redirect is performed
evanphx authored
157 end
158
Something went wrong with that request. Please try again.