ledger_web 1.3 → 1.4

Sign up to get free protection for your applications and to get access to all the features.
data/ledger_web.gemspec CHANGED
@@ -16,10 +16,12 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency("pg")
17
17
  s.add_dependency("sequel")
18
18
  s.add_dependency("directory_watcher")
19
+ s.add_dependency("rack", ">= 1.3.6")
19
20
  s.add_dependency("sinatra")
20
21
  s.add_dependency("sinatra-session")
21
22
  s.add_dependency("sinatra-contrib")
22
23
 
24
+ s.bindir = 'bin'
23
25
  s.files = `git ls-files`.split("\n")
24
26
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
27
  s.require_paths = ["lib"]
@@ -34,8 +34,8 @@ module LedgerWeb
34
34
  @hooks[phase].each do |hook|
35
35
  hook.call(data)
36
36
  end
37
- return data
38
37
  end
38
+ return data
39
39
  end
40
40
 
41
41
  def override_with(config)
@@ -1,6 +1,11 @@
1
+ require 'rack/utils'
2
+ require 'cgi'
3
+
1
4
  module LedgerWeb
2
5
  module Helpers
3
6
 
7
+ include Rack::Utils
8
+
4
9
  def partial (template, locals = {})
5
10
  erb(template, :layout => false, :locals => locals)
6
11
  end
@@ -41,12 +46,16 @@ module LedgerWeb
41
46
  if key.match(value[1].title.to_s)
42
47
  url = String.new(links[key])
43
48
  row.each_with_index do |v,i|
44
- url.gsub!(":#{i}", v[0].to_s)
49
+ url.gsub!(":#{i}", CGI.escape(v[0].to_s))
45
50
  end
46
51
 
47
- url.gsub!(':title', value[1].title.to_s)
48
- display_value = "<a href='#{url}'>#{display_value}</a>"
52
+ url.gsub!(':title', CGI.escape(value[1].title.to_s))
53
+ url.gsub!(':now', CGI.escape(DateTime.now.strftime('%Y-%m-%d')))
54
+ display_value = "<a href='#{url}'>#{escape_html(display_value)}</a>"
55
+ else
56
+ display_value = escape_html(display_value)
49
57
  end
58
+
50
59
  end
51
60
  display_value
52
61
  end
@@ -20,7 +20,7 @@
20
20
  income,
21
21
  expenses,
22
22
  income - expenses as savings,
23
- round((income - expenses) / income * 100, 2) as rate
23
+ round(case when income = 0 then null else (income - expenses) / income * 100 end, 2) as rate
24
24
  from (
25
25
  select
26
26
  date_trunc('month', xtn_date)::date as month,
@@ -1,3 +1,3 @@
1
1
  module LedgerWeb
2
- VERSION = 1.3
2
+ VERSION = 1.4
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ledger_web
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
- requirement: &2153029640 !ruby/object:Gem::Requirement
16
+ requirement: &2152794860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153029640
24
+ version_requirements: *2152794860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sequel
27
- requirement: &2153019180 !ruby/object:Gem::Requirement
27
+ requirement: &2152794320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153019180
35
+ version_requirements: *2152794320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: directory_watcher
38
- requirement: &2153018000 !ruby/object:Gem::Requirement
38
+ requirement: &2152793840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,21 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153018000
46
+ version_requirements: *2152793840
47
+ - !ruby/object:Gem::Dependency
48
+ name: rack
49
+ requirement: &2152792900 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.6
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *2152792900
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: sinatra
49
- requirement: &2153015920 !ruby/object:Gem::Requirement
60
+ requirement: &2152791800 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: '0'
55
66
  type: :runtime
56
67
  prerelease: false
57
- version_requirements: *2153015920
68
+ version_requirements: *2152791800
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: sinatra-session
60
- requirement: &2153014380 !ruby/object:Gem::Requirement
71
+ requirement: &2152790420 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '0'
66
77
  type: :runtime
67
78
  prerelease: false
68
- version_requirements: *2153014380
79
+ version_requirements: *2152790420
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: sinatra-contrib
71
- requirement: &2153013360 !ruby/object:Gem::Requirement
82
+ requirement: &2152789480 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,7 +87,7 @@ dependencies:
76
87
  version: '0'
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *2153013360
90
+ version_requirements: *2152789480
80
91
  description: Allows arbitrary reporting on your ledger using easy-to-write SQL queries
81
92
  email:
82
93
  - pete@bugsplat.info