lib/dependencies.rb in dev_tasks-0.0.35 vs lib/dependencies.rb in dev_tasks-0.0.36

- old
+ new

@@ -21,43 +21,41 @@ ruby_deps=Array.new cs_system_deps=Array.new cs_file_deps=Array.new Dir.glob("**/*.rb").each{|f| text=File.read(f) - ruby_deps.zip(Dependencies.ruby_dependencies(text)).flatten.compact - cs_system_deps.zip(Dependencies.csharp_system_dependencies(text)).flatten.compact - cs_file_deps.zip(Dependencies.csharp_file_dependencies(text)).flatten.compact + ruby_deps=ruby_deps|Dependencies.ruby_dependencies(text) + cs_system_deps=cs_system_deps|Dependencies.csharp_system_dependencies(text) + cs_file_deps=cs_file_deps|Dependencies.csharp_file_dependencies(text) } + self[:ruby]=ruby_deps.sort if(ruby_deps.length>0) if(cs_system_deps.length > 0 || cs_file_deps.length > 0) self["C#"]=Hash.new self["C#"][:system]=cs_system_deps.sort if(cs_system_deps.length > 0) self["C#"][:file]=cs_file_deps.sort if(cs_file_deps.length > 0) end end def self.ruby_dependencies source - deps=Array.new - deps=Array.new + result=Array.new source.scan(/require '([\w\/]+)/).each{|m| dep=m.first.to_s - deps << dep if(!deps.include?(dep)) + result << dep if(!result.include?(dep)) } - deps + return result end def self.csharp_system_dependencies source deps=Array.new - deps=Array.new source.scan(/<Reference Include="([\w\.-]+)"[\s]+\//).each{|m| dep=m.first.to_s deps << dep if(!deps.include?(dep)) } deps end def self.csharp_file_dependencies source - deps=Array.new deps=Array.new source.scan(/<HintPath>([\w\.\\\s-]+)</).each{|m| dep=m.first.to_s deps << dep if(!deps.include?(dep)) } \ No newline at end of file