class Standupguy::Core

Generic methods that were moved from bin/standupguy to here in order to better test this code. Mostly init stuff.

Constants

DATA_ROOT

Attributes

options[RW]

Public Class Methods

new(options) click to toggle source
# File lib/Standupguy.rb, line 52
def initialize(options)
  @options = options

  first_time! unless Dir.exist?(DATA_ROOT)

  @options[:date] ||= DateTime.now.strftime("%Y-%m-%d")

  if @options[:item]
    item = Standupguy::Item.new
    item.add_to_today(@options[:item])
    item.save
  end
end

Public Instance Methods

first_time!() click to toggle source
# File lib/Standupguy.rb, line 81
def first_time!
  Kernel.puts("First time running...\nCreating data directory")
  Dir.mkdir(DATA_ROOT)
  File.open(File.join(DATA_ROOT, "standup.json"), "a+").close
end
report() click to toggle source
# File lib/Standupguy.rb, line 70
def report
  case @options[:report]
  when "HTML"
    Standupguy::HTMLReport.new(@options[:date])
  when "EMAIL"
    Standupguy::EmailReport.new(@options[:date])
  else
    Standupguy::TextReport.new(@options[:date])
  end
end
show() click to toggle source
# File lib/Standupguy.rb, line 66
def show
  report.show
end