Class: Gitrob::CLI::Commands::Analyze

Inherits:
Gitrob::CLI::Command show all
Includes:
Analysis, Gathering
Defined in:
lib/gitrob/cli/commands/analyze.rb,
lib/gitrob/cli/commands/analyze/analysis.rb,
lib/gitrob/cli/commands/analyze/gathering.rb

Defined Under Namespace

Modules: Analysis, Gathering

Instance Attribute Summary

Attributes inherited from Gitrob::CLI::Command

#options

Instance Method Summary collapse

Methods included from Analysis

#analyze_blobs, #analyze_repositories, #report_findings

Methods included from Gathering

#client_manager_configuration, #gather_owners, #gather_repositories, #github_access_tokens, #github_client_manager, #github_data_manager, #make_repo_gathering_progress_bar, #owner_count, #repo_count, #repository_gathering_update

Methods inherited from Gitrob::CLI::Command

#debug, #debugging_enabled?, #error, #fatal, #info, #output, #progress_bar, start, #task, #thread_pool, #warn

Constructor Details

#initialize(targets, options) ⇒ Analyze

Returns a new instance of Analyze.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gitrob/cli/commands/analyze.rb', line 11

def initialize(targets, options)
  Thread.abort_on_exception = true
  @options = options
  @targets = targets.split(",").map(&:strip).uniq
  load_signatures!
  create_database_assessment
  gather_owners
  gather_repositories
  analyze_repositories
  @db_assessment.finished = true
  @db_assessment.save
  start_web_server
end

Instance Method Details

#blobs_for_repository(repo) ⇒ Object



65
66
67
# File 'lib/gitrob/cli/commands/analyze/analysis.rb', line 65

def blobs_for_repository(repo)
  github_data_manager.blobs_for_repository(repo)
end

#repo_progress_barObject



52
53
54
55
56
57
58
59
# File 'lib/gitrob/cli/commands/analyze/analysis.rb', line 52

def repo_progress_bar
  progress_bar(
    "Analyzing repositories...",
    :total => repository_count) do |progress|
    yield progress
  end
  sleep 0.1
end

#repositories_for_owner(owner) ⇒ Object



61
62
63
# File 'lib/gitrob/cli/commands/analyze/analysis.rb', line 61

def repositories_for_owner(owner)
  github_data_manager.repositories_for_owner(owner)
end

#repository_countObject



69
70
71
# File 'lib/gitrob/cli/commands/analyze/analysis.rb', line 69

def repository_count
  @github_data_manager.repositories.count
end