rghost_rails 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rghost_rails.rb +18 -8
- metadata +11 -4
data/lib/rghost_rails.rb
CHANGED
@@ -10,32 +10,42 @@ class ActionController::Base
|
|
10
10
|
|
11
11
|
template = case report
|
12
12
|
when Hash
|
13
|
-
File.join(report[:controller] || controller_name, report[:action])
|
13
|
+
File.join(report[:controller] || controller_name, report[:action].to_s)
|
14
14
|
when String, Symbol
|
15
15
|
File.join(controller_path, report.to_s)
|
16
16
|
when NilClass
|
17
17
|
File.join(controller_path, action_name)
|
18
18
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
template_file = begin
|
20
|
+
template = view_paths.find_template(template, "rghost.rb", false)
|
21
|
+
template.filename
|
22
|
+
rescue NoMethodError
|
23
|
+
fname = "#{template}.rghost.rb"
|
24
|
+
template_dir = view_paths.detect do |path|
|
25
|
+
File.exists? File.join(path.to_s,fname)
|
26
|
+
end
|
27
|
+
File.join(template_dir.to_s,fname)
|
28
|
+
end
|
29
|
+
|
22
30
|
ActionView::Helpers.included_modules.each do |m|
|
23
31
|
extend m
|
24
32
|
end
|
25
|
-
|
26
|
-
|
33
|
+
lines = File.readlines(template_file.to_s)
|
34
|
+
|
27
35
|
doc = eval(lines.join)
|
28
36
|
|
29
37
|
filename = options.delete(:filename)
|
38
|
+
disposition=options.delete(:disposition) || 'attachment'
|
30
39
|
rghost = doc.render(format, options)
|
31
40
|
output = rghost.output
|
32
|
-
|
41
|
+
|
33
42
|
raise "RGhost::Error #{rghost.errors} - #{output}" if rghost.error?
|
34
43
|
|
35
44
|
data = output.readlines.join
|
36
45
|
rghost.clear_output
|
37
46
|
|
38
|
-
send_data(data, :filename => filename, :type => Mime::Type.lookup_by_extension(format.to_s))
|
47
|
+
send_data(data, :filename => filename, :disposition => disposition, :type => Mime::Type.lookup_by_extension(format.to_s))
|
39
48
|
end
|
40
49
|
end
|
41
50
|
|
51
|
+
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rghost_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Shairon Toledo, Gabriel Sobrinho
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-12-15 00:00:00 -02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rghost
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 49
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
- 8
|
@@ -51,23 +54,27 @@ rdoc_options: []
|
|
51
54
|
require_paths:
|
52
55
|
- lib
|
53
56
|
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
54
58
|
requirements:
|
55
59
|
- - ">="
|
56
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
57
62
|
segments:
|
58
63
|
- 0
|
59
64
|
version: "0"
|
60
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
61
67
|
requirements:
|
62
68
|
- - ">="
|
63
69
|
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
64
71
|
segments:
|
65
72
|
- 0
|
66
73
|
version: "0"
|
67
74
|
requirements: []
|
68
75
|
|
69
76
|
rubyforge_project: An Rails adapter to work with RGhost in the view layer
|
70
|
-
rubygems_version: 1.3.
|
77
|
+
rubygems_version: 1.3.7
|
71
78
|
signing_key:
|
72
79
|
specification_version: 3
|
73
80
|
summary: A Rails adapter to work with RGhost in the view layer
|