Extract build/install logic into its own method.
authorAntonio Terceiro <terceiro@softwarelivre.org>
Wed, 11 May 2011 19:17:36 +0000 (12:17 -0700)
committerAntonio Terceiro <terceiro@softwarelivre.org>
Wed, 11 May 2011 19:18:42 +0000 (12:18 -0700)
This method could be overriden by subclasses to provide different
methods of building/installing (hint hint ;-))

lib/gem2deb/dh_ruby.rb

index c151f4c..298ed4f 100644 (file)
@@ -103,11 +103,26 @@ module Gem2Deb
 
       package = packages.first
 
+      install_files_and_build_extensions(package, supported_versions)
+
+      run_tests(supported_versions)
+
+      install_substvars(package, supported_versions)
+
+      update_shebangs(package)
+
+      check_rubygems
+
+      puts "  Leaving dh_ruby --install" if @verbose
+    end
+
+    protected
+
+    def install_files_and_build_extensions(package, supported_versions)
       install_files('bin', find_files('bin'), File.join(destdir_for(package), @bindir),             755) if File::directory?('bin')
 
       install_files('lib', find_files('lib'), File.join(destdir_for(package), RUBY_CODE_DIR), 644) if File::directory?('lib')
 
-
       if metadata.has_native_extensions?
         supported_versions.each do |rubyver|
           puts "Building extension for #{rubyver} ..." if @verbose
@@ -122,22 +137,8 @@ module Gem2Deb
           end
         end
       end
-
-      run_tests(supported_versions)
-
-      install_substvars(package, supported_versions)
-
-      update_shebangs(package)
-
-      # FIXME after install, check for require 'rubygems' and other stupid things, and
-      #       issue warnings
-
-      check_rubygems
-      puts "  Leaving dh_ruby --install" if @verbose
     end
 
-    protected
-
     def remove_duplicate_files(src, dst)
       candidates = (Dir::entries(src) & Dir::entries(dst)) - ['.', '..']
       candidates.each do |cand|