sequel-reporter 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,6 +43,10 @@ module Sequel::Reporter
43
43
  def initialize(app=nil)
44
44
  @db = Sequel.connect(self.class.settings.database_url)
45
45
 
46
+ if settings.after_db_connect_hook
47
+ settings.after_db_connect_hook(@db)
48
+ end
49
+
46
50
  path = File.join(settings.root, "lib", "**", "*.rb")
47
51
  Dir.glob(path).each do |file|
48
52
  next if file.match(/ruby\/1.9.1/) # in case ruby somehow got in the lib directory (don't ask)
@@ -30,11 +30,12 @@ module Sequel::Reporter
30
30
 
31
31
  def self.from_query(db, query)
32
32
 
33
+ new_params = {}
33
34
  @@params.each do |key, val|
34
- params[key.to_sym] = val
35
+ new_params[key.to_sym] = val
35
36
  end
36
37
 
37
- ds = db.fetch(query, params)
38
+ ds = db.fetch(query, new_params)
38
39
  report = self.new
39
40
  begin
40
41
  row = ds.first
@@ -1,5 +1,5 @@
1
1
  module Sequel
2
2
  module Reporter
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -22,6 +22,8 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency('sinatra', '1.4.2')
23
23
  gem.add_dependency('sinatra-contrib')
24
24
  gem.add_dependency('sequel')
25
+ gem.add_dependency('rake')
25
26
 
26
27
  gem.add_development_dependency('sqlite3')
28
+
27
29
  end
data/test/table_spec.rb CHANGED
@@ -12,6 +12,7 @@ describe Sequel::Reporter::Table do
12
12
  before :each do
13
13
  @things.insert(:id => 1, :something => "hi", :other => "2013-02-18")
14
14
  @things.insert(:id => 2, :something => "ho", :other => "2013-02-19")
15
+ @now = DateTime.now.strftime('%Y-%m-%d')
15
16
  end
16
17
 
17
18
  describe "#render" do
@@ -57,7 +58,7 @@ describe Sequel::Reporter::Table do
57
58
  end
58
59
 
59
60
  now = DateTime.now.strftime('%Y-%m-%d')
60
- table.render.should eq("<table ><thead><tr><th><span class=\"pull-right\">foo</span></th></tr></thead><tbody><tr><td style=\"\"><span class=\"pull-right\"><a href=\"/something?q=2&now=2013-04-12&title=foo&this=2\">2.000</a></span></td></tr></tbody></table>")
61
+ table.render.should eq("<table ><thead><tr><th><span class=\"pull-right\">foo</span></th></tr></thead><tbody><tr><td style=\"\"><span class=\"pull-right\"><a href=\"/something?q=2&now=#{@now}&title=foo&this=2\">2.000</a></span></td></tr></tbody></table>")
61
62
  end
62
63
 
63
64
  it "should decorate with icon decorator" do
@@ -87,7 +88,7 @@ describe Sequel::Reporter::Table do
87
88
  end
88
89
 
89
90
  now = DateTime.now.strftime('%Y-%m-%d')
90
- table.render.should eq("<table ><thead><tr><th><span class=\"pull-left\">foo</span></th></tr></thead><tbody><tr><td style=\"\"><span class=\"pull-left\"><a href=\"/something?q=2&now=2013-04-12&title=foo&this=2\">2</a></span></td></tr></tbody></table>")
91
+ table.render.should eq("<table ><thead><tr><th><span class=\"pull-left\">foo</span></th></tr></thead><tbody><tr><td style=\"\"><span class=\"pull-left\"><a href=\"/something?q=2&now=#{@now}&title=foo&this=2\">2</a></span></td></tr></tbody></table>")
91
92
  end
92
93
 
93
94
  it "should decorate with highlight decorator" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-13 00:00:00.000000000 Z
12
+ date: 2013-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rake
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
94
110
  - !ruby/object:Gem::Dependency
95
111
  name: sqlite3
96
112
  requirement: !ruby/object:Gem::Requirement