Sha256: 7ef90db444760d64b1f21b9e01f3d3ade4a0b198cce8eef0947469699453320f
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
#!/usr/bin/env ruby # needs to handle passing config. ~/.insulin or somrthing require 'insulin' require 'thor' module Insulin class I < Thor @@mongo = Insulin::MongoHandle.new ({"database" => "insulin"}) # map "-i" => :ingest desc "ingest FILE", "ingest OnTrack CSV export FILE" def ingest file csv = Insulin::OnTrackCsvFile.new file csv.save_events @@mongo end desc "day DATE", "show stats for day DATE (default is today)" def day date = nil if not date require 'time' date = Time.new.strftime "%F" end begin d = Insulin::Day.new date, @@mongo puts d rescue NoMethodError puts "No data for %s" % date end end desc "week DATE", "show stats for week commencing DATE (defaults to previous 7 days)" def week date = nil if not date require 'time' date = (Time.new - (6 * 86400)).strftime "%F" end w = Insulin::Week.new date, @@mongo puts w.to_s end default_task :day end end Insulin::I.start
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
insulin-0.0.17 | bin/insulin |
insulin-0.0.16 | bin/insulin |
insulin-0.0.15 | bin/insulin |
insulin-0.0.14 | bin/insulin |