Sha256: 237a86784f83d018cc91b6d64791cc0ec41c782c292bdbe56d434e84eeeb7259
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 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[:system]=cs_deps[:system].sort# = cs_deps.sort cs_deps[:file]=cs_deps[:file] 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dev_tasks-0.0.26 | lib/dependencies.rb |
dev_tasks-0.0.25 | lib/dependencies.rb |