Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

A couple refactorings in rake tasks.

  • Loading branch information...
commit 59a972ced83e99eec7e95896fc5a6bdc32aa9ca6 1 parent 4c30c78
@macournoyer authored
Showing with 32 additions and 24 deletions.
  1. +2 −0  Rakefile
  2. +28 −24 tasks/ext.rake
  3. +2 −0  tasks/gem.rake
View
2  Rakefile
@@ -9,3 +9,5 @@ require 'lib/thin'
Dir['tasks/**/*.rake'].each { |rake| load rake }
task :default => :spec
+
+ext_task :thin_parser
View
52 tasks/ext.rake
@@ -1,19 +1,35 @@
CLEAN.include %w(**/*.{o,bundle,jar,so,obj,pdb,lib,def,exp,log} ext/*/Makefile ext/*/conftest.dSYM)
-EXT_DIR = 'ext/thin_parser'
-EXT_BUNDLE = "#{EXT_DIR}/thin_parser.#{Config::CONFIG['DLEXT']}"
-EXT_FILES = FileList[
- "#{EXT_DIR}/*.c",
- "#{EXT_DIR}/*.h",
- "#{EXT_DIR}/*.rl",
- "#{EXT_DIR}/extconf.rb",
- "#{EXT_DIR}/Makefile",
- "lib"
-]
+def ext_task(name)
+ ext_dir = "ext/#{name}"
+ ext_bundle = "#{ext_dir}/#{name}.#{Config::CONFIG['DLEXT']}"
+ ext_files = FileList[
+ "#{ext_dir}/*.c",
+ "#{ext_dir}/*.h",
+ "#{ext_dir}/*.rl",
+ "#{ext_dir}/extconf.rb",
+ "#{ext_dir}/Makefile",
+ "lib"
+ ]
+
+ task "compile:#{name}" => ["#{ext_dir}/Makefile", ext_bundle]
+ task :compile => "compile:#{name}"
+
+ file "#{ext_dir}/Makefile" => ["#{ext_dir}/extconf.rb"] do
+ cd(ext_dir) { ruby "extconf.rb" }
+ end
+
+ file ext_bundle => ext_files do
+ cd ext_dir do
+ sh(WIN ? 'nmake' : 'make')
+ end
+ cp ext_bundle, 'lib/'
+ end
+end
desc "Compile the Ragel state machines"
task :ragel do
- Dir.chdir EXT_DIR do
+ Dir.chdir 'ext/thin_parser' do
target = "parser.c"
File.unlink target if File.exist? target
sh "ragel parser.rl | rlgen-cd -G2 -o #{target}"
@@ -22,17 +38,5 @@ task :ragel do
end
desc "Compile the extensions"
-task :compile => ["#{EXT_DIR}/Makefile", EXT_BUNDLE]
-
+task :compile
task :package => :compile
-
-file "#{EXT_DIR}/Makefile" => ["#{EXT_DIR}/extconf.rb"] do
- cd(EXT_DIR) { ruby "extconf.rb" }
-end
-
-file EXT_BUNDLE => EXT_FILES do
- cd EXT_DIR do
- sh(WIN ? 'nmake' : 'make')
- end
- cp EXT_BUNDLE, 'lib/'
-end
View
2  tasks/gem.rake
@@ -11,6 +11,8 @@ spec = Gem::Specification.new do |s|
s.author = "Marc-Andre Cournoyer"
s.email = 'macournoyer@gmail.com'
s.homepage = 'http://code.macournoyer.com/thin/'
+ s.rubyforge_project = 'thin'
+ s.has_rdoc = true
s.executables = %w(thin)
s.required_ruby_version = '>= 1.8.6' # Makes sure the CGI eof fix is there
Please sign in to comment.
Something went wrong with that request. Please try again.