github_bitbucket_audit 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 921a09fbd5331053c1322d830e7c13f4302ed215
4
- data.tar.gz: 2e6c845eba869dd2bac4384e90b30087bead25ea
3
+ metadata.gz: a1e33467e1124a6760aa67b0b204687b674e93e1
4
+ data.tar.gz: 7d865ce52fbfa86c425ca0712561578333aed3f5
5
5
  SHA512:
6
- metadata.gz: 1ec5bd3e4de6d5f181ab00773fd5aaa6afc9cd3bcfe03c4d9aabd351a60dd9f80667965bddb5b7e355d0d1318e4f9d274cbb8e83823acab09c2b3be9061a8eb0
7
- data.tar.gz: 8d701d9a6c8afd8d12a72d83b032f441cafe94a7e220917ac5db977e980d6abc133481a6041387a14f59edbf97c4eb16e3f352f3bc2dfd8058222a58e37f55ec
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 = "0.0.2"
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.write_red_flag_record(user,public_repo.name)
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.write_red_flag_record(user,public_repo.name)
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.select { |files| @keyword_regex.match(files) }).empty?)
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 write_red_flag_record(user_name, repo_name)
8
- @fhandle.puts("Something fishy in REPO::#{repo_name} for USER:: #{user_name}")
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
@@ -1,3 +1,3 @@
1
1
  module GhBbAudit
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_bitbucket_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ankur Maheshwari