Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

cleanup installer

  • Loading branch information...
commit bd6100609e698ff6ad9aebe746a87f039b2dcb83 1 parent 4dcbab9
James M. Lawrence authored March 16, 2011

Showing 1 changed file with 11 additions and 21 deletions. Show diff stats Hide diff stats

  1. 32  levitate.rb
32  levitate.rb
@@ -802,45 +802,35 @@ def initialize
802 802
       require 'rbconfig'
803 803
       require 'find'
804 804
 
805  
-      rb_root = RbConfig::CONFIG["sitelibdir"]
  805
+      @fu = FileUtils::Verbose
806 806
       @spec = []
807 807
 
  808
+      rb_root = RbConfig::CONFIG["sitelibdir"]
  809
+
808 810
       Find.find "lib" do |source|
809 811
         next if source == "lib"
810 812
         next unless File.directory?(source) || File.extname(source) == ".rb"
811 813
         dest = File.join(rb_root, source.sub(%r!\Alib/!, ""))
812  
-        @spec << { :source => source, :dest => dest }
  814
+        @spec << [source, dest]
813 815
       end
814 816
     end
815  
-  
  817
+
816 818
     def install
817  
-      @spec.each do |entry|
818  
-        source, dest = entry.values_at(:source, :dest)
  819
+      @spec.each do |source, dest|
819 820
         if File.directory?(source)
820  
-          unless File.directory?(dest)
821  
-            puts "mkdir #{dest}"
822  
-            FileUtils.mkdir(dest)
823  
-          end
  821
+          @fu.mkdir(dest) unless File.directory?(dest)
824 822
         else
825  
-          puts "install #{source} --> #{dest}"
826  
-          FileUtils.install(source, dest)
  823
+          @fu.install(source, dest)
827 824
         end
828 825
       end
829 826
     end
830 827
   
831 828
     def uninstall
832  
-      @spec.reverse.each do |entry|
833  
-        source, dest = entry.values_at(:source, :dest)
  829
+      @spec.reverse.each do |source, dest|
834 830
         if File.directory?(source)
835  
-          if File.directory?(dest)
836  
-            puts "rmdir #{dest}"
837  
-            FileUtils.rmdir(dest)
838  
-          end
  831
+          @fu.rmdir(dest) if File.directory?(dest)
839 832
         else
840  
-          if File.file?(dest)
841  
-            puts "rm #{dest}"
842  
-            FileUtils.rm(dest)
843  
-          end
  833
+          @fu.rm(dest) if File.file?(dest)
844 834
         end
845 835
       end
846 836
     end

0 notes on commit bd61006

Please sign in to comment.
Something went wrong with that request. Please try again.