Class: ProjectHealth::Project

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Configurable
Defined in:
lib/project-health/config.rb,
lib/project-health/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Project

Returns a new instance of Project.



6
7
8
9
10
11
12
13
14
15
# File 'lib/project-health/project.rb', line 6

def initialize(name)
  @oct = Octokit::Client.new(auto_traversal: true,
                             per_page: 500, login: config.,
                             password: config.password)
  @name = name
  @reports = []
  add_report :basic
  add_report :pull_requests
  add_report :issues
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/project-health/project.rb', line 4

def name
  @name
end

Instance Method Details

#add_report(report) ⇒ Object



17
18
19
# File 'lib/project-health/project.rb', line 17

def add_report(report)
  @reports << ProjectHealth.const_get("#{report}_report".to_s.camelize).new(@oct, name)
end

#statsObject



21
22
23
24
25
# File 'lib/project-health/project.rb', line 21

def stats
  result = {}
  @reports.map{|x| result.merge!(x.stats) }
  { "Project" => result }
end