]> git.wincent.com - mkdtemp.git/commitdiff
Set up dependencies properly in Rakefile
authorWincent Colaiuta <win@wincent.com>
Thu, 29 Jul 2010 06:55:39 +0000 (08:55 +0200)
committerWincent Colaiuta <win@wincent.com>
Thu, 29 Jul 2010 06:55:39 +0000 (08:55 +0200)
Signed-off-by: Wincent Colaiuta <win@wincent.com>
Rakefile

index 48eb62dc22ff5158b0d1af2188980505012227a5..28ee99266ec58319422f4281fa4dd96d4b1ffa7f 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -62,10 +62,15 @@ Spec::Rake::SpecTask.new('specdoc') do |t|
   t.out         = 'specdoc.rd'
 end
 
-desc 'Build extension'
-task :make do |t|
+file 'ext/Makefile' => ['ext/depend', 'ext/extconf.rb'] do
   Dir.chdir 'ext' do
     ruby './extconf.rb'
+  end
+end
+
+desc 'Build extension'
+task :make => ['ext/mkdtemp.c', 'ext/ruby_compat.h', 'ext/Makefile'] do |t|
+  Dir.chdir 'ext' do
     system 'make'
   end
 end
@@ -82,12 +87,30 @@ task :upload_rdoc => :rdoc do
   sh 'scp -r html/* rubyforge.org:/var/www/gforge-projects/mkdtemp/'
 end
 
-desc 'Build gem ("gem build")'
-task :build => :make do
+EXT_FILE = "ext/mkdtemp.#{Config::CONFIG['DLEXT']}"
+
+file EXT_FILE => :make
+
+GEM_FILE_DEPENDENCIES = [
+  EXT_FILE, # not actually included in gem, but we want to be sure it builds
+  'ext/depend',
+  'ext/extconf.rb',
+  'ext/mkdtemp.c',
+  'ext/ruby_compat.h',
+  'lib/mkdtemp/version.rb',
+  'mkdtemp.gemspec'
+]
+
+GEM_FILE = "mkdtemp-#{Dir::Mkdtemp::VERSION}.gem"
+
+file GEM_FILE => GEM_FILE_DEPENDENCIES do
   system 'gem build mkdtemp.gemspec'
 end
 
+desc 'Build gem ("gem build")'
+task :build => GEM_FILE
+
 desc 'Publish gem ("gem push")'
-task :push => "mkdtemp-#{Dir::Mkdtemp::VERSION}.gem" do
-  system "gem push mkdtemp-#{Dir::Mkdtemp::VERSION}.gem"
+task :push => :build do
+  system "gem push #{GEM_FILE}"
 end