Class: Gitlang::CLI
- Inherits:
-
Thor
- Object
- Thor
- Gitlang::CLI
- Defined in:
- lib/gitlang.rb
Overview
Class containing the commands that the final user can use.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #relative_usage_per_language(organization) ⇒ Object
Constructor Details
#initialize(*args) ⇒ CLI
Returns a new instance of CLI.
13 14 15 16 17 18 |
# 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 |
Class Method Details
.exit_on_failure? ⇒ Boolean
20 21 22 |
# File 'lib/gitlang.rb', line 20 def self.exit_on_failure? true end |
Instance Method Details
#relative_usage_per_language(organization) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# 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.) end |