class Gitlang::CLI

Class containing the commands that the final user can use.

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/gitlang.rb, line 20
def self.exit_on_failure?
  true
end
new(*args) click to toggle source
Calls superclass method
# File lib/gitlang.rb, line 13
def initialize(*args)
  super
  @client = Octokit::Client.new access_token: ENV['GITHUB_TOKEN']
  @formatter = JsonFormatter.new
  @spinner = TTY::Spinner.new('[:spinner] Data crunching... ')
end

Public Instance Methods

relative_usage_per_language(organization) click to toggle source
# File lib/gitlang.rb, line 26
def relative_usage_per_language(organization)
  @spinner.auto_spin
  @organization = Organization.new(organization, @client)
  usage_per_repo = @organization.usage_per_repo
  relative_usage = @organization.relative_usage_per_language(usage_per_repo)
  puts @formatter.format(@organization.name, relative_usage)
  @spinner.success('Done')
rescue GitlangError => e
  @spinner.error('Failure: ' + e.message)
end