Sha256: ecb6b9327dffb667099efb3a4a0f82532c35994607215c291f5c51e708e97a15
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 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 = 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 = 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dev_tasks-0.0.18 | lib/dependencies.rb |