reparty 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,3 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ notifications:
5
+ hipchat:
6
+ rooms:
7
+ - secure: "NzBO5IvnxXlCi0mduolO51uDOICzx7kH2ULFFG+YOj8OL8fIFP+n5nETAID8\nmTqjQZBra8gd7s1lCk0H2KOLjuozZHICZQEbu9O9lURpnd0CwzrquHkrvr0U\n+CsTtJ6FO0cRIo5F4uuzS66DyLH6dz25pkp9bk3FydtIT6WkOCI="
8
+ on_success: always
9
+ on_failure: always
data/History.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.0
2
+
3
+ - Much improved email template
4
+
1
5
  ## 0.1.3
2
6
 
3
7
  - Better testing and coverage.
@@ -1,4 +1,4 @@
1
- <table width="500">
1
+ <table width="545" cellpadding="0" cellspacing="25" border="0">
2
2
  <tr>
3
3
  <td align="left">
4
4
  <h3 style="margin:0"><%= report.title %></h3>
@@ -9,6 +9,6 @@
9
9
  </td>
10
10
  </tr>
11
11
  <tr>
12
- <td align="center"><%= image_tag attachments["#{report.hash}.png"].url, align: "center" %></td>
12
+ <td align="center"><%= image_tag attachments["#{report.hash}.png"].url, border: 0, align: "center" %></td>
13
13
  </tr>
14
14
  </table>
@@ -1,20 +1,57 @@
1
- <html lang="en" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2
+ <html lang="en">
2
3
  <head>
3
4
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
4
5
  <style type="text/css">
