Class: GithubStats::CLI

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

Overview

Main entrance point to the command line tool. Sets defaults and parses options etc.

Defined Under Namespace

Classes: CommaSeperatedLinePerResultResultsView

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remaining_args, options) ⇒ CLI

Returns a new instance of CLI.



11
12
13
14
15
16
17
# File 'lib/github_stats/cli.rb', line 11

def initialize(remaining_args, options)
  @search_string = remaining_args.join(' ')
  options[:database_url] ||= "sqlite://#{home_dir}/db.sqlite"
  options[:report_type] ||= 'issues_closed_by_week'
  options[:ingest] = true unless options.key?(:ingest)
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



9
10
11
# File 'lib/github_stats/cli.rb', line 9

def options
  @options
end

#search_stringObject

Returns the value of attribute search_string.



9
10
11
# File 'lib/github_stats/cli.rb', line 9

def search_string
  @search_string
end

Class Method Details

.run(search_string, options) ⇒ Object



5
6
7
# File 'lib/github_stats/cli.rb', line 5

def self.run(search_string, options)
  new(search_string, options).run
end

Instance Method Details

#runObject



19
20
21
22
23
# File 'lib/github_stats/cli.rb', line 19

def run
  setup_db
  ingest
  results
end