github_bitbucket_audit 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gh_bb_audit.gemspec +1 -1
- data/lib/gh_bb_audit/github_scanner.rb +2 -4
- data/lib/gh_bb_audit/keyword_matcher.rb +5 -1
- data/lib/gh_bb_audit/output_writer.rb +13 -2
- data/lib/gh_bb_audit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1e33467e1124a6760aa67b0b204687b674e93e1
|
4
|
+
data.tar.gz: 7d865ce52fbfa86c425ca0712561578333aed3f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a89ca8927d17c239892fbfdf4999d46a8ea9293c44f0578dea9f32de0007ec46a40703dccadd4f5eba03dd140dcc29a2013e9a405a3e3367bee9bde221eea2dc
|
7
|
+
data.tar.gz: 8ece21087c45722a2ba070832838f039ea80fb642cf2283bd165e9eadf3e7c379f4b61140b1343efa4afa83f7787c59a48e6fa4666ebd33bece5d7c93f5c65a1
|
data/gh_bb_audit.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'gh_bb_audit/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "github_bitbucket_audit"
|
8
|
-
spec.version =
|
8
|
+
spec.version = GhBbAudit::VERSION
|
9
9
|
spec.summary = "Looks for specific keywords in the public repos of github and bitbucket"
|
10
10
|
spec.date = "2014-04-01"
|
11
11
|
spec.description = "The library takes a list of users and searches their public repos for specific keywords"
|
@@ -21,15 +21,13 @@ module GhBbAudit
|
|
21
21
|
::GhBbAudit::GithubUser.new(user).public_repos.each do |public_repo|
|
22
22
|
logger.info("Scanning Repo:: #{public_repo.name} for User:: #{user}")
|
23
23
|
if matcher.repo_contains_keyword?([public_repo.name])
|
24
|
-
output_writer.
|
25
|
-
break
|
24
|
+
output_writer.repo_name_matched(public_repo.name,user)
|
26
25
|
end
|
27
26
|
|
28
|
-
|
29
27
|
file_paths = ::GhBbAudit::GithubRepo.new(user,public_repo.name).get_all_file_paths
|
30
28
|
|
31
29
|
if matcher.repo_contains_keyword?(file_paths)
|
32
|
-
output_writer.
|
30
|
+
output_writer.file_paths_matched_in_repo(matcher.matched_file_paths(file_paths),public_repo.name, user)
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
@@ -6,7 +6,11 @@ module GhBbAudit
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def repo_contains_keyword?(repo_file_paths)
|
9
|
-
!((repo_file_paths
|
9
|
+
!(matched_file_paths(repo_file_paths).empty?)
|
10
|
+
end
|
11
|
+
|
12
|
+
def matched_file_paths(repo_file_paths)
|
13
|
+
repo_file_paths.select { |files| @keyword_regex.match(files) }
|
10
14
|
end
|
11
15
|
end
|
12
16
|
end
|
@@ -4,8 +4,19 @@ module GhBbAudit
|
|
4
4
|
@fhandle = File.open(path_to_file, 'w+')
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
8
|
-
@fhandle.puts("
|
7
|
+
def repo_name_matched(repo_name,user_name)
|
8
|
+
@fhandle.puts("")
|
9
|
+
@fhandle.puts("The name of REPO::#{repo_name} for USER::#{user_name} matches keywords")
|
10
|
+
@fhandle.puts("")
|
11
|
+
end
|
12
|
+
|
13
|
+
def file_paths_matched_in_repo(file_path_array,repo_name,user_name)
|
14
|
+
@fhandle.puts("")
|
15
|
+
@fhandle.puts("For the REPO::#{repo_name} for USER::#{user_name}, the following file paths matched")
|
16
|
+
file_path_array.each do |file_path|
|
17
|
+
@fhandle.puts("---- #{file_path}")
|
18
|
+
end
|
19
|
+
@fhandle.puts("")
|
9
20
|
end
|
10
21
|
|
11
22
|
def close
|
data/lib/gh_bb_audit/version.rb
CHANGED