5
- body { font-family: Helvetica, Arial, sans-serif; }
6
+ body { margin: 0; padding: 0; background: #eeeeee; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }
7
+
8
+ .title h1 { margin: 0; color: #999999; font-weight: normal; font-size: 25px; text-shadow: 0 1px 0 #ffffff; }
9
+
10
+ .report h3 { margin: 0; color: #444444; font-size: 16px; line-height: 24px; }
11
+ .report ul { margin-top: 5px; margin-bottom: 0; list-style-type: square; }
12
+ .report ul li { color: #888888; font-size: 14px; line-height: 20px; }
6
13
  </style>
7
14
  </head>
8
- <body>
9
- <table cellpadding="0" cellspacing="0" border="0" align="center" width="600">
10
- <tr>
11
- <td><h1><%= @title %></h1></td>
12
- </tr>
13
- <% @reports.each do |report| -%>
14
- <tr><td>
15
- <%= render partial: report.class.name.demodulize.underscore, locals:{report:report} %>
16
- </td></tr>
17
- <% end -%>
15
+ <body bgcolor="#eeeeee" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
16
+
17
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#eeeeee">
18
+ <tr>
19
+ <td bgcolor="#eeeeee" width="100%">
20
+
21
+ <table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="main">
22
+ <tr><td><img border="0" src="<%= attachments["spacer.gif"].url %>" width="1" height="25"><br></td></tr>
23
+
24
+ <tr>
25
+ <td width="600" class="title">
26
+ <h1><%= @title %></h1>
27
+ </td>
28
+ </tr>
29
+
30
+ <tr><td><img border="0" src="<%= attachments["spacer.gif"].url %>" width="1" height="25"><br></td></tr>
31
+
32
+ <% @reports.each do |report| -%>
33
+ <tr>
34
+ <td bgcolor="#ffffff">
35
+
36
+ <table width="600" cellpadding="0" cellspacing="0" border="0" align="center">
37
+ <tr>
38
+ <td bgcolor="<%= report.color %>" nowrap><img border="0" src="<%= attachments["spacer.gif"].url %>" width="5" height="1"></td>
39
+ <td class="report">
40
+ <%= render partial: report.class.name.demodulize.underscore, locals:{report:report} %>
41
+ </td>
42
+ </tr>
43
+ </table>
44
+
45
+ </td>
46
+ </tr>
47
+
48
+ <tr><td><img border="0" src="<%= attachments["spacer.gif"].url %>" width="1" height="25"><br></td></tr>
49
+ <% end -%>
50
+ </table>
51
+
52
+ </td>
53
+ </tr>
18
54
  </table>
55
+
19
56
  </body>
20
57
  </html>
@@ -22,6 +22,8 @@ module Reparty
22
22
  if args.last.is_a?(Hash)
23
23
  @field = args.last.fetch(:field, @field)
24
24
  end
25
+
26
+ @color = "#85bdad"
25
27
  end
26
28
 
27
29
  def attach(attachments)
@@ -2,11 +2,12 @@ require 'gruff'
2
2
 
3
3
  module Reparty
4
4
  class Report
5
- attr_reader :title
5
+ attr_reader :title, :color
6
6
 
7
7
  def initialize(title)
8
8
  raise "Report: title must be defined" if title.blank?
9
9
  @title = title
10
+ @color = "#832701"
10
11
  end
11
12
 
12
13
  def attach(attachments)
@@ -16,7 +17,7 @@ module Reparty
16
17
  protected
17
18
 
18
19
  def build_daily_graph
19
- g = Gruff::Line.new(500)
20
+ g = Gruff::Line.new(545)
20
21
  g.title = @title
21
22
  g.labels = Hash[*(1..7).map{|x| [x-1, (DateTime.now - (8-x)).strftime("%-m/%-d")] }.flatten]
22
23
  g
@@ -1,3 +1,3 @@
1
1
  module Reparty
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -4,13 +4,13 @@ describe Reparty::Report::ActiveRecord do
4
4
  before(:each) do
5
5
  User.delete_all
6
6
  [
7
- {:name => "Someone", :score => 7, :created_at => DateTime.now - 2},
8
- {:name => "Sometwo", :score => 4, :created_at => DateTime.now - 2},
9
- {:name => "Somethree", :score => 6, :created_at => DateTime.now - 4},
10
- {:name => "Somefour", :score => 8, :created_at => DateTime.now - 5},
11
- {:name => "Somefive", :score => 2, :created_at => DateTime.now - 6},
12
- {:name => "Somesix", :score => 4, :created_at => DateTime.now - 7},
13
- {:name => "Someseven", :score => 5, :created_at => DateTime.now - 8},
7
+ {:name => "Someone", :score => 7, :created_at => DateTime.now.utc - 2},
8
+ {:name => "Sometwo", :score => 4, :created_at => DateTime.now.utc - 2},
9
+ {:name => "Somethree", :score => 6, :created_at => DateTime.now.utc - 4},
10
+ {:name => "Somefour", :score => 8, :created_at => DateTime.now.utc - 5},
11
+ {:name => "Somefive", :score => 2, :created_at => DateTime.now.utc - 6},
12
+ {:name => "Somesix", :score => 4, :created_at => DateTime.now.utc - 7},
13
+ {:name => "Someseven", :score => 5, :created_at => DateTime.now.utc - 8},
14
14
  ].each{|u| User.create!(u) }
15
15
  end
16
16
 
@@ -20,6 +20,7 @@ describe Reparty::Report::ActiveRecord do
20
20
  end
21
21
  Reparty.reports.last.should be_kind_of(Reparty::Report::ActiveRecord)
22
22
  Reparty.reports.last.field.should == :updated_at
23
+ Reparty.reports.last.color.should == "#85bdad"
23
24
  end
24
25
 
25
26
  describe "when configured" do
@@ -31,7 +32,7 @@ describe Reparty::Report::ActiveRecord do
31
32
  end
32
33
  end
33
34
 
34
- its(:daily_dataset) { should == [1,1,1,1,0,2,0] }
35
+ its(:daily_dataset) { should == [1,1,1,1,1,0,2] }
35
36
  its(:yesterday) { should == 0 }
36
37
  its(:total) { should == 7 }
37
38
 
@@ -42,6 +43,6 @@ describe Reparty::Report::ActiveRecord do
42
43
  config.add_report Reparty::Report::ActiveRecord, "Users", User.where("score > 2")
43
44
  end
44
45
 
45
- Reparty.reports.first.daily_dataset.should == [1,0,1,1,0,2,0]
46
+ Reparty.reports.first.daily_dataset.should == [1,1,0,1,1,0,2]
46
47
  end
47
48
  end
data/spec/report_spec.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Reparty::Report do
4
+ subject { Reparty::Report.new("title") }
5
+
6
+ its(:color) { should == "#832701"}
7
+
4
8
  it "requires a title" do
5
9
  expect {
6
10
  Reparty::Report.new("title!")
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: reparty
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tim Dorr
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-30 00:00:00.000000000 Z
12
+ date: 2013-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -236,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
236
236
  - !ruby/object:Gem::Version
237
237
  segments:
238
238
  - 0
239
- hash: -2326617942831094702
239
+ hash: 3162642364766815676
240
240
  version: '0'
241
241
  none: false
242
242
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  - !ruby/object:Gem::Version
246
246
  segments:
247
247
  - 0
248
- hash: -2326617942831094702
248
+ hash: 3162642364766815676
249
249
  version: '0'
250
250
  none: false
251
251
  requirements: []