public
Fork of macournoyer/thin
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/bmizerany/thin.git
A couple refactorings in rake tasks.
macournoyer (author)
Sun Mar 02 12:57:21 -0800 2008
commit  59a972ced83e99eec7e95896fc5a6bdc32aa9ca6
tree    5bf2d5138ab12cbf5fd7be6141df18e45899632c
parent  4c30c781a26b14bd7038646a6c258f57cb91c1f3
...
9
10
11
 
 
12
...
9
10
11
12
13
14
0
@@ -9,3 +9,5 @@ require 'lib/thin'
0
 Dir['tasks/**/*.rake'].each { |rake| load rake }
0
 
0
 task :default => :spec
0
+
0
+ext_task :thin_parser
0
\ No newline at end of file
...
1
2
3
4
5
6
7
8
9
10
11
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
14
15
16
 
17
18
19
...
22
23
24
25
26
 
27
28
29
30
31
32
33
34
35
36
37
38
...
1
2
 
 
 
 
 
 
 
 
 
 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
32
33
34
35
...
38
39
40
 
 
41
42
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,19 +1,35 @@
0
 CLEAN.include %w(**/*.{o,bundle,jar,so,obj,pdb,lib,def,exp,log} ext/*/Makefile ext/*/conftest.dSYM)
0
 
0
-EXT_DIR = 'ext/thin_parser'
0
-EXT_BUNDLE = "#{EXT_DIR}/thin_parser.#{Config::CONFIG['DLEXT']}"
0
-EXT_FILES = FileList[
0
- "#{EXT_DIR}/*.c",
0
- "#{EXT_DIR}/*.h",
0
- "#{EXT_DIR}/*.rl",
0
- "#{EXT_DIR}/extconf.rb",
0
- "#{EXT_DIR}/Makefile",
0
- "lib"
0
-]
0
+def ext_task(name)
0
+ ext_dir = "ext/#{name}"
0
+ ext_bundle = "#{ext_dir}/#{name}.#{Config::CONFIG['DLEXT']}"
0
+ ext_files = FileList[
0
+ "#{ext_dir}/*.c",
0
+ "#{ext_dir}/*.h",
0
+ "#{ext_dir}/*.rl",
0
+ "#{ext_dir}/extconf.rb",
0
+ "#{ext_dir}/Makefile",
0
+ "lib"
0
+ ]
0
+
0
+ task "compile:#{name}" => ["#{ext_dir}/Makefile", ext_bundle]
0
+ task :compile => "compile:#{name}"
0
+
0
+ file "#{ext_dir}/Makefile" => ["#{ext_dir}/extconf.rb"] do
0
+ cd(ext_dir) { ruby "extconf.rb" }
0
+ end
0
+
0
+ file ext_bundle => ext_files do
0
+ cd ext_dir do
0
+ sh(WIN ? 'nmake' : 'make')
0
+ end
0
+ cp ext_bundle, 'lib/'
0
+ end
0
+end
0
 
0
 desc "Compile the Ragel state machines"
0
 task :ragel do
0
- Dir.chdir EXT_DIR do
0
+ Dir.chdir 'ext/thin_parser' do
0
     target = "parser.c"
0
     File.unlink target if File.exist? target
0
     sh "ragel parser.rl | rlgen-cd -G2 -o #{target}"
0
@@ -22,17 +38,5 @@ task :ragel do
0
 end
0
   
0
 desc "Compile the extensions"
0
-task :compile => ["#{EXT_DIR}/Makefile", EXT_BUNDLE]
0
-
0
+task :compile
0
 task :package => :compile
0
-
0
-file "#{EXT_DIR}/Makefile" => ["#{EXT_DIR}/extconf.rb"] do
0
- cd(EXT_DIR) { ruby "extconf.rb" }
0
-end
0
-
0
-file EXT_BUNDLE => EXT_FILES do
0
- cd EXT_DIR do
0
- sh(WIN ? 'nmake' : 'make')
0
- end
0
- cp EXT_BUNDLE, 'lib/'
0
-end
...
11
12
13
 
 
14
15
16
...
11
12
13
14
15
16
17
18
0
@@ -11,6 +11,8 @@ spec = Gem::Specification.new do |s|
0
   s.author = "Marc-Andre Cournoyer"
0
   s.email = 'macournoyer@gmail.com'
0
   s.homepage = 'http://code.macournoyer.com/thin/'
0
+ s.rubyforge_project = 'thin'
0
+ s.has_rdoc = true
0
   s.executables = %w(thin)
0
 
0
   s.required_ruby_version = '>= 1.8.6' # Makes sure the CGI eof fix is there

Comments

    No one has commented yet.