Skip to content

Commit

Permalink
Updated for more license analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusk committed Dec 19, 2011
1 parent 709d0e6 commit 49d72f2
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions analyze.rb
Expand Up @@ -19,26 +19,26 @@ def addToCount( hash, key )

unless File.directory? f
puts f
content = license.sysread(20000)
content = license.sysread(20000).gsub(/\n/,"")
if content.match("Permission is hereby granted, free of charge, to any person")
puts "MIT License!"
addToCount(count,"MIT License")
elsif content.match("Redistribution and use in source and binary forms")
elsif content.match("Redistribution and use in source and binary forms") or content.match("Redistribution and use of this software in source and binary forms")
puts "BSD License!"
addToCount(count,"BSD License")
elsif content.match("PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE")
elsif content.match("ECLIPSE")
puts "Eclipse License"
addToCount(count,"Eclipse License")
elsif content.match("GNU General Public License")
puts "GPL"
addToCount(count,"GPL")
elsif content.match("GNU Lesser General Public License")
elsif content.match("GNU Lesser") or content.match("LGPL")
puts "LGPL"
addToCount(count,"LGPL")
elsif content.match("GNU General") or content.match("GPL")
puts "GPL"
addToCount(count,"GPL")
elsif content.match("Apache License")
puts "Apache"
addToCount(count,"Apache License")
elsif content.match("Permission is granted to anyone to use this software for any purpose")
elsif content.match("Permission is granted to anyone to use this software for any purpose") or content.match("Permission to use, copy, modify, and distribute this software")
puts "Do what thou wilt"
addToCount(count,"Do what thou wilt")
elsif content.match("is copyrighted free software by")
Expand All @@ -50,8 +50,20 @@ def addToCount( hash, key )
elsif content.match("MOZILLA PUBLIC LICENSE")
puts "Mozilla Public License"
addToCount(count,"Mozilla Public License")
elsif content.match("creativecommons.org") or content.match ("Creative Commons")
puts "Creative Commons"
addToCount(count,"Creative Commons")
elsif content.match("Microsoft Permissive License")
puts "Microsoft Permissive License"
addToCount(count,"Microsoft Permissive License")
elsif content.match(/public domain/i)
puts "Public Domain"
addToCount(count,"Public Domain")
elsif content.match("The Artistic License")
puts "The Artistic License"
addToCount(count,"The Artistic License")
else
puts "other!"
puts "****************other!"
addToCount(count,"other")
end

Expand All @@ -65,5 +77,5 @@ def addToCount( hash, key )
end

count.each { |k,v|
puts k, v
puts "#{k}\t#{v}"
}

0 comments on commit 49d72f2

Please sign in to comment.