lib/dependencies.rb in dev_tasks-0.0.26 vs lib/dependencies.rb in dev_tasks-0.0.27

- old
+ new

@@ -22,10 +22,11 @@ def initialize_csharp_dependencies cs_dep_hash=Hash.new #includes = Array.new #hints = Array.new Dir.glob("**/*.csproj").each{|f| + #cs_proj_dep = Dependencies.get_dependencies_from_file f text=File.read(f) text.scan(/<Reference Include="([\w\.-]+)"/).each{|r| cs_dep_hash[r.first.to_s]=r.first.to_s if !cs_dep_hash.has_key? r.first.to_s } text.scan(/<HintPath>([\w\.\\\s-]+)</).each{|r| @@ -48,9 +49,38 @@ if cs_deps.length > 0 cs_deps[:system]=cs_deps[:system].sort# = cs_deps.sort cs_deps[:file]=cs_deps[:file] self["C#"]=cs_deps end + end + + def self.get_dependencies_from_file filename + text=File.read(f) + text.scan(/<Reference Include="([\w\.-]+)"/).each{|r| + cs_dep_hash[r.first.to_s]=r.first.to_s if !cs_dep_hash.has_key? r.first.to_s + } + text.scan(/<HintPath>([\w\.\\\s-]+)</).each{|r| + hint = r.first.to_s + include = hint.split('\\').last + cs_dep_hash.delete include.gsub(".dll","") + cs_dep_hash[include]=hint + } + + cs_deps = Hash.new + cs_dep_hash.each do |include,hint| + if(include==hint) + cs_deps[:system]=Array.new if !cs_deps.has_key?(:system) + cs_deps[:system]<< hint + else + cs_deps[:file]=Array.new if !cs_deps.has_key?(:file) + cs_deps[:file] << hint + end + end + if cs_deps.length > 0 + cs_deps[:system]=cs_deps[:system].sort + cs_deps[:file]=cs_deps[:file] + end + cs_deps end def show self.each do |key,array| if(array.length > 0) \ No newline at end of file