Class: GithubAnalyze::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/github_analyze/cli.rb

Instance Method Summary collapse

Instance Method Details

#csv(organization, file_path) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/github_analyze/cli.rb', line 16

def csv(organization, file_path)
  CSV.open(file_path, 'wb') do |csv|
    csv << ['Repository', 'Language', 'Created At']
    client.organization(name: organization).repositories.each do |repository|
      primary_language = repository.primary_language
      csv <<
        [
          repository.name,
          (primary_language ? primary_language.name : 'None'),
          repository.created_at
        ]
    end
  end
end

#stats(organization) ⇒ Object



8
9
10
11
12
13
# File 'lib/github_analyze/cli.rb', line 8

def stats(organization)
  client.organization(name: organization)
    .ranked_languages
    .each
      .with_index { |language, i| puts "#{i + 1} - #{language}" }
end