Class: Reponaut::Application::Command
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#repos ⇒ Object
readonly
Returns the value of attribute repos.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(prog) ⇒ Command
constructor
A new instance of Command.
- #process(options, args) ⇒ Object
- #quit(code, msg) ⇒ Object
Constructor Details
#initialize(prog) ⇒ Command
Returns a new instance of Command.
17 |
# File 'lib/reponaut/command.rb', line 17 def initialize(prog); end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
15 16 17 |
# File 'lib/reponaut/command.rb', line 15 def client @client end |
#repos ⇒ Object (readonly)
Returns the value of attribute repos.
15 16 17 |
# File 'lib/reponaut/command.rb', line 15 def repos @repos end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
15 16 17 |
# File 'lib/reponaut/command.rb', line 15 def username @username end |
Class Method Details
.inherited(base) ⇒ Object
9 10 11 12 |
# File 'lib/reponaut/command.rb', line 9 def inherited(base) subclasses << base super end |
.subclasses ⇒ Object
5 6 7 |
# File 'lib/reponaut/command.rb', line 5 def subclasses @subclasses ||= [] end |
Instance Method Details
#process(options, args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/reponaut/command.rb', line 19 def process(, args) raise ArgumentError.new('You must specify a username') if args.empty? @username = args.first @client = Reponaut::GitHub::Client.new(username) @repos = client.repos.reject { |r| r.language.nil? } @repos = @repos.find_all { |r| r.source? } if ['ignore_forks'] rescue Reponaut::GitHub::NoSuchUserError quit 4, "No such user: #{username}" rescue Reponaut::GitHub::RateLimitExceededError quit 5, 'GitHub rate limit exceeded. Try your request again later.' end |
#quit(code, msg) ⇒ Object
31 32 33 34 |
# File 'lib/reponaut/command.rb', line 31 def quit(code, msg) $stderr.puts msg exit code end |