Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated for more license analysis

  • Loading branch information...
commit 49d72f2edcb02bcdc71ef607e1cc8e11d25be920 1 parent 709d0e6
@dariusk dariusk authored
Showing with 22 additions and 10 deletions.
  1. +22 −10 analyze.rb
View
32 analyze.rb
@@ -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")
@@ -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
@@ -65,5 +77,5 @@ def addToCount( hash, key )
end
count.each { |k,v|
- puts k, v
+ puts "#{k}\t#{v}"
}
Please sign in to comment.
Something went wrong with that request. Please try again.