class HubStore::Cli

Attributes

argv[R]

Public Class Methods

new(argv) click to toggle source
# File lib/hub_store/cli.rb, line 11
def initialize(argv)
  @argv = argv
end
run(*args) click to toggle source
# File lib/hub_store/cli.rb, line 7
def self.run(*args)
  new(*args).run
end

Public Instance Methods

run() click to toggle source
# File lib/hub_store/cli.rb, line 15
def run
  link_logger_to_ui
  import_data
  export_csv
end

Private Instance Methods

export_csv() click to toggle source
# File lib/hub_store/cli.rb, line 35
def export_csv
  RESOURCES.each do |name, resource|
    ui.start("Exporting #{name}")
    Exporter.new(resource: resource).run
    ui.stop("Done.")
  end
end
import_data() click to toggle source
# File lib/hub_store/cli.rb, line 29
def import_data
  repos.each do |repo|
    Storage::Import.new(repo: repo, since: since).run
  end
end
repo_names() click to toggle source
# File lib/hub_store/cli.rb, line 51
def repo_names
  argv[0].presence || stop
end
repos() click to toggle source
# File lib/hub_store/cli.rb, line 47
def repos
  repo_names.split(",")
end
since() click to toggle source
# File lib/hub_store/cli.rb, line 55
def since
  ENV["SINCE"]
end
stop() click to toggle source
# File lib/hub_store/cli.rb, line 59
def stop
  puts "\nUsage: OCTOKIT_ACCESS_TOKEN=<token> #{$0} <github_org/repo_name>"
  exit
end
ui() click to toggle source
# File lib/hub_store/cli.rb, line 43
def ui
  @_ui ||= Ui.new
end