class Github::Nippou::Commands

Public Instance Methods

init() click to toggle source
# File lib/github/nippou/commands.rb, line 35
def init
  Init.new(settings: settings).run
end
list() click to toggle source
# File lib/github/nippou/commands.rb, line 19
def list
  lines = []
  mutex = Mutex.new
  format = Format.new(settings, debug)

  Parallel.each_with_index(user_events, in_threads: settings.thread_num) do |user_event, i|
    # Contain GitHub access.
    # So should not put into the mutex block.
    line = format.line(user_event, i)
    mutex.synchronize { lines << line }
  end

  puts format.all(lines)
end
open_settings() click to toggle source
# File lib/github/nippou/commands.rb, line 40
def open_settings
  puts "Open #{settings.url}"
  Launchy.open(settings.url)
end
version() click to toggle source
# File lib/github/nippou/commands.rb, line 46
def version
  puts VERSION
end

Private Instance Methods

debug() click to toggle source
# File lib/github/nippou/commands.rb, line 62
def debug
  @debug ||= options[:debug]
end
settings() click to toggle source
# File lib/github/nippou/commands.rb, line 58
def settings
  @settings ||= Settings.new
end
user_events() click to toggle source
# File lib/github/nippou/commands.rb, line 52
def user_events
  @user_events ||= UserEvents.new(
    settings.client, settings.user, options[:since_date], options[:until_date]
  ).collect
end