nod 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nod.rb +4 -1
- data/lib/nod/gem_savvy.rb +5 -3
- data/lib/nod/git_cloner.rb +5 -2
- data/lib/nod/license_hunch.rb +1 -0
- metadata +1 -1
data/lib/nod.rb
CHANGED
@@ -25,6 +25,7 @@ class Nod
|
|
25
25
|
if successful_clone && File.exists?(tmp_dir)
|
26
26
|
files_in_repo = Dir.entries(tmp_dir)
|
27
27
|
licenses_files = files_in_repo.select { |file_name| file_name if (file_name =~ /license/i || file_name =~ /readme/i || file_name =~ /copying/i)}
|
28
|
+
# puts "license files for gem #{name} are #{licenses_files}, tmp dir is #{tmp_dir}"
|
28
29
|
if !licenses_files.nil? && licenses_files.size > 0
|
29
30
|
licenses_files.each do | file |
|
30
31
|
license_type = LicenseHunch.determine_license_from_file file, tmp_dir
|
@@ -36,8 +37,10 @@ class Nod
|
|
36
37
|
else
|
37
38
|
report = get_report name, url, 'Unknown'
|
38
39
|
end
|
39
|
-
|
40
|
+
else
|
40
41
|
# TODO handle this
|
42
|
+
info = @gem_savvy.info_for(name)
|
43
|
+
puts "info is #{info}"
|
41
44
|
puts "in else? file didn't exist? gem is #{name}"
|
42
45
|
end #file exists
|
43
46
|
else
|
data/lib/nod/gem_savvy.rb
CHANGED
@@ -33,12 +33,14 @@ class GemSavvy
|
|
33
33
|
|
34
34
|
def git_clone_url(gem_name)
|
35
35
|
http_url = gem_home gem_name
|
36
|
-
if !http_url.nil? && http_url.include?('github.com')
|
36
|
+
if !http_url.nil? && http_url.include?('http://github.com')
|
37
37
|
"#{http_url.gsub('http://', 'git://')}.git"
|
38
38
|
else
|
39
39
|
http_url = gem_source_home gem_name
|
40
|
-
if !http_url.nil? && http_url.include?('github.com')
|
41
|
-
|
40
|
+
if !http_url.nil? && http_url.include?('http://github.com')
|
41
|
+
"#{http_url.gsub('http://', 'git://')}.git"
|
42
|
+
elsif !http_url.nil? && http_url.include?('http://www.github.com')
|
43
|
+
"#{http_url.gsub('http://www.', 'git://')}.git"
|
42
44
|
else
|
43
45
|
nil
|
44
46
|
end
|
data/lib/nod/git_cloner.rb
CHANGED
@@ -9,10 +9,13 @@ class GitCloner
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def clone_url(url, to_url)
|
12
|
+
# puts "cloning #{url} to #{to_url}"
|
12
13
|
begin
|
13
|
-
@gritty.clone({:quiet => false, :verbose => true, :progress => true}, url, to_url)
|
14
|
+
@gritty.clone({:quiet => false, :verbose => true, :progress => true, :timeout => 320}, url, to_url)
|
14
15
|
true
|
15
|
-
rescue
|
16
|
+
rescue Exception => e
|
17
|
+
puts e.backtrace
|
18
|
+
puts e.to_s
|
16
19
|
puts "couldn't clone #{url}"
|
17
20
|
false
|
18
21
|
end
|
data/lib/nod/license_hunch.rb
CHANGED
@@ -14,6 +14,7 @@ class LicenseHunch
|
|
14
14
|
# puts "line is #{line}"
|
15
15
|
return 'MIT' if (line =~ /MIT License/i || line =~ /MIT/i || line =~ /mit-license/i)
|
16
16
|
return 'Ruby License' if (line =~ /Ruby license/i)
|
17
|
+
return 'Apache' if (line =~ /Apache License/i)
|
17
18
|
end
|
18
19
|
|
19
20
|
all_text = File.open(file_path).read.gsub(/\n/,' ')
|