Class: GHTRetrieveDependents
- Inherits:
-
GHTorrent::Command
- Object
- GHTorrent::Command
- GHTRetrieveDependents
- Defined in:
- lib/ghtorrent/commands/ght_retrieve_dependents.rb
Constant Summary collapse
- REQ_ARGS =
{ :commit => 3, :issue => 3, :pull_request => 3 }
Constants included from GHTorrent::Persister
GHTorrent::Persister::ADAPTERS
Constants included from GHTorrent::Settings
GHTorrent::Settings::CONFIGKEYS, GHTorrent::Settings::DEFAULTS
Instance Method Summary collapse
- #db ⇒ Object
- #ghtorrent ⇒ Object
- #go ⇒ Object
- #persister ⇒ Object
- #prepare_options(options) ⇒ Object
Methods included from GHTorrent::Persister
Methods included from GHTorrent::Logging
#debug, #error, #info, #loggerr, #warn
Methods included from GHTorrent::Settings
#config, #merge, #merge_config_values, #override_config, #settings
Methods included from GHTorrent::Utils
included, #read_value, #user_type, #write_value
Methods inherited from GHTorrent::Command
#command_name, #override_config, #process_options, #queue_client, run, #validate, #version
Instance Method Details
#db ⇒ Object
45 46 47 48 |
# File 'lib/ghtorrent/commands/ght_retrieve_dependents.rb', line 45 def db @db ||= ghtorrent.get_db @db end |
#ghtorrent ⇒ Object
40 41 42 43 |
# File 'lib/ghtorrent/commands/ght_retrieve_dependents.rb', line 40 def ghtorrent @gh ||= GHTorrent::Mirror.new(@settings) @gh end |
#go ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ghtorrent/commands/ght_retrieve_dependents.rb', line 50 def go db type = case ARGV[0] when 'commit' :commit when 'issue' :issue when 'pull_request' :pull_request else Trollop::die("Don't know how to handle #{ARGV[0]}") end unless ARGV.size - 1 == REQ_ARGS[type] Trollop::die("#{ARGV[0]} requires #{REQ_ARGS[type]} arguments") end case type when :commit ghtorrent.ensure_commit(ARGV[2], ARGV[3], ARGV[1], true) when :issue ghtorrent.ensure_issue(ARGV[1], ARGV[2], ARGV[3], true, true, true) when :pull_request ghtorrent.ensure_pull_request(ARGV[1], ARGV[2], ARGV[3], true, true, true) end end |
#persister ⇒ Object
35 36 37 38 |
# File 'lib/ghtorrent/commands/ght_retrieve_dependents.rb', line 35 def persister @persister ||= connect(:mongo, settings) @persister end |
#prepare_options(options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ghtorrent/commands/ght_retrieve_dependents.rb', line 15 def () . <<-BANNER Recursively retrieve all dependent entities for a specific entity #{command_name} [options] entity entity-id #{command_name} entity is one of (in parenthesis the entity-id fields): commit (owner repo sha) issue (owner repo issue_id) pull_request (owner repo pullreq_id) #{command_name} BANNER end |