Sha256: 6e914e0166dc76eabea7eeb9fd25e7482fb0efaf4a5af87f142cc7ce52454de3
Contents?: true
Size: 1.32 KB
Versions: 8
Compression:
Stored size: 1.32 KB
Contents
class Dependencies < Hash def initialize initialize_ruby_dependencies initialize_csharp_dependencies end def initialize_ruby_dependencies ruby_deps = Array.new Dir.glob("**/*.rb").each{|f| text=File.read(f) text.scan(/require '([\w\/]+)/).each{|r| ruby_deps << r.first.to_s if !ruby_deps.include? r } } if ruby_deps.length > 0 ruby_deps = ruby_deps.sort self["ruby"]=ruby_deps end end def initialize_csharp_dependencies cs_dep_hash=Hash.new #includes = Array.new #hints = Array.new Dir.glob("**/*.csproj").each{|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| hint = r.first.to_s include = hint.split('\\').last cs_dep_hash.delete include.gsub(".dll","") cs_dep_hash[include]=hint } } cs_deps = Array.new cs_dep_hash.each do |include,hint| cs_deps << hint end if cs_deps.length > 0 cs_deps = cs_deps.sort self["C#"]=cs_deps end end def show self.each do |key,array| if(array.length > 0) puts key array.each {|v| puts " " + Color.green + v + Color.clear + " " } end end puts " " end end
Version data entries
8 entries across 8 versions & 1 rubygems