in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

May 2008 - Posts

  • Using ruby to syncronize some files

    eCRM uses several open source projects.

    When the open source project changes I need to get those changes, build the code on my machine and then copy the new dll's into eCRM's DependentFiles/<ProjectName> folder.

    I have this somewhat automated using ruby (more specifically rake)

    Here is a simple class called LibCopy

    class LibCopy
    
      def copy(lib_files, lib_build_dir)
        libs_in_use = lib_files
        libs_in_use.each do |lib|
          puts "Check for " + lib
          lib_file = lib_build_dir + "/" +  lib.pathmap("%f") 
          if File.exists?(lib_file)
            puts "Found " + lib_file
            cp lib_file, File.expand_path(lib.pathmap("%p"))
          else
            puts "lib not found:" + lib_file 
          end
        end
      end
    end

    And then the way I use this is like so

    task :castle_to_ecrm do
        dest_castle_libs = FileList['./ecrm/DependentFiles/Castle/*']
        LibCopy.new.copy(dest_castle_libs,CASTLE_BUILD_DIR)
    end
Powered by Community Server (Commercial Edition), by Telligent Systems