Standupguy 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5de7e3f00059222502c7d1da5129d2daddfb5853
4
- data.tar.gz: 4d83f6f677e20f529241204e17bbf1582d617791
3
+ metadata.gz: ba4bd2e4edfbcee6241461bb5008fe793faf4b65
4
+ data.tar.gz: 1238127b7bb2644348b6318a2e2cc156d79cd549
5
5
  SHA512:
6
- metadata.gz: cfa537dc8fe381f18395e6f45498613815bea3bdd30aea4fe76853329d316e18c94bdaa682648ca6b674a1cb1fb62e7dc4c5a3bb36890795a744cc7d15ccd591
7
- data.tar.gz: eca38c2cb3fb5d0b30bcb3b587f7daddce6914ca0ae4b3b43de80839550869d5ef2aae50f9ffe4232c0b4032f0789316f729019d863cca5614c63ad3ddb44d7e
6
+ metadata.gz: 8017d3360110eeb5df50d4036bc3d1b53589f265087cd51ad060f5b8acbaf3931470b25806bfe62c4ec7dda768a74b5e829998549d8ad4b1cbe94e256f25eda5
7
+ data.tar.gz: c734bd54c9da9f8b2d4680c96d5810107158c661015b6e0a37d348e2f477f5bbbfc884b0618bb05a319da1b87f1e800167ed577ba0d2d4ed18221b46f4d7bfde
data/.semver CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 6
4
+ :patch: 8
5
5
  :special: ''
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Coverage Status](https://img.shields.io/coveralls/apanzerj/Standupguy.svg)](https://coveralls.io/r/apanzerj/Standupguy) [![Test Status](https://travis-ci.org/apanzerj/Standupguy.svg?branch=master)](https://travis-ci.org/apanzerj/Standupguy)
1
+ [![Coverage Status](https://img.shields.io/coveralls/apanzerj/StandUpGuy.svg)](https://coveralls.io/r/apanzerj/StandUpGuy) [![Test Status](https://travis-ci.org/apanzerj/StandUpGuy.svg?branch=master)](https://travis-ci.org/apanzerj/StandUpGuy)
2
2
 
3
3
  # Standupguy
4
4
 
@@ -8,7 +8,7 @@ OptionParser.new do |opts|
8
8
  opts.banner = 'Usage: standupguy [options]'
9
9
 
10
10
  opts.on('-r', '--report=FORMAT', 'Show an HTML report') do |r|
11
- options[:report] = r
11
+ options[:report] = r.nil? ? "TEXT" : r.upcase
12
12
  end
13
13
 
14
14
  opts.on('-d', '--date=YYYY-MM-DD', 'Date of standup. ALL for all') do |date|
@@ -18,4 +18,4 @@ end.parse!
18
18
 
19
19
  options.merge!(item: ARGV.join(' ')) unless ARGV.empty?
20
20
 
21
- Standupguy::Core.new(options)
21
+ Standupguy::Core.new(options).show
@@ -46,28 +46,35 @@ module Standupguy
46
46
  # in order to better test this code. Mostly init stuff.
47
47
  class Core
48
48
  DATA_ROOT = File.join(ENV["HOME"], ".standupguy")
49
+
50
+ attr_accessor :options
51
+
49
52
  def initialize(options)
53
+ @options = options
54
+
50
55
  first_time! unless Dir.exist?(DATA_ROOT)
51
56
 
52
- if options[:item]
57
+ @options[:date] ||= DateTime.now.strftime("%Y-%m-%d")
58
+
59
+ if @options[:item]
53
60
  item = Standupguy::Item.new
54
- item.add_to_today(options[:item])
61
+ item.add_to_today(@options[:item])
55
62
  item.save
56
- date = DateTime.now.strftime("%Y-%m-%d")
57
- options = { report: "TEXT", date: date }.merge(options)
58
63
  end
64
+ end
59
65
 
60
- report(options).show unless options[:report].nil?
66
+ def show
67
+ report.show
61
68
  end
62
69
 
63
- def report(options)
64
- case options[:report]
70
+ def report
71
+ case @options[:report]
65
72
  when "HTML"
66
- Standupguy::HTMLReport.new(options[:date])
67
- when "TEXT"
68
- Standupguy::TextReport.new(options[:date])
73
+ Standupguy::HTMLReport.new(@options[:date])
69
74
  when "EMAIL"
70
- Standupguy::EmailReport.new(options[:date])
75
+ Standupguy::EmailReport.new(@options[:date])
76
+ else
77
+ Standupguy::TextReport.new(@options[:date])
71
78
  end
72
79
  end
73
80
 
@@ -1,3 +1,3 @@
1
1
  module Standupguy
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -12,22 +12,34 @@ describe Standupguy::Core do
12
12
  Standupguy::Core.new(subject)
13
13
  end
14
14
 
15
+ describe "defaults" do
16
+ subject{ Standupguy::Core.new( {} ) }
17
+
18
+ it "defaults to the current date" do
19
+ expect(subject.options[:date]).to eq(key)
20
+ end
21
+
22
+ it "defaults to a text report" do
23
+ expect(subject.report).to be_a_kind_of(Standupguy::TextReport)
24
+ end
25
+ end
26
+
15
27
  it "can generate a TEXT report" do
16
28
  subject.merge!(report: "TEXT")
17
29
  Standupguy::TextReport.any_instance.expects(:show)
18
- Standupguy::Core.new(subject)
30
+ Standupguy::Core.new(subject).show
19
31
  end
20
32
 
21
33
  it "can generate an HTML report" do
22
34
  subject.merge!(report: "HTML")
23
35
  Standupguy::HTMLReport.any_instance.expects(:show)
24
- Standupguy::Core.new(subject)
36
+ Standupguy::Core.new(subject).show
25
37
  end
26
38
 
27
39
  it "can generate an EMAIL report" do
28
40
  subject.merge!(report: "EMAIL")
29
41
  Standupguy::EmailReport.any_instance.expects(:show)
30
- Standupguy::Core.new(subject)
42
+ Standupguy::Core.new(subject).show
31
43
  end
32
44
 
33
45
  describe "adding an item" do
@@ -42,7 +54,7 @@ describe Standupguy::Core do
42
54
  Standupguy::TextReport.expects(:new).
43
55
  with(DateTime.now.strftime("%Y-%m-%d")).returns(report)
44
56
  report.expects(:show)
45
- Standupguy::Core.new(subject)
57
+ Standupguy::Core.new(subject).show
46
58
  end
47
59
  end
48
60
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Standupguy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Panzer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-22 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler