jreport 0.0.10 → 0.0.11
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 +4 -4
- data/README.md +19 -0
- data/lib/jreport/assembler.rb +5 -1
- data/lib/jreport/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e293697755777e04f70ac01bd27348ff8b092f7a
|
4
|
+
data.tar.gz: 09f4025c4c023553c432cec19ab806d4744ad2ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89af7c17a2cd543575794380bd60dfe8c17d53a9aff5d09d4ac060fb1603c57d2360aec1bb0deeb99295536ab175a0cbf6986474d32c44650982e39b09b83b0c
|
7
|
+
data.tar.gz: 009c76248309b3b0ee9341652b934f54479c88746d21fe6f1af7f2d10ca3683e1f315fb43b720204a03fd9b29da6137f69a0697bc01d08ef29968a13a1576a20
|
data/README.md
CHANGED
@@ -102,6 +102,20 @@ This is a simple weekly report template:
|
|
102
102
|
<%= data %>
|
103
103
|
|
104
104
|
Note: in the template you can use helper method that is defined in helpers folder. You can access the active record classes, too.
|
105
|
+
|
106
|
+
For example. If you have a file `number_helper.rb` in helper folder:
|
107
|
+
|
108
|
+
module NumberHelper
|
109
|
+
def pretty_number(num)
|
110
|
+
num,result=num.to_s,''
|
111
|
+
num.reverse.split('').each_with_index{|v,i| result<<v;result<<',' if (i+1)%3==0}
|
112
|
+
result=result[0..-2] if result[-1]==','
|
113
|
+
result.reverse
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
Then you can use the helper method `pretty_number` directory in views as: `<%= pretty_number 1234345 %>`
|
118
|
+
|
105
119
|
### Gnerate report
|
106
120
|
|
107
121
|
jreport make weather
|
@@ -124,6 +138,11 @@ P.S. See all available rake command:
|
|
124
138
|
|
125
139
|
rake -T
|
126
140
|
|
141
|
+
Besides, you can access database directly in `irb`:
|
142
|
+
|
143
|
+
require './boot.rb'
|
144
|
+
|
145
|
+
|
127
146
|
### Mail configuration example(from [mail](https://github.com/mikel/mail))
|
128
147
|
|
129
148
|
1. Change default delivery method
|
data/lib/jreport/assembler.rb
CHANGED
@@ -33,7 +33,11 @@ module Jreport
|
|
33
33
|
html=render_html(dir,m.to_s,:data=>ctrl.data)
|
34
34
|
File.open(ctrl.save_to,'w'){|fi| fi.write(html) } if ctrl.save_to
|
35
35
|
# send out report
|
36
|
-
mail.
|
36
|
+
if mail.html_part
|
37
|
+
mail.html_part.body=html
|
38
|
+
else
|
39
|
+
mail.body=html
|
40
|
+
end
|
37
41
|
send_mail(mail)
|
38
42
|
rescue=>e
|
39
43
|
puts e
|
data/lib/jreport/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jreport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- qjpcpu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|